hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6d62da3035960e5ec8d3f379d2ce38c08a695e0b | vishalbelsare/dora | dora/server/server.py | [
"Apache-2.0"
] | Python | update_sampler | <not_specific> | def update_sampler(samplerid, uid):
""" updates the sampler with the forward model's observation
uid : the unique identifier provided with the query parameters
Expects a list of the forward models outputs (s elements where s also
equals the number of stacks in the sampler)
"""
measurement = fl.... | updates the sampler with the forward model's observation
uid : the unique identifier provided with the query parameters
Expects a list of the forward models outputs (s elements where s also
equals the number of stacks in the sampler)
| updates the sampler with the forward model's observation
uid : the unique identifier provided with the query parameters
Expects a list of the forward models outputs (s elements where s also
equals the number of stacks in the sampler) | [
"updates",
"the",
"sampler",
"with",
"the",
"forward",
"model",
"'",
"s",
"observation",
"uid",
":",
"the",
"unique",
"identifier",
"provided",
"with",
"the",
"query",
"parameters",
"Expects",
"a",
"list",
"of",
"the",
"forward",
"models",
"outputs",
"(",
"s... | def update_sampler(samplerid, uid):
measurement = fl.request.json
fl.current_app.samplers[int(samplerid)].update(uid,
np.asarray(measurement))
response_data = "Model updated with measurement"
return response_data, 200 | [
"def",
"update_sampler",
"(",
"samplerid",
",",
"uid",
")",
":",
"measurement",
"=",
"fl",
".",
"request",
".",
"json",
"fl",
".",
"current_app",
".",
"samplers",
"[",
"int",
"(",
"samplerid",
")",
"]",
".",
"update",
"(",
"uid",
",",
"np",
".",
"asa... | updates the sampler with the forward model's observation
uid : the unique identifier provided with the query parameters | [
"updates",
"the",
"sampler",
"with",
"the",
"forward",
"model",
"'",
"s",
"observation",
"uid",
":",
"the",
"unique",
"identifier",
"provided",
"with",
"the",
"query",
"parameters"
] | [
"\"\"\" updates the sampler with the forward model's observation\n uid : the unique identifier provided with the query parameters\n\n Expects a list of the forward models outputs (s elements where s also\n equals the number of stacks in the sampler)\n \"\"\""
] | [
{
"param": "samplerid",
"type": null
},
{
"param": "uid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "samplerid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "uid",
"type": null,
"docstring": null,
"docstring_tokens... |
6d62da3035960e5ec8d3f379d2ce38c08a695e0b | vishalbelsare/dora | dora/server/server.py | [
"Apache-2.0"
] | Python | predict | <not_specific> | def predict(samplerid):
"""
provides a prediction of the forward model at a set of given query
parameters
It expects a list of lists with n elements in the main list
corresponding to the number of queries and each element has d elements
corresponding to the number of parameters in the forward m... |
provides a prediction of the forward model at a set of given query
parameters
It expects a list of lists with n elements in the main list
corresponding to the number of queries and each element has d elements
corresponding to the number of parameters in the forward model.
It returns a dict wi... | provides a prediction of the forward model at a set of given query
parameters
It expects a list of lists with n elements in the main list
corresponding to the number of queries and each element has d elements
corresponding to the number of parameters in the forward model.
It returns a dict with a predictive mean and ... | [
"provides",
"a",
"prediction",
"of",
"the",
"forward",
"model",
"at",
"a",
"set",
"of",
"given",
"query",
"parameters",
"It",
"expects",
"a",
"list",
"of",
"lists",
"with",
"n",
"elements",
"in",
"the",
"main",
"list",
"corresponding",
"to",
"the",
"number... | def predict(samplerid):
query_loc = fl.request.json
pred_mean, pred_var = \
fl.current_app.samplers[int(samplerid)].predict(np.asarray(query_loc))
response_data = {"predictive_mean": pred_mean.tolist(),
"predictive_variance": pred_var.tolist()}
return response_data, 200 | [
"def",
"predict",
"(",
"samplerid",
")",
":",
"query_loc",
"=",
"fl",
".",
"request",
".",
"json",
"pred_mean",
",",
"pred_var",
"=",
"fl",
".",
"current_app",
".",
"samplers",
"[",
"int",
"(",
"samplerid",
")",
"]",
".",
"predict",
"(",
"np",
".",
"... | provides a prediction of the forward model at a set of given query
parameters | [
"provides",
"a",
"prediction",
"of",
"the",
"forward",
"model",
"at",
"a",
"set",
"of",
"given",
"query",
"parameters"
] | [
"\"\"\"\n provides a prediction of the forward model at a set of given query\n parameters\n\n It expects a list of lists with n elements in the main list\n corresponding to the number of queries and each element has d elements\n corresponding to the number of parameters in the forward model.\n\n I... | [
{
"param": "samplerid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "samplerid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d62da3035960e5ec8d3f379d2ce38c08a695e0b | vishalbelsare/dora | dora/server/server.py | [
"Apache-2.0"
] | Python | retrieve_trainingdata | <not_specific> | def retrieve_trainingdata(samplerid):
"""
provides lists of the real and virtual training data used by the sampler.
"""
X = [x.tolist() for x in fl.current_app.samplers[int(samplerid)].X]
y = [y.tolist() for y in fl.current_app.samplers[int(samplerid)].y]
virtualIndices = fl.current_app.sampler... |
provides lists of the real and virtual training data used by the sampler.
| provides lists of the real and virtual training data used by the sampler. | [
"provides",
"lists",
"of",
"the",
"real",
"and",
"virtual",
"training",
"data",
"used",
"by",
"the",
"sampler",
"."
] | def retrieve_trainingdata(samplerid):
X = [x.tolist() for x in fl.current_app.samplers[int(samplerid)].X]
y = [y.tolist() for y in fl.current_app.samplers[int(samplerid)].y]
virtualIndices = fl.current_app.samplers[int(samplerid)].virtual_flag
real_id = [not i for i in virtualIndices]
real_X = [x_ f... | [
"def",
"retrieve_trainingdata",
"(",
"samplerid",
")",
":",
"X",
"=",
"[",
"x",
".",
"tolist",
"(",
")",
"for",
"x",
"in",
"fl",
".",
"current_app",
".",
"samplers",
"[",
"int",
"(",
"samplerid",
")",
"]",
".",
"X",
"]",
"y",
"=",
"[",
"y",
".",
... | provides lists of the real and virtual training data used by the sampler. | [
"provides",
"lists",
"of",
"the",
"real",
"and",
"virtual",
"training",
"data",
"used",
"by",
"the",
"sampler",
"."
] | [
"\"\"\"\n provides lists of the real and virtual training data used by the sampler.\n \"\"\""
] | [
{
"param": "samplerid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "samplerid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d62da3035960e5ec8d3f379d2ce38c08a695e0b | vishalbelsare/dora | dora/server/server.py | [
"Apache-2.0"
] | Python | retrieve_settings | <not_specific> | def retrieve_settings(samplerid):
"""
provides lists of the settings used by the sampler.
"""
lower = fl.current_app.samplers[int(samplerid)].lower.tolist()
upper = fl.current_app.samplers[int(samplerid)].upper.tolist()
# n_stacks = fl.current_app.samplers[int(samplerid)].n_stacks
mean = l... |
provides lists of the settings used by the sampler.
| provides lists of the settings used by the sampler. | [
"provides",
"lists",
"of",
"the",
"settings",
"used",
"by",
"the",
"sampler",
"."
] | def retrieve_settings(samplerid):
lower = fl.current_app.samplers[int(samplerid)].lower.tolist()
upper = fl.current_app.samplers[int(samplerid)].upper.tolist()
mean = list(fl.current_app.samplers[int(samplerid)].y_mean)
virtualIndices = fl.current_app.samplers[int(samplerid)].virtual_flag
real_id ... | [
"def",
"retrieve_settings",
"(",
"samplerid",
")",
":",
"lower",
"=",
"fl",
".",
"current_app",
".",
"samplers",
"[",
"int",
"(",
"samplerid",
")",
"]",
".",
"lower",
".",
"tolist",
"(",
")",
"upper",
"=",
"fl",
".",
"current_app",
".",
"samplers",
"["... | provides lists of the settings used by the sampler. | [
"provides",
"lists",
"of",
"the",
"settings",
"used",
"by",
"the",
"sampler",
"."
] | [
"\"\"\"\n provides lists of the settings used by the sampler.\n \"\"\"",
"# n_stacks = fl.current_app.samplers[int(samplerid)].n_stacks",
"# trained_flag = fl.current_app.samplers[int(samplerid)].trained_flag",
"# TODO add ability to retrieve full state",
"# hyper_params = fl.current_app.samplers[int(... | [
{
"param": "samplerid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "samplerid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d53e3849e75e34fd5c55b75fb2e6c600a7983a93 | vishalbelsare/dora | dora/regressors/gp/kernel.py | [
"Apache-2.0"
] | Python | non_stationary | <not_specific> | def non_stationary(x_p, x_q, params):
""" Implementation of Paciorek's kernel where length scale is defined as
a continuous function L(x), and computed by operations on L(x1) and L(x2)
Note - we globally apply ARD scaling, then inside the scaled space apply an
isotropic non-stationary treatment accordi... | Implementation of Paciorek's kernel where length scale is defined as
a continuous function L(x), and computed by operations on L(x1) and L(x2)
Note - we globally apply ARD scaling, then inside the scaled space apply an
isotropic non-stationary treatment according to L(x)
Arguments:
x_p, x_q : n*... | Implementation of Paciorek's kernel where length scale is defined as
a continuous function L(x), and computed by operations on L(x1) and L(x2)
we globally apply ARD scaling, then inside the scaled space apply an
isotropic non-stationary treatment according to L(x) | [
"Implementation",
"of",
"Paciorek",
"'",
"s",
"kernel",
"where",
"length",
"scale",
"is",
"defined",
"as",
"a",
"continuous",
"function",
"L",
"(",
"x",
")",
"and",
"computed",
"by",
"operations",
"on",
"L",
"(",
"x1",
")",
"and",
"L",
"(",
"x2",
")",
... | def non_stationary(x_p, x_q, params):
assert(x_p.ndim == 2)
if x_q is None:
return np.ones(x_p.shape[0])
LS_mult, LS_func = params
dims = x_p.shape[1]
ls_p = LS_func(x_p)
ls_q = LS_func(x_q)
if dims > 1:
assert(LS_mult.shape[0] == dims)
assert(len(LS_mult.shape) == ... | [
"def",
"non_stationary",
"(",
"x_p",
",",
"x_q",
",",
"params",
")",
":",
"assert",
"(",
"x_p",
".",
"ndim",
"==",
"2",
")",
"if",
"x_q",
"is",
"None",
":",
"return",
"np",
".",
"ones",
"(",
"x_p",
".",
"shape",
"[",
"0",
"]",
")",
"LS_mult",
"... | Implementation of Paciorek's kernel where length scale is defined as
a continuous function L(x), and computed by operations on L(x1) and L(x2) | [
"Implementation",
"of",
"Paciorek",
"'",
"s",
"kernel",
"where",
"length",
"scale",
"is",
"defined",
"as",
"a",
"continuous",
"function",
"L",
"(",
"x",
")",
"and",
"computed",
"by",
"operations",
"on",
"L",
"(",
"x1",
")",
"and",
"L",
"(",
"x2",
")"
] | [
"\"\"\" Implementation of Paciorek's kernel where length scale is defined as\n a continuous function L(x), and computed by operations on L(x1) and L(x2)\n\n Note - we globally apply ARD scaling, then inside the scaled space apply an\n isotropic non-stationary treatment according to L(x)\n\n Arguments:\n... | [
{
"param": "x_p",
"type": null
},
{
"param": "x_q",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x_p",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x_q",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
755f6e9d2b2422c2749be780323ed5a9fd8a3fbd | vishalbelsare/dora | dora/active_sampling/base_sampler.py | [
"Apache-2.0"
] | Python | pick | null | def pick(self):
"""
Pick the next feature location for the next observation to be taken.
.. note::
Currently only supports rectangular type restrictions on the
parameter space
Returns
-------
numpy.ndarray
Location in the parameter s... |
Pick the next feature location for the next observation to be taken.
.. note::
Currently only supports rectangular type restrictions on the
parameter space
Returns
-------
numpy.ndarray
Location in the parameter space for the next observati... | Pick the next feature location for the next observation to be taken.
note:.
Currently only supports rectangular type restrictions on the
parameter space
Returns
numpy.ndarray
Location in the parameter space for the next observation to be
taken
str
A random hexadecimal ID to identify the corresponding job
Raises
As... | [
"Pick",
"the",
"next",
"feature",
"location",
"for",
"the",
"next",
"observation",
"to",
"be",
"taken",
".",
"note",
":",
".",
"Currently",
"only",
"supports",
"rectangular",
"type",
"restrictions",
"on",
"the",
"parameter",
"space",
"Returns",
"numpy",
".",
... | def pick(self):
assert False | [
"def",
"pick",
"(",
"self",
")",
":",
"assert",
"False"
] | Pick the next feature location for the next observation to be taken. | [
"Pick",
"the",
"next",
"feature",
"location",
"for",
"the",
"next",
"observation",
"to",
"be",
"taken",
"."
] | [
"\"\"\"\n Pick the next feature location for the next observation to be taken.\n\n .. note::\n\n Currently only supports rectangular type restrictions on the\n parameter space\n\n Returns\n -------\n numpy.ndarray\n Location in the parameter space ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
755f6e9d2b2422c2749be780323ed5a9fd8a3fbd | vishalbelsare/dora | dora/active_sampling/base_sampler.py | [
"Apache-2.0"
] | Python | update | null | def update(self, uid, y_true):
"""
Update a job with its observed value.
.. note::
Currently a dummy function whose functionality will be
filled by subclasses of the Sampler class
Parameters
----------
uid : str
A hexadecimal ID that... |
Update a job with its observed value.
.. note::
Currently a dummy function whose functionality will be
filled by subclasses of the Sampler class
Parameters
----------
uid : str
A hexadecimal ID that identifies the job to be updated
... | Update a job with its observed value.
note:.
Currently a dummy function whose functionality will be
filled by subclasses of the Sampler class
Parameters
uid : str
A hexadecimal ID that identifies the job to be updated
y_true : float
The observed value corresponding to the job identified by 'uid'
Returns
int
Index ... | [
"Update",
"a",
"job",
"with",
"its",
"observed",
"value",
".",
"note",
":",
".",
"Currently",
"a",
"dummy",
"function",
"whose",
"functionality",
"will",
"be",
"filled",
"by",
"subclasses",
"of",
"the",
"Sampler",
"class",
"Parameters",
"uid",
":",
"str",
... | def update(self, uid, y_true):
assert False | [
"def",
"update",
"(",
"self",
",",
"uid",
",",
"y_true",
")",
":",
"assert",
"False"
] | Update a job with its observed value. | [
"Update",
"a",
"job",
"with",
"its",
"observed",
"value",
"."
] | [
"\"\"\"\n Update a job with its observed value.\n\n .. note::\n\n Currently a dummy function whose functionality will be\n filled by subclasses of the Sampler class\n\n Parameters\n ----------\n uid : str\n A hexadecimal ID that identifies the job ... | [
{
"param": "self",
"type": null
},
{
"param": "uid",
"type": null
},
{
"param": "y_true",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "uid",
"type": null,
"docstring": null,
"docstring_tokens": []... |
755f6e9d2b2422c2749be780323ed5a9fd8a3fbd | vishalbelsare/dora | dora/active_sampling/base_sampler.py | [
"Apache-2.0"
] | Python | _assign | <not_specific> | def _assign(self, xq, yq_exp):
"""
Assign a pair (location in parameter space, virtual target) a job ID.
Parameters
----------
xq : numpy.ndarray
Location in the parameter space for the next observation to be
taken
yq_exp : float
The v... |
Assign a pair (location in parameter space, virtual target) a job ID.
Parameters
----------
xq : numpy.ndarray
Location in the parameter space for the next observation to be
taken
yq_exp : float
The virtual target output at that parameter loc... | Assign a pair (location in parameter space, virtual target) a job ID.
Parameters
xq : numpy.ndarray
Location in the parameter space for the next observation to be
taken
yq_exp : float
The virtual target output at that parameter location
Returns
str
A random hexadecimal ID to identify the corresponding job | [
"Assign",
"a",
"pair",
"(",
"location",
"in",
"parameter",
"space",
"virtual",
"target",
")",
"a",
"job",
"ID",
".",
"Parameters",
"xq",
":",
"numpy",
".",
"ndarray",
"Location",
"in",
"the",
"parameter",
"space",
"for",
"the",
"next",
"observation",
"to",... | def _assign(self, xq, yq_exp):
n = len(self.X)
self.X.append(xq)
self.virtual_flag.append(True)
if yq_exp is None and self.n_tasks is not None:
self.y.append(np.zeros(self.n_tasks))
else:
self.y.append(yq_exp)
uid = uuid.uuid4().hex
sel... | [
"def",
"_assign",
"(",
"self",
",",
"xq",
",",
"yq_exp",
")",
":",
"n",
"=",
"len",
"(",
"self",
".",
"X",
")",
"self",
".",
"X",
".",
"append",
"(",
"xq",
")",
"self",
".",
"virtual_flag",
".",
"append",
"(",
"True",
")",
"if",
"yq_exp",
"is",... | Assign a pair (location in parameter space, virtual target) a job ID. | [
"Assign",
"a",
"pair",
"(",
"location",
"in",
"parameter",
"space",
"virtual",
"target",
")",
"a",
"job",
"ID",
"."
] | [
"\"\"\"\n Assign a pair (location in parameter space, virtual target) a job ID.\n\n Parameters\n ----------\n xq : numpy.ndarray\n Location in the parameter space for the next observation to be\n taken\n yq_exp : float\n The virtual target output a... | [
{
"param": "self",
"type": null
},
{
"param": "xq",
"type": null
},
{
"param": "yq_exp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xq",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
755f6e9d2b2422c2749be780323ed5a9fd8a3fbd | vishalbelsare/dora | dora/active_sampling/base_sampler.py | [
"Apache-2.0"
] | Python | _update | <not_specific> | def _update(self, uid, y_true):
"""
Update a job with its observed value.
Parameters
----------
uid : str
A hexadecimal ID that identifies the job to be updated
y_true : float
The observed value corresponding to the job identified by 'uid'
... |
Update a job with its observed value.
Parameters
----------
uid : str
A hexadecimal ID that identifies the job to be updated
y_true : float
The observed value corresponding to the job identified by 'uid'
Returns
-------
int
... | Update a job with its observed value.
Parameters
uid : str
A hexadecimal ID that identifies the job to be updated
y_true : float
The observed value corresponding to the job identified by 'uid'
Returns
int
Index location in the data lists 'Sampler.X' and
'Sampler.y' corresponding to the job being updated | [
"Update",
"a",
"job",
"with",
"its",
"observed",
"value",
".",
"Parameters",
"uid",
":",
"str",
"A",
"hexadecimal",
"ID",
"that",
"identifies",
"the",
"job",
"to",
"be",
"updated",
"y_true",
":",
"float",
"The",
"observed",
"value",
"corresponding",
"to",
... | def _update(self, uid, y_true):
if uid not in self.pending_results:
warnings.warn('Result was not pending!')
assert uid in self.pending_results
ind = self.pending_results.pop(uid)
if self.n_tasks is None:
self.n_tasks = len(np.atleast_1d(y_true))
pendi... | [
"def",
"_update",
"(",
"self",
",",
"uid",
",",
"y_true",
")",
":",
"if",
"uid",
"not",
"in",
"self",
".",
"pending_results",
":",
"warnings",
".",
"warn",
"(",
"'Result was not pending!'",
")",
"assert",
"uid",
"in",
"self",
".",
"pending_results",
"ind",... | Update a job with its observed value. | [
"Update",
"a",
"job",
"with",
"its",
"observed",
"value",
"."
] | [
"\"\"\"\n Update a job with its observed value.\n\n Parameters\n ----------\n uid : str\n A hexadecimal ID that identifies the job to be updated\n y_true : float\n The observed value corresponding to the job identified by 'uid'\n\n Returns\n ---... | [
{
"param": "self",
"type": null
},
{
"param": "uid",
"type": null
},
{
"param": "y_true",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "uid",
"type": null,
"docstring": null,
"docstring_tokens": []... |
755f6e9d2b2422c2749be780323ed5a9fd8a3fbd | vishalbelsare/dora | dora/active_sampling/base_sampler.py | [
"Apache-2.0"
] | Python | random_sample | <not_specific> | def random_sample(lower, upper, n):
"""
Used to randomly sample the search space.
Provide search parameters and the number of samples desired.
Parameters
----------
lower : array_like
Lower or minimum bounds for the parameter space
upper : array_like
Upper or maximum bounds... |
Used to randomly sample the search space.
Provide search parameters and the number of samples desired.
Parameters
----------
lower : array_like
Lower or minimum bounds for the parameter space
upper : array_like
Upper or maximum bounds for the parameter space
n : int
... | Used to randomly sample the search space.
Provide search parameters and the number of samples desired.
Parameters
lower : array_like
Lower or minimum bounds for the parameter space
upper : array_like
Upper or maximum bounds for the parameter space
n : int
Number of samples
Returns
np.ndarray
Sampled location in fea... | [
"Used",
"to",
"randomly",
"sample",
"the",
"search",
"space",
".",
"Provide",
"search",
"parameters",
"and",
"the",
"number",
"of",
"samples",
"desired",
".",
"Parameters",
"lower",
":",
"array_like",
"Lower",
"or",
"minimum",
"bounds",
"for",
"the",
"paramete... | def random_sample(lower, upper, n):
dims = len(lower)
X = np.random.random((n, dims))
volume_range = [upper[i] - lower[i] for i in range(dims)]
X_scaled = X * volume_range
X_shifted = X_scaled + lower
return X_shifted | [
"def",
"random_sample",
"(",
"lower",
",",
"upper",
",",
"n",
")",
":",
"dims",
"=",
"len",
"(",
"lower",
")",
"X",
"=",
"np",
".",
"random",
".",
"random",
"(",
"(",
"n",
",",
"dims",
")",
")",
"volume_range",
"=",
"[",
"upper",
"[",
"i",
"]",... | Used to randomly sample the search space. | [
"Used",
"to",
"randomly",
"sample",
"the",
"search",
"space",
"."
] | [
"\"\"\"\n Used to randomly sample the search space.\n\n Provide search parameters and the number of samples desired.\n\n Parameters\n ----------\n lower : array_like\n Lower or minimum bounds for the parameter space\n upper : array_like\n Upper or maximum bounds for the parameter spa... | [
{
"param": "lower",
"type": null
},
{
"param": "upper",
"type": null
},
{
"param": "n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lower",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upper",
"type": null,
"docstring": null,
"docstring_tokens":... |
755f6e9d2b2422c2749be780323ed5a9fd8a3fbd | vishalbelsare/dora | dora/active_sampling/base_sampler.py | [
"Apache-2.0"
] | Python | grid_sample | <not_specific> | def grid_sample(lower, upper, n):
"""
Used to seed an algorithm with a regular pattern of corners and centres.
This can be used to provide search parameters and the indices.
Parameters
----------
lower : array_like
Lower or minimum bounds for the parameter space
upper : array_like
... |
Used to seed an algorithm with a regular pattern of corners and centres.
This can be used to provide search parameters and the indices.
Parameters
----------
lower : array_like
Lower or minimum bounds for the parameter space
upper : array_like
Upper or maximum bounds for the p... | Used to seed an algorithm with a regular pattern of corners and centres.
This can be used to provide search parameters and the indices.
Parameters
lower : array_like
Lower or minimum bounds for the parameter space
upper : array_like
Upper or maximum bounds for the parameter space
n : int
Index of location
Returns
n... | [
"Used",
"to",
"seed",
"an",
"algorithm",
"with",
"a",
"regular",
"pattern",
"of",
"corners",
"and",
"centres",
".",
"This",
"can",
"be",
"used",
"to",
"provide",
"search",
"parameters",
"and",
"the",
"indices",
".",
"Parameters",
"lower",
":",
"array_like",
... | def grid_sample(lower, upper, n):
lower = np.asarray(lower)
upper = np.asarray(upper)
dims = lower.shape[0]
n_corners = 2 ** dims
if n < n_corners:
xq = lower + (upper - lower) * \
(n & 2 ** np.arange(dims) > 0).astype(float)
elif n == n_corners:
xq = lower + 0.5 * (u... | [
"def",
"grid_sample",
"(",
"lower",
",",
"upper",
",",
"n",
")",
":",
"lower",
"=",
"np",
".",
"asarray",
"(",
"lower",
")",
"upper",
"=",
"np",
".",
"asarray",
"(",
"upper",
")",
"dims",
"=",
"lower",
".",
"shape",
"[",
"0",
"]",
"n_corners",
"=... | Used to seed an algorithm with a regular pattern of corners and centres. | [
"Used",
"to",
"seed",
"an",
"algorithm",
"with",
"a",
"regular",
"pattern",
"of",
"corners",
"and",
"centres",
"."
] | [
"\"\"\"\n Used to seed an algorithm with a regular pattern of corners and centres.\n\n This can be used to provide search parameters and the indices.\n\n Parameters\n ----------\n lower : array_like\n Lower or minimum bounds for the parameter space\n upper : array_like\n Upper or max... | [
{
"param": "lower",
"type": null
},
{
"param": "upper",
"type": null
},
{
"param": "n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lower",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upper",
"type": null,
"docstring": null,
"docstring_tokens":... |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | update_y_mean | <not_specific> | def update_y_mean(self):
"""
Update the mean of the target outputs.
.. note :: [Properties Modified]
y_mean,
n_tasks
.. note :: At anytime, 'y_mean' should be the mean of all the output
targets including the virtual ones, since... |
Update the mean of the target outputs.
.. note :: [Properties Modified]
y_mean,
n_tasks
.. note :: At anytime, 'y_mean' should be the mean of all the output
targets including the virtual ones, since that is what
we ... | Update the mean of the target outputs.
note :: At anytime, 'y_mean' should be the mean of all the output
targets including the virtual ones, since that is what
we are training upon | [
"Update",
"the",
"mean",
"of",
"the",
"target",
"outputs",
".",
"note",
"::",
"At",
"anytime",
"'",
"y_mean",
"'",
"should",
"be",
"the",
"mean",
"of",
"all",
"the",
"output",
"targets",
"including",
"the",
"virtual",
"ones",
"since",
"that",
"is",
"what... | def update_y_mean(self):
if not self.y:
return
self.y_mean = self.y().mean(axis=0) if len(self.y) else None
if self.n_tasks is None:
self.n_tasks = self.y_mean.shape[0]
else:
assert self.n_tasks == self.y_mean.shape[0] | [
"def",
"update_y_mean",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"y",
":",
"return",
"self",
".",
"y_mean",
"=",
"self",
".",
"y",
"(",
")",
".",
"mean",
"(",
"axis",
"=",
"0",
")",
"if",
"len",
"(",
"self",
".",
"y",
")",
"else",
"No... | Update the mean of the target outputs. | [
"Update",
"the",
"mean",
"of",
"the",
"target",
"outputs",
"."
] | [
"\"\"\"\n Update the mean of the target outputs.\n\n .. note :: [Properties Modified]\n y_mean,\n n_tasks\n\n .. note :: At anytime, 'y_mean' should be the mean of all the output\n targets including the virtual ones, since that is what\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | learn_hyperparams | <not_specific> | def learn_hyperparams(self, verbose=False, ftol=1e-15, maxiter=2000):
"""
Learn the kernel hyperparameters from the data collected so far.
Equivalent to training the Gaussian process used for the sampler
The training result is summarised by the hyperparameters of the kernel
.. ... |
Learn the kernel hyperparameters from the data collected so far.
Equivalent to training the Gaussian process used for the sampler
The training result is summarised by the hyperparameters of the kernel
.. note :: Learns common hyperparameters between all tasks
.. note :: [Prop... | Learn the kernel hyperparameters from the data collected so far.
Equivalent to training the Gaussian process used for the sampler
The training result is summarised by the hyperparameters of the kernel
note :: Learns common hyperparameters between all tasks
note :: [Properties Modified]
(None)
Parameters
verbose : b... | [
"Learn",
"the",
"kernel",
"hyperparameters",
"from",
"the",
"data",
"collected",
"so",
"far",
".",
"Equivalent",
"to",
"training",
"the",
"Gaussian",
"process",
"used",
"for",
"the",
"sampler",
"The",
"training",
"result",
"is",
"summarised",
"by",
"the",
"hyp... | def learn_hyperparams(self, verbose=False, ftol=1e-15, maxiter=2000):
self.update_y_mean()
logging.info('Training hyperparameters...')
snlml = gp.criterions.stacked_negative_log_marginal_likelihood
hyperparams = gp.learn(self.X(), self.y(), self.kerneldef,
... | [
"def",
"learn_hyperparams",
"(",
"self",
",",
"verbose",
"=",
"False",
",",
"ftol",
"=",
"1e-15",
",",
"maxiter",
"=",
"2000",
")",
":",
"self",
".",
"update_y_mean",
"(",
")",
"logging",
".",
"info",
"(",
"'Training hyperparameters...'",
")",
"snlml",
"="... | Learn the kernel hyperparameters from the data collected so far. | [
"Learn",
"the",
"kernel",
"hyperparameters",
"from",
"the",
"data",
"collected",
"so",
"far",
"."
] | [
"\"\"\"\n Learn the kernel hyperparameters from the data collected so far.\n\n Equivalent to training the Gaussian process used for the sampler\n The training result is summarised by the hyperparameters of the kernel\n\n .. note :: Learns common hyperparameters between all tasks\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "verbose",
"type": null
},
{
"param": "ftol",
"type": null
},
{
"param": "maxiter",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "verbose",
"type": null,
"docstring": null,
"docstring_tokens"... |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | update_regressors | <not_specific> | def update_regressors(self):
"""
Update the regressors of the Gaussian process model.
Only makes sense to do this after hyperparameters are learned
.. note :: [Properties Modified]
regressors
.. note :: [Further Work] Use Cholesky Update here correctly to c... |
Update the regressors of the Gaussian process model.
Only makes sense to do this after hyperparameters are learned
.. note :: [Properties Modified]
regressors
.. note :: [Further Work] Use Cholesky Update here correctly to cache
regressors and ... | Update the regressors of the Gaussian process model.
Only makes sense to do this after hyperparameters are learned
note :: [Properties Modified]
regressors
note :: [Further Work] Use Cholesky Update here correctly to cache
regressors and improve efficiency | [
"Update",
"the",
"regressors",
"of",
"the",
"Gaussian",
"process",
"model",
".",
"Only",
"makes",
"sense",
"to",
"do",
"this",
"after",
"hyperparameters",
"are",
"learned",
"note",
"::",
"[",
"Properties",
"Modified",
"]",
"regressors",
"note",
"::",
"[",
"F... | def update_regressors(self):
if self.hyperparams is None:
return
self.regressors = []
for i_task in range(self.n_tasks):
self.regressors.append(
gp.condition(self.X(), self.y()[:, i_task] -
self.y_mean[i_task],
... | [
"def",
"update_regressors",
"(",
"self",
")",
":",
"if",
"self",
".",
"hyperparams",
"is",
"None",
":",
"return",
"self",
".",
"regressors",
"=",
"[",
"]",
"for",
"i_task",
"in",
"range",
"(",
"self",
".",
"n_tasks",
")",
":",
"self",
".",
"regressors"... | Update the regressors of the Gaussian process model. | [
"Update",
"the",
"regressors",
"of",
"the",
"Gaussian",
"process",
"model",
"."
] | [
"\"\"\"\n Update the regressors of the Gaussian process model.\n\n Only makes sense to do this after hyperparameters are learned\n\n .. note :: [Properties Modified]\n regressors\n\n .. note :: [Further Work] Use Cholesky Update here correctly to cache\n ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | train | <not_specific> | def train(self):
"""
Train the Gaussian process model.
A wrapper function that learns the hyperparameters and updates the
regressors, which is equivalent to a fully trained model that is
ready to perform Inference
.. note :: [Properties Modified]
hyp... |
Train the Gaussian process model.
A wrapper function that learns the hyperparameters and updates the
regressors, which is equivalent to a fully trained model that is
ready to perform Inference
.. note :: [Properties Modified]
hyperparameters,
... | Train the Gaussian process model.
A wrapper function that learns the hyperparameters and updates the
regressors, which is equivalent to a fully trained model that is
ready to perform Inference
note :: [Properties Modified]
hyperparameters,
regressors | [
"Train",
"the",
"Gaussian",
"process",
"model",
".",
"A",
"wrapper",
"function",
"that",
"learns",
"the",
"hyperparameters",
"and",
"updates",
"the",
"regressors",
"which",
"is",
"equivalent",
"to",
"a",
"fully",
"trained",
"model",
"that",
"is",
"ready",
"to"... | def train(self):
assert(self.dims is not None)
if self.kerneldef is None:
def kerneldef(h, k):
a = h(1e-3, 1e+2, 1)
b = [h(1e-2, 1e+3, 1) for _ in range(self.dims)]
logsigma = h(-6, 2)
return a * k(gp.kernels.gaussian, b) + \
... | [
"def",
"train",
"(",
"self",
")",
":",
"assert",
"(",
"self",
".",
"dims",
"is",
"not",
"None",
")",
"if",
"self",
".",
"kerneldef",
"is",
"None",
":",
"def",
"kerneldef",
"(",
"h",
",",
"k",
")",
":",
"a",
"=",
"h",
"(",
"1e-3",
",",
"1e+2",
... | Train the Gaussian process model. | [
"Train",
"the",
"Gaussian",
"process",
"model",
"."
] | [
"\"\"\"\n Train the Gaussian process model.\n\n A wrapper function that learns the hyperparameters and updates the\n regressors, which is equivalent to a fully trained model that is\n ready to perform Inference\n\n .. note :: [Properties Modified]\n hyperparamet... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | eval_acq | <not_specific> | def eval_acq(self, Xq):
"""
Evaluates the acquistion function for a given Xq (query points)
Parameters
----------
Xq : numpy.ndarray,
The query points on which the acquistion function will be evaluated
Returns
-------
numpy.ndarray
... |
Evaluates the acquistion function for a given Xq (query points)
Parameters
----------
Xq : numpy.ndarray,
The query points on which the acquistion function will be evaluated
Returns
-------
numpy.ndarray
value of acquistion function at ... | Evaluates the acquistion function for a given Xq (query points)
Parameters
Xq : numpy.ndarray,
The query points on which the acquistion function will be evaluated
Returns
numpy.ndarray
value of acquistion function at Xq
scalar
argmax of the evaluated points | [
"Evaluates",
"the",
"acquistion",
"function",
"for",
"a",
"given",
"Xq",
"(",
"query",
"points",
")",
"Parameters",
"Xq",
":",
"numpy",
".",
"ndarray",
"The",
"query",
"points",
"on",
"which",
"the",
"acquistion",
"function",
"will",
"be",
"evaluated",
"Retu... | def eval_acq(self, Xq):
if len(Xq.shape)==1:
Xq = Xq[:,np.newaxis]
self.update_y_mean()
predictors = [gp.query(r, Xq) for r in self.regressors]
Yq_exp = np.asarray([gp.mean(p) for p in predictors]).T + \
self.y_mean
Yq_var = np.asarray([gp.variance(p) for ... | [
"def",
"eval_acq",
"(",
"self",
",",
"Xq",
")",
":",
"if",
"len",
"(",
"Xq",
".",
"shape",
")",
"==",
"1",
":",
"Xq",
"=",
"Xq",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
"self",
".",
"update_y_mean",
"(",
")",
"predictors",
"=",
"[",
"gp",
"... | Evaluates the acquistion function for a given Xq (query points)
Parameters | [
"Evaluates",
"the",
"acquistion",
"function",
"for",
"a",
"given",
"Xq",
"(",
"query",
"points",
")",
"Parameters"
] | [
"\"\"\"\n Evaluates the acquistion function for a given Xq (query points)\n\n\n Parameters\n ----------\n Xq : numpy.ndarray,\n The query points on which the acquistion function will be evaluated\n\n Returns\n -------\n numpy.ndarray\n value of ... | [
{
"param": "self",
"type": null
},
{
"param": "Xq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "Xq",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | predict | <not_specific> | def predict(self, Xq, real=True):
"""
Predict the query mean and variance using the Gaussian process model.
Infers the mean and variance of the Gaussian process at given
locations using the data collected so far
.. note :: [Properties Modified]
(None... |
Predict the query mean and variance using the Gaussian process model.
Infers the mean and variance of the Gaussian process at given
locations using the data collected so far
.. note :: [Properties Modified]
(None)
Parameters
----------
... | Predict the query mean and variance using the Gaussian process model.
Infers the mean and variance of the Gaussian process at given
locations using the data collected so far
note :: [Properties Modified]
(None)
Parameters
Xq : numpy.ndarray
Query points
real : bool, optional
To use only the real observations or also... | [
"Predict",
"the",
"query",
"mean",
"and",
"variance",
"using",
"the",
"Gaussian",
"process",
"model",
".",
"Infers",
"the",
"mean",
"and",
"variance",
"of",
"the",
"Gaussian",
"process",
"at",
"given",
"locations",
"using",
"the",
"data",
"collected",
"so",
... | def predict(self, Xq, real=True):
assert self.hyperparams, "Sampler is not trained yet. " \
"Possibly not enough observations provided."
if real:
X_real, y_real = self.get_real_data()
regressors = [gp.condition(X_real, y_real[:, i_task] -
... | [
"def",
"predict",
"(",
"self",
",",
"Xq",
",",
"real",
"=",
"True",
")",
":",
"assert",
"self",
".",
"hyperparams",
",",
"\"Sampler is not trained yet. \"",
"\"Possibly not enough observations provided.\"",
"if",
"real",
":",
"X_real",
",",
"y_real",
"=",
"self",
... | Predict the query mean and variance using the Gaussian process model. | [
"Predict",
"the",
"query",
"mean",
"and",
"variance",
"using",
"the",
"Gaussian",
"process",
"model",
"."
] | [
"\"\"\"\n Predict the query mean and variance using the Gaussian process model.\n\n Infers the mean and variance of the Gaussian process at given\n locations using the data collected so far\n\n .. note :: [Properties Modified]\n (None)\n\n Parameters\n ... | [
{
"param": "self",
"type": null
},
{
"param": "Xq",
"type": null
},
{
"param": "real",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "Xq",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | print_kernel | null | def print_kernel(self, kerneldef):
"""
Print the current kernel for the Gaussian process model.
.. note :: Not implemented yet
"""
# TO DO: Use the printer method to print the current kernel!
pass |
Print the current kernel for the Gaussian process model.
.. note :: Not implemented yet
| Print the current kernel for the Gaussian process model.
note :: Not implemented yet | [
"Print",
"the",
"current",
"kernel",
"for",
"the",
"Gaussian",
"process",
"model",
".",
"note",
"::",
"Not",
"implemented",
"yet"
] | def print_kernel(self, kerneldef):
pass | [
"def",
"print_kernel",
"(",
"self",
",",
"kerneldef",
")",
":",
"pass"
] | Print the current kernel for the Gaussian process model. | [
"Print",
"the",
"current",
"kernel",
"for",
"the",
"Gaussian",
"process",
"model",
"."
] | [
"\"\"\"\n Print the current kernel for the Gaussian process model.\n\n .. note :: Not implemented yet\n \"\"\"",
"# TO DO: Use the printer method to print the current kernel!"
] | [
{
"param": "self",
"type": null
},
{
"param": "kerneldef",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kerneldef",
"type": null,
"docstring": null,
"docstring_token... |
79f539d1f0ae5acc68134d1ada33f31f5d948708 | vishalbelsare/dora | dora/active_sampling/gp_sampler.py | [
"Apache-2.0"
] | Python | acq_defs | <not_specific> | def acq_defs(y_mean=0, explore_priority=1.):
"""
Generate a dictionary of acquisition functions.
var_sum : Favours observations with high variance
pred_upper_bound : Favours observations with high predicted target outputs
sigmoid : Favours observations around decision boundaries
Parameters
... |
Generate a dictionary of acquisition functions.
var_sum : Favours observations with high variance
pred_upper_bound : Favours observations with high predicted target outputs
sigmoid : Favours observations around decision boundaries
Parameters
----------
y_mean : int or np.ndarray
... | Generate a dictionary of acquisition functions.
var_sum : Favours observations with high variance
pred_upper_bound : Favours observations with high predicted target outputs
sigmoid : Favours observations around decision boundaries
Parameters
y_mean : int or np.ndarray
The mean of the target outputs
explore_priority... | [
"Generate",
"a",
"dictionary",
"of",
"acquisition",
"functions",
".",
"var_sum",
":",
"Favours",
"observations",
"with",
"high",
"variance",
"pred_upper_bound",
":",
"Favours",
"observations",
"with",
"high",
"predicted",
"target",
"outputs",
"sigmoid",
":",
"Favour... | def acq_defs(y_mean=0, explore_priority=1.):
return {
'var_sum': lambda u, v: np.sum(v, axis=1),
'pred_upper_bound': lambda u, v: np.max(u + 3 * explore_priority * np.sqrt(v),
axis=1),
'prod_max': lambda u, v: np.max((u + (y_mean +
... | [
"def",
"acq_defs",
"(",
"y_mean",
"=",
"0",
",",
"explore_priority",
"=",
"1.",
")",
":",
"return",
"{",
"'var_sum'",
":",
"lambda",
"u",
",",
"v",
":",
"np",
".",
"sum",
"(",
"v",
",",
"axis",
"=",
"1",
")",
",",
"'pred_upper_bound'",
":",
"lambda... | Generate a dictionary of acquisition functions. | [
"Generate",
"a",
"dictionary",
"of",
"acquisition",
"functions",
"."
] | [
"\"\"\"\n Generate a dictionary of acquisition functions.\n\n var_sum : Favours observations with high variance\n\n pred_upper_bound : Favours observations with high predicted target outputs\n\n sigmoid : Favours observations around decision boundaries\n\n Parameters\n ----------\n y_mean : int... | [
{
"param": "y_mean",
"type": null
},
{
"param": "explore_priority",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "y_mean",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "explore_priority",
"type": null,
"docstring": null,
"docstr... |
292f73db89d64fe17910f3e47cf8364a366c3670 | BAMWelDX/weldx-widgets | weldx_widgets/kisa/save.py | [
"BSD-3-Clause"
] | Python | invoke_url | null | def invoke_url(url, out):
"""Invoke url in new browser tab.
We cannot use python stdlib webbrowser here, because this code will be executed
on the server. So we impl this via Javascript.
"""
from IPython.display import Javascript, clear_output, display
with out:
clear_output()
... | Invoke url in new browser tab.
We cannot use python stdlib webbrowser here, because this code will be executed
on the server. So we impl this via Javascript.
| Invoke url in new browser tab.
We cannot use python stdlib webbrowser here, because this code will be executed
on the server. So we impl this via Javascript. | [
"Invoke",
"url",
"in",
"new",
"browser",
"tab",
".",
"We",
"cannot",
"use",
"python",
"stdlib",
"webbrowser",
"here",
"because",
"this",
"code",
"will",
"be",
"executed",
"on",
"the",
"server",
".",
"So",
"we",
"impl",
"this",
"via",
"Javascript",
"."
] | def invoke_url(url, out):
from IPython.display import Javascript, clear_output, display
with out:
clear_output()
js = Javascript(f'window.open("{url}");')
display(js) | [
"def",
"invoke_url",
"(",
"url",
",",
"out",
")",
":",
"from",
"IPython",
".",
"display",
"import",
"Javascript",
",",
"clear_output",
",",
"display",
"with",
"out",
":",
"clear_output",
"(",
")",
"js",
"=",
"Javascript",
"(",
"f'window.open(\"{url}\");'",
"... | Invoke url in new browser tab. | [
"Invoke",
"url",
"in",
"new",
"browser",
"tab",
"."
] | [
"\"\"\"Invoke url in new browser tab.\n\n We cannot use python stdlib webbrowser here, because this code will be executed\n on the server. So we impl this via Javascript.\n \"\"\""
] | [
{
"param": "url",
"type": null
},
{
"param": "out",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
292f73db89d64fe17910f3e47cf8364a366c3670 | BAMWelDX/weldx-widgets | weldx_widgets/kisa/save.py | [
"BSD-3-Clause"
] | Python | on_save | <not_specific> | def on_save(self, _):
"""Handle saving data to file."""
from IPython.display import clear_output, display
clear_output()
result = dict()
for widget in self.collect_data_from:
_deep_update_inplace(result, widget.to_tree())
# set status
result["wx_use... | Handle saving data to file. | Handle saving data to file. | [
"Handle",
"saving",
"data",
"to",
"file",
"."
] | def on_save(self, _):
from IPython.display import clear_output, display
clear_output()
result = dict()
for widget in self.collect_data_from:
_deep_update_inplace(result, widget.to_tree())
result["wx_user"] = {"KISA": {"status": self.status}}
def show_header(ha... | [
"def",
"on_save",
"(",
"self",
",",
"_",
")",
":",
"from",
"IPython",
".",
"display",
"import",
"clear_output",
",",
"display",
"clear_output",
"(",
")",
"result",
"=",
"dict",
"(",
")",
"for",
"widget",
"in",
"self",
".",
"collect_data_from",
":",
"_dee... | Handle saving data to file. | [
"Handle",
"saving",
"data",
"to",
"file",
"."
] | [
"\"\"\"Handle saving data to file.\"\"\"",
"# set status",
"# open (existing) file and update it.",
"# we want to save the previous file under a different name, so load contents"
] | [
{
"param": "self",
"type": null
},
{
"param": "_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
a18c2950b68da99b5b82094f007ff75c682f0266 | BAMWelDX/weldx-widgets | weldx_widgets/tests/util.py | [
"BSD-3-Clause"
] | Python | temp_env | null | def temp_env(**kw):
"""Temporarily set env variables to given mapping."""
old = os.environ.copy()
os.environ.update(**kw)
yield
os.environ = old | Temporarily set env variables to given mapping. | Temporarily set env variables to given mapping. | [
"Temporarily",
"set",
"env",
"variables",
"to",
"given",
"mapping",
"."
] | def temp_env(**kw):
old = os.environ.copy()
os.environ.update(**kw)
yield
os.environ = old | [
"def",
"temp_env",
"(",
"**",
"kw",
")",
":",
"old",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"os",
".",
"environ",
".",
"update",
"(",
"**",
"kw",
")",
"yield",
"os",
".",
"environ",
"=",
"old"
] | Temporarily set env variables to given mapping. | [
"Temporarily",
"set",
"env",
"variables",
"to",
"given",
"mapping",
"."
] | [
"\"\"\"Temporarily set env variables to given mapping.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f2d9c1df002b986e76a3ac8cd03b5299f6acd9fc | BAMWelDX/weldx-widgets | weldx_widgets/widget_measurement.py | [
"BSD-3-Clause"
] | Python | ipympl_style | null | def ipympl_style(fig, toolbar=True):
"""Apply default figure styling for ipympl backend."""
try:
fig.canvas.header_visible = False
fig.canvas.resizable = False
fig.tight_layout()
fig.canvas.toolbar_position = "right"
fig.canvas.toolbar_visible = toolbar
except Excepti... | Apply default figure styling for ipympl backend. | Apply default figure styling for ipympl backend. | [
"Apply",
"default",
"figure",
"styling",
"for",
"ipympl",
"backend",
"."
] | def ipympl_style(fig, toolbar=True):
try:
fig.canvas.header_visible = False
fig.canvas.resizable = False
fig.tight_layout()
fig.canvas.toolbar_position = "right"
fig.canvas.toolbar_visible = toolbar
except Exception:
pass | [
"def",
"ipympl_style",
"(",
"fig",
",",
"toolbar",
"=",
"True",
")",
":",
"try",
":",
"fig",
".",
"canvas",
".",
"header_visible",
"=",
"False",
"fig",
".",
"canvas",
".",
"resizable",
"=",
"False",
"fig",
".",
"tight_layout",
"(",
")",
"fig",
".",
"... | Apply default figure styling for ipympl backend. | [
"Apply",
"default",
"figure",
"styling",
"for",
"ipympl",
"backend",
"."
] | [
"\"\"\"Apply default figure styling for ipympl backend.\"\"\""
] | [
{
"param": "fig",
"type": null
},
{
"param": "toolbar",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fig",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "toolbar",
"type": null,
"docstring": null,
"docstring_tokens":... |
f2d9c1df002b986e76a3ac8cd03b5299f6acd9fc | BAMWelDX/weldx-widgets | weldx_widgets/widget_measurement.py | [
"BSD-3-Clause"
] | Python | plot_signal | null | def plot_signal(signal: weldx.measurement.Signal, name, limits=None, ax=None):
"""Plot a single weldx signal."""
if not ax:
fig, ax = plt.subplots(figsize=(_DEFAULT_FIGWIDTH, 6))
data = signal.data
time = weldx.Time(data.time).as_quantity()
ax.plot(time.m, data.data.m)
ax.set_ylabel(f"... | Plot a single weldx signal. | Plot a single weldx signal. | [
"Plot",
"a",
"single",
"weldx",
"signal",
"."
] | def plot_signal(signal: weldx.measurement.Signal, name, limits=None, ax=None):
if not ax:
fig, ax = plt.subplots(figsize=(_DEFAULT_FIGWIDTH, 6))
data = signal.data
time = weldx.Time(data.time).as_quantity()
ax.plot(time.m, data.data.m)
ax.set_ylabel(f"{name} / {ureg.Unit(signal.units):~}")
... | [
"def",
"plot_signal",
"(",
"signal",
":",
"weldx",
".",
"measurement",
".",
"Signal",
",",
"name",
",",
"limits",
"=",
"None",
",",
"ax",
"=",
"None",
")",
":",
"if",
"not",
"ax",
":",
"fig",
",",
"ax",
"=",
"plt",
".",
"subplots",
"(",
"figsize",
... | Plot a single weldx signal. | [
"Plot",
"a",
"single",
"weldx",
"signal",
"."
] | [
"\"\"\"Plot a single weldx signal.\"\"\""
] | [
{
"param": "signal",
"type": "weldx.measurement.Signal"
},
{
"param": "name",
"type": null
},
{
"param": "limits",
"type": null
},
{
"param": "ax",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "signal",
"type": "weldx.measurement.Signal",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
... |
f2d9c1df002b986e76a3ac8cd03b5299f6acd9fc | BAMWelDX/weldx-widgets | weldx_widgets/widget_measurement.py | [
"BSD-3-Clause"
] | Python | plot_measurements | <not_specific> | def plot_measurements(
measurement_data,
axes,
limits=None,
):
"""Plot several measurements sharing time axis."""
for i, measurement in enumerate(measurement_data):
last_signal = measurement.measurement_chain.signals[-1]
plot_signal(last_signal, measurement.name, ax=axes[i], limits=l... | Plot several measurements sharing time axis. | Plot several measurements sharing time axis. | [
"Plot",
"several",
"measurements",
"sharing",
"time",
"axis",
"."
] | def plot_measurements(
measurement_data,
axes,
limits=None,
):
for i, measurement in enumerate(measurement_data):
last_signal = measurement.measurement_chain.signals[-1]
plot_signal(last_signal, measurement.name, ax=axes[i], limits=limits)
axes[i].set_xlabel(None)
axes[-1].se... | [
"def",
"plot_measurements",
"(",
"measurement_data",
",",
"axes",
",",
"limits",
"=",
"None",
",",
")",
":",
"for",
"i",
",",
"measurement",
"in",
"enumerate",
"(",
"measurement_data",
")",
":",
"last_signal",
"=",
"measurement",
".",
"measurement_chain",
".",... | Plot several measurements sharing time axis. | [
"Plot",
"several",
"measurements",
"sharing",
"time",
"axis",
"."
] | [
"\"\"\"Plot several measurements sharing time axis.\"\"\""
] | [
{
"param": "measurement_data",
"type": null
},
{
"param": "axes",
"type": null
},
{
"param": "limits",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "measurement_data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "axes",
"type": null,
"docstring": null,
"docstrin... |
3783ce5ef0fd9d4b1042194ec4b8a0e720be6c61 | BAMWelDX/weldx-widgets | weldx_widgets/generic.py | [
"BSD-3-Clause"
] | Python | download_button | HTML | def download_button(
content: bytes,
filename: str,
button_description: str,
html_instance: Optional[HTML] = None,
) -> HTML:
"""Load data from buffer into base64 payload embedded into a HTML button.
Parameters
----------
content :
file contents as bytes.
filename :
... | Load data from buffer into base64 payload embedded into a HTML button.
Parameters
----------
content :
file contents as bytes.
filename :
The name when it is downloaded.
button_description :
The text that goes into the button.
html_instance :
update a passed inst... | Load data from buffer into base64 payload embedded into a HTML button.
Parameters
content :
file contents as bytes.
filename :
The name when it is downloaded.
button_description :
The text that goes into the button.
html_instance :
update a passed instance or create a new one. | [
"Load",
"data",
"from",
"buffer",
"into",
"base64",
"payload",
"embedded",
"into",
"a",
"HTML",
"button",
".",
"Parameters",
"content",
":",
"file",
"contents",
"as",
"bytes",
".",
"filename",
":",
"The",
"name",
"when",
"it",
"is",
"downloaded",
".",
"but... | def download_button(
content: bytes,
filename: str,
button_description: str,
html_instance: Optional[HTML] = None,
) -> HTML:
digest = hashlib.md5(content).hexdigest()
payload = base64.b64encode(content).decode()
id_dl = f"dl_{digest}"
html_button = f"""<html>
<head>
<meta name... | [
"def",
"download_button",
"(",
"content",
":",
"bytes",
",",
"filename",
":",
"str",
",",
"button_description",
":",
"str",
",",
"html_instance",
":",
"Optional",
"[",
"HTML",
"]",
"=",
"None",
",",
")",
"->",
"HTML",
":",
"digest",
"=",
"hashlib",
".",
... | Load data from buffer into base64 payload embedded into a HTML button. | [
"Load",
"data",
"from",
"buffer",
"into",
"base64",
"payload",
"embedded",
"into",
"a",
"HTML",
"button",
"."
] | [
"\"\"\"Load data from buffer into base64 payload embedded into a HTML button.\n\n Parameters\n ----------\n content :\n file contents as bytes.\n filename :\n The name when it is downloaded.\n button_description :\n The text that goes into the button.\n html_instance :\n ... | [
{
"param": "content",
"type": "bytes"
},
{
"param": "filename",
"type": "str"
},
{
"param": "button_description",
"type": "str"
},
{
"param": "html_instance",
"type": "Optional[HTML]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "content",
"type": "bytes",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": "str",
"docstring": null,
"docstring... |
67445adff099ed56a22ae3590de70600ce2c40cc | BAMWelDX/weldx-widgets | weldx_widgets/widget_groove_sel.py | [
"BSD-3-Clause"
] | Python | add_parameter_observer | null | def add_parameter_observer(self, observer: Callable):
"""Add observers to groove parameters."""
for key, box in self.groove_params_dropdowns.items():
box.children[1].observe(observer, "value")
# if key != "code_number":
# box.children[2].observe(observer, "value") | Add observers to groove parameters. | Add observers to groove parameters. | [
"Add",
"observers",
"to",
"groove",
"parameters",
"."
] | def add_parameter_observer(self, observer: Callable):
for key, box in self.groove_params_dropdowns.items():
box.children[1].observe(observer, "value") | [
"def",
"add_parameter_observer",
"(",
"self",
",",
"observer",
":",
"Callable",
")",
":",
"for",
"key",
",",
"box",
"in",
"self",
".",
"groove_params_dropdowns",
".",
"items",
"(",
")",
":",
"box",
".",
"children",
"[",
"1",
"]",
".",
"observe",
"(",
"... | Add observers to groove parameters. | [
"Add",
"observers",
"to",
"groove",
"parameters",
"."
] | [
"\"\"\"Add observers to groove parameters.\"\"\"",
"# if key != \"code_number\":",
"# box.children[2].observe(observer, \"value\")"
] | [
{
"param": "self",
"type": null
},
{
"param": "observer",
"type": "Callable"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "observer",
"type": "Callable",
"docstring": null,
"docstring_... |
67445adff099ed56a22ae3590de70600ce2c40cc | BAMWelDX/weldx-widgets | weldx_widgets/widget_groove_sel.py | [
"BSD-3-Clause"
] | Python | create_csm_and_plot | <not_specific> | def create_csm_and_plot(self, change=None, plot=True, **kwargs):
"""Create coordinates system manager containing TCP movement."""
if change is not None:
# update, except for 2d view.
if change.get("new", -1) == 0:
return
# TODO: only create once and then ... | Create coordinates system manager containing TCP movement. | Create coordinates system manager containing TCP movement. | [
"Create",
"coordinates",
"system",
"manager",
"containing",
"TCP",
"movement",
"."
] | def create_csm_and_plot(self, change=None, plot=True, **kwargs):
if change is not None:
if change.get("new", -1) == 0:
return
trace_segment = weldx.LinearHorizontalTraceSegment(self.seam_length.quantity)
trace = weldx.Trace(trace_segment)
geometry = weldx.Geom... | [
"def",
"create_csm_and_plot",
"(",
"self",
",",
"change",
"=",
"None",
",",
"plot",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"if",
"change",
"is",
"not",
"None",
":",
"if",
"change",
".",
"get",
"(",
"\"new\"",
",",
"-",
"1",
")",
"==",
"0",
"... | Create coordinates system manager containing TCP movement. | [
"Create",
"coordinates",
"system",
"manager",
"containing",
"TCP",
"movement",
"."
] | [
"\"\"\"Create coordinates system manager containing TCP movement.\"\"\"",
"# update, except for 2d view.",
"# TODO: only create once and then update the csm!",
"# create a linear trace segment a the complete weld seam trace",
"# create 3d workpiece geometry from the groove profile and trace objects",
"# r... | [
{
"param": "self",
"type": null
},
{
"param": "change",
"type": null
},
{
"param": "plot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "change",
"type": null,
"docstring": null,
"docstring_tokens":... |
67445adff099ed56a22ae3590de70600ce2c40cc | BAMWelDX/weldx-widgets | weldx_widgets/widget_groove_sel.py | [
"BSD-3-Clause"
] | Python | plot | null | def plot(self):
"""Visualize the tcp design movement."""
# clear previous output.
if self.last_plot is not None:
self.last_plot.close()
with self.out:
self.out.clear_output()
vis = self.csm.plot(
coordinate_systems=["TCP design"],
... | Visualize the tcp design movement. | Visualize the tcp design movement. | [
"Visualize",
"the",
"tcp",
"design",
"movement",
"."
] | def plot(self):
if self.last_plot is not None:
self.last_plot.close()
with self.out:
self.out.clear_output()
vis = self.csm.plot(
coordinate_systems=["TCP design"],
show_vectors=False,
show_wireframe=False,
... | [
"def",
"plot",
"(",
"self",
")",
":",
"if",
"self",
".",
"last_plot",
"is",
"not",
"None",
":",
"self",
".",
"last_plot",
".",
"close",
"(",
")",
"with",
"self",
".",
"out",
":",
"self",
".",
"out",
".",
"clear_output",
"(",
")",
"vis",
"=",
"sel... | Visualize the tcp design movement. | [
"Visualize",
"the",
"tcp",
"design",
"movement",
"."
] | [
"\"\"\"Visualize the tcp design movement.\"\"\"",
"# clear previous output.",
"# limits=[(0, 140), (-5, 5), (0, 12)],"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f1cc9d14f3483c8a6a922b0ffcbfe15afc9ce942 | eric-hou/webavailability | libs/webtracker.py | [
"Apache-2.0"
] | Python | status | null | def status(self):
"""
A generator to return status for all URLs at the specific period
:return: A generator yielding WebsiteStatus objects
"""
for url, re_exp in self._urls.items():
status = 'unresponsive'
dns_time = None
response_time = None
... |
A generator to return status for all URLs at the specific period
:return: A generator yielding WebsiteStatus objects
| A generator to return status for all URLs at the specific period | [
"A",
"generator",
"to",
"return",
"status",
"for",
"all",
"URLs",
"at",
"the",
"specific",
"period"
] | def status(self):
for url, re_exp in self._urls.items():
status = 'unresponsive'
dns_time = None
response_time = None
detail = None
domain = urlparse(url).netloc
try:
stime = time.time()
dns.resolver.resolve(... | [
"def",
"status",
"(",
"self",
")",
":",
"for",
"url",
",",
"re_exp",
"in",
"self",
".",
"_urls",
".",
"items",
"(",
")",
":",
"status",
"=",
"'unresponsive'",
"dns_time",
"=",
"None",
"response_time",
"=",
"None",
"detail",
"=",
"None",
"domain",
"=",
... | A generator to return status for all URLs at the specific period | [
"A",
"generator",
"to",
"return",
"status",
"for",
"all",
"URLs",
"at",
"the",
"specific",
"period"
] | [
"\"\"\"\n A generator to return status for all URLs at the specific period\n :return: A generator yielding WebsiteStatus objects\n \"\"\"",
"# We can resolve domain one-off in __init__ but decided not to do so",
"# since this is not a time-critical task and it is handy to do in this way.",
... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A generator yielding WebsiteStatus objects",
"docstring_tokens": [
"A",
"generator",
"yielding",
"WebsiteStatus",
"objects"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
3aea21c602cbd54cd87836ede54ac09103caaa0a | eric-hou/webavailability | tests/test_websitestatus.py | [
"Apache-2.0"
] | Python | sqls_compare | <not_specific> | def sqls_compare(sql_list1, sql_list2):
"""
To compare two sql statements lists. Two sql lists are equal only when
1. Contains the list has the same number of sql statements
2. The tokens in every corresponding statement are the same in the order
"""
sql1_tokens = [sql.split() for sql in sql_lis... |
To compare two sql statements lists. Two sql lists are equal only when
1. Contains the list has the same number of sql statements
2. The tokens in every corresponding statement are the same in the order
| To compare two sql statements lists. Two sql lists are equal only when
1. Contains the list has the same number of sql statements
2. The tokens in every corresponding statement are the same in the order | [
"To",
"compare",
"two",
"sql",
"statements",
"lists",
".",
"Two",
"sql",
"lists",
"are",
"equal",
"only",
"when",
"1",
".",
"Contains",
"the",
"list",
"has",
"the",
"same",
"number",
"of",
"sql",
"statements",
"2",
".",
"The",
"tokens",
"in",
"every",
... | def sqls_compare(sql_list1, sql_list2):
sql1_tokens = [sql.split() for sql in sql_list1]
sql2_tokens = [sql.split() for sql in sql_list2]
return sql1_tokens == sql2_tokens | [
"def",
"sqls_compare",
"(",
"sql_list1",
",",
"sql_list2",
")",
":",
"sql1_tokens",
"=",
"[",
"sql",
".",
"split",
"(",
")",
"for",
"sql",
"in",
"sql_list1",
"]",
"sql2_tokens",
"=",
"[",
"sql",
".",
"split",
"(",
")",
"for",
"sql",
"in",
"sql_list2",
... | To compare two sql statements lists. | [
"To",
"compare",
"two",
"sql",
"statements",
"lists",
"."
] | [
"\"\"\"\n To compare two sql statements lists. Two sql lists are equal only when\n 1. Contains the list has the same number of sql statements\n 2. The tokens in every corresponding statement are the same in the order\n \"\"\""
] | [
{
"param": "sql_list1",
"type": null
},
{
"param": "sql_list2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sql_list1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sql_list2",
"type": null,
"docstring": null,
"docstring_... |
bdb53cb0bcc8351479b8ed9390c38e557c1771cf | eric-hou/webavailability | libs/status.py | [
"Apache-2.0"
] | Python | create_type_schema | null | def create_type_schema(cls, db):
"""
Given a PostgreSQL connection, create enum type for response status and phrases.
The intention is to save space by using enum type instead of strings directly in DB.
:param db: A PostgresSQL DB connection instance.
:return:
"""
... |
Given a PostgreSQL connection, create enum type for response status and phrases.
The intention is to save space by using enum type instead of strings directly in DB.
:param db: A PostgresSQL DB connection instance.
:return:
| Given a PostgreSQL connection, create enum type for response status and phrases.
The intention is to save space by using enum type instead of strings directly in DB. | [
"Given",
"a",
"PostgreSQL",
"connection",
"create",
"enum",
"type",
"for",
"response",
"status",
"and",
"phrases",
".",
"The",
"intention",
"is",
"to",
"save",
"space",
"by",
"using",
"enum",
"type",
"instead",
"of",
"strings",
"directly",
"in",
"DB",
"."
] | def create_type_schema(cls, db):
response_status_type_sql = "CREATE TYPE response_status AS ENUM ('responsive', 'unresponsive');"
phrases = [getattr(x, 'phrase').lower() for x in HTTPStatus] + ['domain not exist', 'ssl error',
'conn... | [
"def",
"create_type_schema",
"(",
"cls",
",",
"db",
")",
":",
"response_status_type_sql",
"=",
"\"CREATE TYPE response_status AS ENUM ('responsive', 'unresponsive');\"",
"phrases",
"=",
"[",
"getattr",
"(",
"x",
",",
"'phrase'",
")",
".",
"lower",
"(",
")",
"for",
"... | Given a PostgreSQL connection, create enum type for response status and phrases. | [
"Given",
"a",
"PostgreSQL",
"connection",
"create",
"enum",
"type",
"for",
"response",
"status",
"and",
"phrases",
"."
] | [
"\"\"\"\n Given a PostgreSQL connection, create enum type for response status and phrases.\n The intention is to save space by using enum type instead of strings directly in DB.\n :param db: A PostgresSQL DB connection instance.\n :return:\n \"\"\"",
"# A complete phrases includ... | [
{
"param": "cls",
"type": null
},
{
"param": "db",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
bdb53cb0bcc8351479b8ed9390c38e557c1771cf | eric-hou/webavailability | libs/status.py | [
"Apache-2.0"
] | Python | create_table_schema | null | def create_table_schema(cls, topic, db):
"""
Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
The table name is in the format of web_activity_<topic>, which dots are replaced with underscores.
:param topic: The specific topic to be created for
... |
Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
The table name is in the format of web_activity_<topic>, which dots are replaced with underscores.
:param topic: The specific topic to be created for
:param db: A PostgresSQL DB connection instance.
... | Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
The table name is in the format of web_activity_, which dots are replaced with underscores. | [
"Given",
"a",
"DB",
"connection",
"create",
"a",
"corresponding",
"PostgreSQL",
"table",
"for",
"the",
"specific",
"topic",
".",
"The",
"table",
"name",
"is",
"in",
"the",
"format",
"of",
"web_activity_",
"which",
"dots",
"are",
"replaced",
"with",
"underscore... | def create_table_schema(cls, topic, db):
topic = topic.replace('.', '_')
table_sql = f'''
CREATE TABLE IF NOT EXISTS web_activity_{topic} (
id SERIAL PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
topic_offset BIGINT DEFAULT -1,
test_f... | [
"def",
"create_table_schema",
"(",
"cls",
",",
"topic",
",",
"db",
")",
":",
"topic",
"=",
"topic",
".",
"replace",
"(",
"'.'",
",",
"'_'",
")",
"table_sql",
"=",
"f'''\n CREATE TABLE IF NOT EXISTS web_activity_{topic} (\n id SERIAL PRIMARY KEY,\n cre... | Given a DB connection, create a corresponding PostgreSQL table for the specific topic. | [
"Given",
"a",
"DB",
"connection",
"create",
"a",
"corresponding",
"PostgreSQL",
"table",
"for",
"the",
"specific",
"topic",
"."
] | [
"\"\"\"\n Given a DB connection, create a corresponding PostgreSQL table for the specific topic.\n The table name is in the format of web_activity_<topic>, which dots are replaced with underscores.\n :param topic: The specific topic to be created for\n :param db: A PostgresSQL DB connect... | [
{
"param": "cls",
"type": null
},
{
"param": "topic",
"type": null
},
{
"param": "db",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "topic",
"type": null,
"docstring": "The specific topic to be created... |
bdb53cb0bcc8351479b8ed9390c38e557c1771cf | eric-hou/webavailability | libs/status.py | [
"Apache-2.0"
] | Python | insert_status | null | def insert_status(self, db):
"""
Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache.
:param db: DB connection
"""
sql = f'''INSERT INTO web_activity_{self.topic} (topic_offset, test_from, url,
event_time, status, phr... |
Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache.
:param db: DB connection
| Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache. | [
"Insert",
"this",
"instance",
"to",
"DB",
"as",
"a",
"new",
"row",
".",
"Its",
"side",
"effect",
"is",
"to",
"update",
"WebsiteStatus",
"::",
"last_url_status",
"cache",
"."
] | def insert_status(self, db):
sql = f'''INSERT INTO web_activity_{self.topic} (topic_offset, test_from, url,
event_time, status, phrase, dns, response, detail) VALUES (
{self["offset"]}, '{self["from"]}', '{self["url"]}', {int(self["timestamp"])},
'{self["status"]}', '{self["phrase"]}', {... | [
"def",
"insert_status",
"(",
"self",
",",
"db",
")",
":",
"sql",
"=",
"f'''INSERT INTO web_activity_{self.topic} (topic_offset, test_from, url,\n event_time, status, phrase, dns, response, detail) VALUES (\n {self[\"offset\"]}, '{self[\"from\"]}', '{self[\"url\"]}', {int(self[\"tim... | Insert this instance to DB as a new row. | [
"Insert",
"this",
"instance",
"to",
"DB",
"as",
"a",
"new",
"row",
"."
] | [
"\"\"\"\n Insert this instance to DB as a new row. Its side effect is to update WebsiteStatus::last_url_status cache.\n :param db: DB connection\n \"\"\"",
"# This should always meet, just to make sure."
] | [
{
"param": "self",
"type": null
},
{
"param": "db",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "db",
"type": null,
"docstring": null,
"docstring_tokens": [
... |
bdb53cb0bcc8351479b8ed9390c38e557c1771cf | eric-hou/webavailability | libs/status.py | [
"Apache-2.0"
] | Python | insert_status_smart | <not_specific> | def insert_status_smart(self, db):
"""
Instead of inserting a new status always, this API tries to update the last healthy status if the healthy
status record is the last one. Otherwise, insert_status is still called.
This is superb helpful to reduce many rows of similar healthy records.... |
Instead of inserting a new status always, this API tries to update the last healthy status if the healthy
status record is the last one. Otherwise, insert_status is still called.
This is superb helpful to reduce many rows of similar healthy records.
| Instead of inserting a new status always, this API tries to update the last healthy status if the healthy
status record is the last one. Otherwise, insert_status is still called.
This is superb helpful to reduce many rows of similar healthy records. | [
"Instead",
"of",
"inserting",
"a",
"new",
"status",
"always",
"this",
"API",
"tries",
"to",
"update",
"the",
"last",
"healthy",
"status",
"if",
"the",
"healthy",
"status",
"record",
"is",
"the",
"last",
"one",
".",
"Otherwise",
"insert_status",
"is",
"still"... | def insert_status_smart(self, db):
if self['url'] not in self.last_url_status:
no_record = False
last_status_sql = f'''
SELECT id, status, phrase from web_activity_{self.topic} WHERE url = '{self["url"]}'
ORDER BY id DESC LIMIT 1;
'''
with ... | [
"def",
"insert_status_smart",
"(",
"self",
",",
"db",
")",
":",
"if",
"self",
"[",
"'url'",
"]",
"not",
"in",
"self",
".",
"last_url_status",
":",
"no_record",
"=",
"False",
"last_status_sql",
"=",
"f'''\n SELECT id, status, phrase from web_activity_{self.t... | Instead of inserting a new status always, this API tries to update the last healthy status if the healthy
status record is the last one. | [
"Instead",
"of",
"inserting",
"a",
"new",
"status",
"always",
"this",
"API",
"tries",
"to",
"update",
"the",
"last",
"healthy",
"status",
"if",
"the",
"healthy",
"status",
"record",
"is",
"the",
"last",
"one",
"."
] | [
"\"\"\"\n Instead of inserting a new status always, this API tries to update the last healthy status if the healthy\n status record is the last one. Otherwise, insert_status is still called.\n This is superb helpful to reduce many rows of similar healthy records.\n \"\"\"",
"# No recor... | [
{
"param": "self",
"type": null
},
{
"param": "db",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "db",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
bdb53cb0bcc8351479b8ed9390c38e557c1771cf | eric-hou/webavailability | libs/status.py | [
"Apache-2.0"
] | Python | deserialize | <not_specific> | def deserialize(cls, raw_bytes):
"""
Deserialize raw bytes into WebsiteStatus instance
:param raw_bytes: bytes content
:return: WebsiteStatus instance
"""
dictv = msgpack.unpackb(raw_bytes, raw=False)
reborn = WebsiteStatus(dictv['from'], dictv['url'], dictv['stat... |
Deserialize raw bytes into WebsiteStatus instance
:param raw_bytes: bytes content
:return: WebsiteStatus instance
| Deserialize raw bytes into WebsiteStatus instance | [
"Deserialize",
"raw",
"bytes",
"into",
"WebsiteStatus",
"instance"
] | def deserialize(cls, raw_bytes):
dictv = msgpack.unpackb(raw_bytes, raw=False)
reborn = WebsiteStatus(dictv['from'], dictv['url'], dictv['status'], dictv['phrase'], dictv['dns'],
dictv['response'], dictv['detail'], dictv['offset'])
reborn['timestamp'] = dictv['time... | [
"def",
"deserialize",
"(",
"cls",
",",
"raw_bytes",
")",
":",
"dictv",
"=",
"msgpack",
".",
"unpackb",
"(",
"raw_bytes",
",",
"raw",
"=",
"False",
")",
"reborn",
"=",
"WebsiteStatus",
"(",
"dictv",
"[",
"'from'",
"]",
",",
"dictv",
"[",
"'url'",
"]",
... | Deserialize raw bytes into WebsiteStatus instance | [
"Deserialize",
"raw",
"bytes",
"into",
"WebsiteStatus",
"instance"
] | [
"\"\"\"\n Deserialize raw bytes into WebsiteStatus instance\n :param raw_bytes: bytes content\n :return: WebsiteStatus instance\n \"\"\"",
"# timestamp has to be reset to the original value since reborn comes with a newly created timestamp"
] | [
{
"param": "cls",
"type": null
},
{
"param": "raw_bytes",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
a649a5b7684a00da312053567ed086802ad7d705 | eric-hou/webavailability | tests/test_webtracker.py | [
"Apache-2.0"
] | Python | mock_dns_resolver | <not_specific> | def mock_dns_resolver(domain, qtype):
"""
A mock DNS resolver, which either return anything normally or raise dns.resolver.NXDOMAIN exception.
For tests, it returns as follows.
notexistingdns.com --> Exception dns.resolver.NXDOMAIN case
Anything else --> '8.8.8.8'
:para... |
A mock DNS resolver, which either return anything normally or raise dns.resolver.NXDOMAIN exception.
For tests, it returns as follows.
notexistingdns.com --> Exception dns.resolver.NXDOMAIN case
Anything else --> '8.8.8.8'
:param domain: Domain name
:param qtype: query... | A mock DNS resolver, which either return anything normally or raise dns.resolver.NXDOMAIN exception.
For tests, it returns as follows.
| [
"A",
"mock",
"DNS",
"resolver",
"which",
"either",
"return",
"anything",
"normally",
"or",
"raise",
"dns",
".",
"resolver",
".",
"NXDOMAIN",
"exception",
".",
"For",
"tests",
"it",
"returns",
"as",
"follows",
"."
] | def mock_dns_resolver(domain, qtype):
if domain == 'notexistingdns.com':
raise dns.resolver.NXDOMAIN()
else:
return '8.8.8.8' | [
"def",
"mock_dns_resolver",
"(",
"domain",
",",
"qtype",
")",
":",
"if",
"domain",
"==",
"'notexistingdns.com'",
":",
"raise",
"dns",
".",
"resolver",
".",
"NXDOMAIN",
"(",
")",
"else",
":",
"return",
"'8.8.8.8'"
] | A mock DNS resolver, which either return anything normally or raise dns.resolver.NXDOMAIN exception. | [
"A",
"mock",
"DNS",
"resolver",
"which",
"either",
"return",
"anything",
"normally",
"or",
"raise",
"dns",
".",
"resolver",
".",
"NXDOMAIN",
"exception",
"."
] | [
"\"\"\"\n A mock DNS resolver, which either return anything normally or raise dns.resolver.NXDOMAIN exception.\n For tests, it returns as follows.\n\n notexistingdns.com --> Exception dns.resolver.NXDOMAIN case\n Anything else --> '8.8.8.8'\n\n :param domain: Domain name\n ... | [
{
"param": "domain",
"type": null
},
{
"param": "qtype",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "domain",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
a649a5b7684a00da312053567ed086802ad7d705 | eric-hou/webavailability | tests/test_webtracker.py | [
"Apache-2.0"
] | Python | mock_requests_get | <not_specific> | def mock_requests_get(url, timeout):
"""
A mock request get method which returns different response for different URLs.
Basically it covers all test paths.
Among the return,
https://aiven.io --> 200 (ok case)
https://contentmatched.com --> 200 (Page content matched, ok ca... |
A mock request get method which returns different response for different URLs.
Basically it covers all test paths.
Among the return,
https://aiven.io --> 200 (ok case)
https://contentmatched.com --> 200 (Page content matched, ok case)
https://contentdoesntmatch.com --> 2... | A mock request get method which returns different response for different URLs.
Basically it covers all test paths. | [
"A",
"mock",
"request",
"get",
"method",
"which",
"returns",
"different",
"response",
"for",
"different",
"URLs",
".",
"Basically",
"it",
"covers",
"all",
"test",
"paths",
"."
] | def mock_requests_get(url, timeout):
if url in ['https://aiven.io', 'https://contentdoesntmatch.com', 'https://contentmatched.com']:
return MockRequestResult(200)
elif url == 'https://non200status.com':
return MockRequestResult(403)
elif url == 'https://www.sslfailure.com... | [
"def",
"mock_requests_get",
"(",
"url",
",",
"timeout",
")",
":",
"if",
"url",
"in",
"[",
"'https://aiven.io'",
",",
"'https://contentdoesntmatch.com'",
",",
"'https://contentmatched.com'",
"]",
":",
"return",
"MockRequestResult",
"(",
"200",
")",
"elif",
"url",
"... | A mock request get method which returns different response for different URLs. | [
"A",
"mock",
"request",
"get",
"method",
"which",
"returns",
"different",
"response",
"for",
"different",
"URLs",
"."
] | [
"\"\"\"\n A mock request get method which returns different response for different URLs.\n Basically it covers all test paths.\n Among the return,\n https://aiven.io --> 200 (ok case)\n https://contentmatched.com --> 200 (Page content matched, ok case)\n https://contentdoes... | [
{
"param": "url",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"... |
b72ed932157f6f5fd6a97b0534dd52ddb7dd5672 | qiaoqz/GCP-Automation | utils.py | [
"MIT"
] | Python | list_blobs | <not_specific> | def list_blobs(self,bucket_name,folder_name):
"""Lists all the blobs in the bucket."""
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
#blobs = list(bucket.list_blobs(prefix='dark_money/'))
return [blob.name for blob in bucket.list_blobs(pre... | Lists all the blobs in the bucket. | Lists all the blobs in the bucket. | [
"Lists",
"all",
"the",
"blobs",
"in",
"the",
"bucket",
"."
] | def list_blobs(self,bucket_name,folder_name):
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
return [blob.name for blob in bucket.list_blobs(prefix=f'{folder_name}/')] | [
"def",
"list_blobs",
"(",
"self",
",",
"bucket_name",
",",
"folder_name",
")",
":",
"storage_client",
"=",
"storage",
".",
"Client",
"(",
")",
"bucket",
"=",
"storage_client",
".",
"get_bucket",
"(",
"bucket_name",
")",
"return",
"[",
"blob",
".",
"name",
... | Lists all the blobs in the bucket. | [
"Lists",
"all",
"the",
"blobs",
"in",
"the",
"bucket",
"."
] | [
"\"\"\"Lists all the blobs in the bucket.\"\"\"",
"#blobs = list(bucket.list_blobs(prefix='dark_money/'))\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "folder_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bucket_name",
"type": null,
"docstring": null,
"docstring_tok... |
b72ed932157f6f5fd6a97b0534dd52ddb7dd5672 | qiaoqz/GCP-Automation | utils.py | [
"MIT"
] | Python | download_blob | null | def download_blob(self,bucket_name, source_blob_name, destination_file_name):
"""Downloads a blob from the bucket."""
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(source_blob_name)
blob.download_to_filename(destinatio... | Downloads a blob from the bucket. | Downloads a blob from the bucket. | [
"Downloads",
"a",
"blob",
"from",
"the",
"bucket",
"."
] | def download_blob(self,bucket_name, source_blob_name, destination_file_name):
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(source_blob_name)
blob.download_to_filename(destination_file_name)
print('Blob {} downloaded to {}.'.... | [
"def",
"download_blob",
"(",
"self",
",",
"bucket_name",
",",
"source_blob_name",
",",
"destination_file_name",
")",
":",
"storage_client",
"=",
"storage",
".",
"Client",
"(",
")",
"bucket",
"=",
"storage_client",
".",
"get_bucket",
"(",
"bucket_name",
")",
"blo... | Downloads a blob from the bucket. | [
"Downloads",
"a",
"blob",
"from",
"the",
"bucket",
"."
] | [
"\"\"\"Downloads a blob from the bucket.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "bucket_name",
"type": null
},
{
"param": "source_blob_name",
"type": null
},
{
"param": "destination_file_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bucket_name",
"type": null,
"docstring": null,
"docstring_tok... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_mach_normal_ahead_shock | float | def calc_mach_normal_ahead_shock(mach: float, beta: float) -> float:
""" Calculates the normal component of the mach number ahead of the shock wave
Args:
mach (float): Mach number of flow ahead of shock wave
beta (float): Angle of oblique shock in radians
Raises:
... | Calculates the normal component of the mach number ahead of the shock wave
Args:
mach (float): Mach number of flow ahead of shock wave
beta (float): Angle of oblique shock in radians
Raises:
ValueError: Raised if mach number is less than 1.0
Returns:
... | Calculates the normal component of the mach number ahead of the shock wave | [
"Calculates",
"the",
"normal",
"component",
"of",
"the",
"mach",
"number",
"ahead",
"of",
"the",
"shock",
"wave"
] | def calc_mach_normal_ahead_shock(mach: float, beta: float) -> float:
if mach < 1.0:
raise ValueError("Normal Shocks Require a mach greater than 1")
machWave = ObliqueShockRelations.calc_mach_wave_angle(mach)
if abs(beta - machWave) < 1e-5:
return 1.0
if beta < mac... | [
"def",
"calc_mach_normal_ahead_shock",
"(",
"mach",
":",
"float",
",",
"beta",
":",
"float",
")",
"->",
"float",
":",
"if",
"mach",
"<",
"1.0",
":",
"raise",
"ValueError",
"(",
"\"Normal Shocks Require a mach greater than 1\"",
")",
"machWave",
"=",
"ObliqueShockR... | Calculates the normal component of the mach number ahead of the shock wave | [
"Calculates",
"the",
"normal",
"component",
"of",
"the",
"mach",
"number",
"ahead",
"of",
"the",
"shock",
"wave"
] | [
"\"\"\" Calculates the normal component of the mach number ahead of the shock wave\n\n Args:\n mach (float): Mach number of flow ahead of shock wave\n beta (float): Angle of oblique shock in radians\n\n Raises:\n ValueError: Raised if mach number is less than 1.0\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "beta",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Normal component of upstream mach number",
"docstring_tokens": [
"Normal",
"component",
"of",
"upstream",
"mach",
"number"
],
"type": "float"
}
],
"raises": [
{
"docstring": "Raised if mach num... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_mach_ahead_shock_from_mach_normal_ahead_shock | float | def calc_mach_ahead_shock_from_mach_normal_ahead_shock(machNormal1: float, beta: float) -> float:
""" Calculates the upstream mach number from the normal component of the upstream mach number
Args:
machNormal1 (float): Normal Component of mach number ahead of the shock wave
beta... | Calculates the upstream mach number from the normal component of the upstream mach number
Args:
machNormal1 (float): Normal Component of mach number ahead of the shock wave
beta (float): Angle of oblique shock in radians
Returns:
float: Returns value of mach number... | Calculates the upstream mach number from the normal component of the upstream mach number | [
"Calculates",
"the",
"upstream",
"mach",
"number",
"from",
"the",
"normal",
"component",
"of",
"the",
"upstream",
"mach",
"number"
] | def calc_mach_ahead_shock_from_mach_normal_ahead_shock(machNormal1: float, beta: float) -> float:
return machNormal1 / sin(beta) | [
"def",
"calc_mach_ahead_shock_from_mach_normal_ahead_shock",
"(",
"machNormal1",
":",
"float",
",",
"beta",
":",
"float",
")",
"->",
"float",
":",
"return",
"machNormal1",
"/",
"sin",
"(",
"beta",
")"
] | Calculates the upstream mach number from the normal component of the upstream mach number | [
"Calculates",
"the",
"upstream",
"mach",
"number",
"from",
"the",
"normal",
"component",
"of",
"the",
"upstream",
"mach",
"number"
] | [
"\"\"\" Calculates the upstream mach number from the normal component of the upstream mach number\n\n Args:\n machNormal1 (float): Normal Component of mach number ahead of the shock wave\n beta (float): Angle of oblique shock in radians\n\n Returns:\n float: Returns va... | [
{
"param": "machNormal1",
"type": "float"
},
{
"param": "beta",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Returns value of mach number of the flow ahead of the shock wave",
"docstring_tokens": [
"Returns",
"value",
"of",
"mach",
"number",
"of",
"the",
"flow",
"ahead",
"of",
"the",
... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_beta_from_mach_mach_normal_ahead_shock | float | def calc_beta_from_mach_mach_normal_ahead_shock(mach: float, machNormal1: float) -> float:
""" Calculates the Oblique shock angle from the normal component of the mach number that is ahead of the shock wave
Args:
mach (float): Mach number of the flow ahead of the shock wave
mach... | Calculates the Oblique shock angle from the normal component of the mach number that is ahead of the shock wave
Args:
mach (float): Mach number of the flow ahead of the shock wave
machNormal1 (float): Normal Component of mach number of the flow that is ahead of the oblique shock wave
... | Calculates the Oblique shock angle from the normal component of the mach number that is ahead of the shock wave | [
"Calculates",
"the",
"Oblique",
"shock",
"angle",
"from",
"the",
"normal",
"component",
"of",
"the",
"mach",
"number",
"that",
"is",
"ahead",
"of",
"the",
"shock",
"wave"
] | def calc_beta_from_mach_mach_normal_ahead_shock(mach: float, machNormal1: float) -> float:
return asin(machNormal1 / mach) | [
"def",
"calc_beta_from_mach_mach_normal_ahead_shock",
"(",
"mach",
":",
"float",
",",
"machNormal1",
":",
"float",
")",
"->",
"float",
":",
"return",
"asin",
"(",
"machNormal1",
"/",
"mach",
")"
] | Calculates the Oblique shock angle from the normal component of the mach number that is ahead of the shock wave | [
"Calculates",
"the",
"Oblique",
"shock",
"angle",
"from",
"the",
"normal",
"component",
"of",
"the",
"mach",
"number",
"that",
"is",
"ahead",
"of",
"the",
"shock",
"wave"
] | [
"\"\"\" Calculates the Oblique shock angle from the normal component of the mach number that is ahead of the shock wave\n\n Args:\n mach (float): Mach number of the flow ahead of the shock wave\n machNormal1 (float): Normal Component of mach number of the flow that is ahead of the obliq... | [
{
"param": "mach",
"type": "float"
},
{
"param": "machNormal1",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Oblique Shock Angle",
"docstring_tokens": [
"Oblique",
"Shock",
"Angle"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "Mach number of the flow ah... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_mach_behind_shock | float | def calc_mach_behind_shock(machNormal2: float, theta: float, beta: float) -> float:
""" Calculates the Mach number behind the oblique shock wave
Args:
machNormal2 (float): Normal Component of the mach number behind the shock wave
theta (float): Flow Deflection Angle (radians) (W... | Calculates the Mach number behind the oblique shock wave
Args:
machNormal2 (float): Normal Component of the mach number behind the shock wave
theta (float): Flow Deflection Angle (radians) (Wedge angle)
beta (float): Oblique shock angle (radians)
Returns:
... | Calculates the Mach number behind the oblique shock wave | [
"Calculates",
"the",
"Mach",
"number",
"behind",
"the",
"oblique",
"shock",
"wave"
] | def calc_mach_behind_shock(machNormal2: float, theta: float, beta: float) -> float:
return machNormal2 / sin(beta - theta) | [
"def",
"calc_mach_behind_shock",
"(",
"machNormal2",
":",
"float",
",",
"theta",
":",
"float",
",",
"beta",
":",
"float",
")",
"->",
"float",
":",
"return",
"machNormal2",
"/",
"sin",
"(",
"beta",
"-",
"theta",
")"
] | Calculates the Mach number behind the oblique shock wave | [
"Calculates",
"the",
"Mach",
"number",
"behind",
"the",
"oblique",
"shock",
"wave"
] | [
"\"\"\" Calculates the Mach number behind the oblique shock wave\n\n Args:\n machNormal2 (float): Normal Component of the mach number behind the shock wave\n theta (float): Flow Deflection Angle (radians) (Wedge angle)\n beta (float): Oblique shock angle (radians)\n\n ... | [
{
"param": "machNormal2",
"type": "float"
},
{
"param": "theta",
"type": "float"
},
{
"param": "beta",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Mach number of flow behind the oblique shock",
"docstring_tokens": [
"Mach",
"number",
"of",
"flow",
"behind",
"the",
"oblique",
"shock"
],
"type": "float"
}
],
"raises": [],
"params": ... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_mach_normal_behind_shock_from_mach_behind_shock | float | def calc_mach_normal_behind_shock_from_mach_behind_shock(
mach2: float, beta: float, theta: float
) -> float:
""" Calculates the normal component of the mach number behind the oblique shock
Args:
mach2 (float): Mach number of flow behind the oblique shock
beta (floa... | Calculates the normal component of the mach number behind the oblique shock
Args:
mach2 (float): Mach number of flow behind the oblique shock
beta (float): Oblique shock angle (radians)
theta (float): Flow deflections (Wedge) angle (radians)
Returns:
f... | Calculates the normal component of the mach number behind the oblique shock | [
"Calculates",
"the",
"normal",
"component",
"of",
"the",
"mach",
"number",
"behind",
"the",
"oblique",
"shock"
] | def calc_mach_normal_behind_shock_from_mach_behind_shock(
mach2: float, beta: float, theta: float
) -> float:
return mach2 * sin(beta - theta) | [
"def",
"calc_mach_normal_behind_shock_from_mach_behind_shock",
"(",
"mach2",
":",
"float",
",",
"beta",
":",
"float",
",",
"theta",
":",
"float",
")",
"->",
"float",
":",
"return",
"mach2",
"*",
"sin",
"(",
"beta",
"-",
"theta",
")"
] | Calculates the normal component of the mach number behind the oblique shock | [
"Calculates",
"the",
"normal",
"component",
"of",
"the",
"mach",
"number",
"behind",
"the",
"oblique",
"shock"
] | [
"\"\"\" Calculates the normal component of the mach number behind the oblique shock \n\n Args:\n mach2 (float): Mach number of flow behind the oblique shock\n beta (float): Oblique shock angle (radians)\n theta (float): Flow deflections (Wedge) angle (radians)\n\n Retu... | [
{
"param": "mach2",
"type": "float"
},
{
"param": "beta",
"type": "float"
},
{
"param": "theta",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Normal component of mach numnber of the flow behind the shock wave",
"docstring_tokens": [
"Normal",
"component",
"of",
"mach",
"numnber",
"of",
"the",
"flow",
"behind",
"the",
"shock... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_theta_from_theta_beta_mach | float | def calc_theta_from_theta_beta_mach(beta: float, mach: float, gamma: float, offset: float = 0.0) -> float:
""" Impliments the Theta-Beta-Mach (TBM) equation. Solves for Theta
Args:
beta (float): Oblique shock angle (radians)
mach (float): Mach number of flow ahead of the shock w... | Impliments the Theta-Beta-Mach (TBM) equation. Solves for Theta
Args:
beta (float): Oblique shock angle (radians)
mach (float): Mach number of flow ahead of the shock wave
gamma (float): Ratio of specific heats
offset (float, optional): [description]. Defaults t... | Impliments the Theta-Beta-Mach (TBM) equation. Solves for Theta | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"equation",
".",
"Solves",
"for",
"Theta"
] | def calc_theta_from_theta_beta_mach(beta: float, mach: float, gamma: float, offset: float = 0.0) -> float:
mSqr = pow(mach, 2)
num = mSqr * pow(sin(beta), 2) - 1
denom = mSqr * (gamma + cos(2 * beta)) + 2
theta = atan(2 * 1 / tan(beta) * num / denom) - offset
return theta | [
"def",
"calc_theta_from_theta_beta_mach",
"(",
"beta",
":",
"float",
",",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"mSqr",
"=",
"pow",
"(",
"mach",
",",
"2",
")",
"num",
"=",
... | Impliments the Theta-Beta-Mach (TBM) equation. | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"equation",
"."
] | [
"\"\"\" Impliments the Theta-Beta-Mach (TBM) equation. Solves for Theta\n\n Args:\n beta (float): Oblique shock angle (radians)\n mach (float): Mach number of flow ahead of the shock wave\n gamma (float): Ratio of specific heats\n offset (float, optional): [descrip... | [
{
"param": "beta",
"type": "float"
},
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Flow deflection (Wedge) angle (radians)",
"docstring_tokens": [
"Flow",
"deflection",
"(",
"Wedge",
")",
"angle",
"(",
"radians",
")"
],
"type": "float"
}
],
"raises": [],
"para... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_beta_from_theta_beta_mach_weak | float | def calc_beta_from_theta_beta_mach_weak(theta: float, mach: float, gamma: float) -> float:
""" Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming the shock is weak
Args:
theta (float): Flow deflection (Wedge) angle (radians)
mach (float): Mach ... | Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming the shock is weak
Args:
theta (float): Flow deflection (Wedge) angle (radians)
mach (float): Mach number of the flow ahead of the oblique shock
gamma (float): ratio of specific heats
... | Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming the shock is weak | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"equation",
".",
"Solves",
"for",
"Beta",
"(",
"shock",
"angle",
")",
"assuming",
"the",
"shock",
"is",
"weak"
] | def calc_beta_from_theta_beta_mach_weak(theta: float, mach: float, gamma: float) -> float:
maxShockAngle = ObliqueShockRelations.calc_max_shock_angle(mach, gamma)
minShockAngle = ObliqueShockRelations.calc_mach_wave_angle(mach)
return brenth(
ObliqueShockRelations.calc_theta_from_the... | [
"def",
"calc_beta_from_theta_beta_mach_weak",
"(",
"theta",
":",
"float",
",",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"maxShockAngle",
"=",
"ObliqueShockRelations",
".",
"calc_max_shock_angle",
"(",
"mach",
",",
"gamma",
")",
... | Impliments the Theta-Beta-Mach (TBM) equation. | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"equation",
"."
] | [
"\"\"\" Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming the shock is weak\n\n Args:\n theta (float): Flow deflection (Wedge) angle (radians)\n mach (float): Mach number of the flow ahead of the oblique shock\n gamma (float): ratio of spec... | [
{
"param": "theta",
"type": "float"
},
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Oblique shock angle (radians)",
"docstring_tokens": [
"Oblique",
"shock",
"angle",
"(",
"radians",
")"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "theta",
"type":... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_beta_from_theta_beta_mach_strong | float | def calc_beta_from_theta_beta_mach_strong(theta: float, mach: float, gamma: float) -> float:
""" Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming a strong shock wave
Args:
theta (float): Flow deflection (Wedge) angle (radians)
mach (float): M... | Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming a strong shock wave
Args:
theta (float): Flow deflection (Wedge) angle (radians)
mach (float): Mach number of the flow ahead of the oblique shock
gamma (float): ratio of specific heats
... | Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming a strong shock wave | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"equation",
".",
"Solves",
"for",
"Beta",
"(",
"shock",
"angle",
")",
"assuming",
"a",
"strong",
"shock",
"wave"
] | def calc_beta_from_theta_beta_mach_strong(theta: float, mach: float, gamma: float) -> float:
maxShockAngle = ObliqueShockRelations.calc_max_shock_angle(mach, gamma)
return brenth(
ObliqueShockRelations.calc_theta_from_theta_beta_mach,
maxShockAngle,
radians(90),
... | [
"def",
"calc_beta_from_theta_beta_mach_strong",
"(",
"theta",
":",
"float",
",",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"maxShockAngle",
"=",
"ObliqueShockRelations",
".",
"calc_max_shock_angle",
"(",
"mach",
",",
"gamma",
")"... | Impliments the Theta-Beta-Mach (TBM) equation. | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"equation",
"."
] | [
"\"\"\" Impliments the Theta-Beta-Mach (TBM) equation. Solves for Beta (shock angle) assuming a strong shock wave\n\n Args:\n theta (float): Flow deflection (Wedge) angle (radians)\n mach (float): Mach number of the flow ahead of the oblique shock\n gamma (float): ratio of sp... | [
{
"param": "theta",
"type": "float"
},
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Oblique shock angle (radians)",
"docstring_tokens": [
"Oblique",
"shock",
"angle",
"(",
"radians",
")"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "theta",
"type":... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_mach_from_theta_beta_mach | float | def calc_mach_from_theta_beta_mach(beta: float, theta: float, gamma: float) -> float:
""" Impliments the Theta-Beta-Mach (TBM) Equation. Solves for the mach number
Args:
beta (float): Oblique shock angle (radians)
theta (float): Flow deflection (wedge) angle (radians)
... | Impliments the Theta-Beta-Mach (TBM) Equation. Solves for the mach number
Args:
beta (float): Oblique shock angle (radians)
theta (float): Flow deflection (wedge) angle (radians)
gamma (float): Ratio of specific heats
Returns:
float: Mach number of the ... | Impliments the Theta-Beta-Mach (TBM) Equation. Solves for the mach number | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"Equation",
".",
"Solves",
"for",
"the",
"mach",
"number"
] | def calc_mach_from_theta_beta_mach(beta: float, theta: float, gamma: float) -> float:
numerator = -2 * (1 + tan(theta) * tan(beta))
denominator = tan(theta) * tan(beta) * (gamma + cos(2 * beta)) - 2 * (sin(beta)) ** 2
return sqrt(numerator / denominator) | [
"def",
"calc_mach_from_theta_beta_mach",
"(",
"beta",
":",
"float",
",",
"theta",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"numerator",
"=",
"-",
"2",
"*",
"(",
"1",
"+",
"tan",
"(",
"theta",
")",
"*",
"tan",
"(",
"beta",
... | Impliments the Theta-Beta-Mach (TBM) Equation. | [
"Impliments",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"(",
"TBM",
")",
"Equation",
"."
] | [
"\"\"\" Impliments the Theta-Beta-Mach (TBM) Equation. Solves for the mach number\n\n Args:\n beta (float): Oblique shock angle (radians)\n theta (float): Flow deflection (wedge) angle (radians)\n gamma (float): Ratio of specific heats\n\n Returns:\n float: ... | [
{
"param": "beta",
"type": "float"
},
{
"param": "theta",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Mach number of the flow ahead of the shock wave",
"docstring_tokens": [
"Mach",
"number",
"of",
"the",
"flow",
"ahead",
"of",
"the",
"shock",
"wave"
],
"type": "float"
}
],
... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_max_flow_deflection_angle | float | def calc_max_flow_deflection_angle(maxShockAngle: float, mach: float, gamma: float) -> float:
""" Calculates the max flow deflection angle for a flow
Args:
maxShockAngle (float): Maximum oblique shock angle (radians)
mach (float): Mach number of flow ahead of the oblique shock
... | Calculates the max flow deflection angle for a flow
Args:
maxShockAngle (float): Maximum oblique shock angle (radians)
mach (float): Mach number of flow ahead of the oblique shock
gamma (float): Ratio of specific heats
Returns:
float: Mac flow deflectio... | Calculates the max flow deflection angle for a flow | [
"Calculates",
"the",
"max",
"flow",
"deflection",
"angle",
"for",
"a",
"flow"
] | def calc_max_flow_deflection_angle(maxShockAngle: float, mach: float, gamma: float) -> float:
msa = maxShockAngle
numerator = (pow(mach, 2) * (sin(msa)) ** 2 - 1) / tan(msa)
denominator = pow(mach, 2) * (gamma + 1) / 2 - pow(mach, 2) * (pow(sin(msa), 2)) + 1
return atan(numerator / denom... | [
"def",
"calc_max_flow_deflection_angle",
"(",
"maxShockAngle",
":",
"float",
",",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"msa",
"=",
"maxShockAngle",
"numerator",
"=",
"(",
"pow",
"(",
"mach",
",",
"2",
")",
"*",
"(",
... | Calculates the max flow deflection angle for a flow | [
"Calculates",
"the",
"max",
"flow",
"deflection",
"angle",
"for",
"a",
"flow"
] | [
"\"\"\" Calculates the max flow deflection angle for a flow\n\n Args:\n maxShockAngle (float): Maximum oblique shock angle (radians)\n mach (float): Mach number of flow ahead of the oblique shock\n gamma (float): Ratio of specific heats\n\n Returns:\n float:... | [
{
"param": "maxShockAngle",
"type": "float"
},
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Mac flow deflection angle (radians)",
"docstring_tokens": [
"Mac",
"flow",
"deflection",
"angle",
"(",
"radians",
")"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier":... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_max_shock_angle | float | def calc_max_shock_angle(mach: float, gamma: float) -> float:
""" Calculates the maximum oblique shock angle
Args:
mach (float): Mach number of flow ahead of the shock wave
gamma (float): Ratio of specific heats
Returns:
float: Maximum value of the oblique ... | Calculates the maximum oblique shock angle
Args:
mach (float): Mach number of flow ahead of the shock wave
gamma (float): Ratio of specific heats
Returns:
float: Maximum value of the oblique shock angle (radians)
| Calculates the maximum oblique shock angle | [
"Calculates",
"the",
"maximum",
"oblique",
"shock",
"angle"
] | def calc_max_shock_angle(mach: float, gamma: float) -> float:
gp1 = gamma + 1
gm1 = gamma - 1
isissq = gp1 * (1 + gm1 * pow(mach, 2) / 2 + gp1 / 16 * pow(mach, 4))
issq = 1 / (gamma * pow(mach, 2)) * (gp1 * pow(mach, 2) / 4 + sqrt(isissq) - 1)
return asin(sqrt(issq)) | [
"def",
"calc_max_shock_angle",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"gp1",
"=",
"gamma",
"+",
"1",
"gm1",
"=",
"gamma",
"-",
"1",
"isissq",
"=",
"gp1",
"*",
"(",
"1",
"+",
"gm1",
"*",
"pow",
"(",
"mach",... | Calculates the maximum oblique shock angle | [
"Calculates",
"the",
"maximum",
"oblique",
"shock",
"angle"
] | [
"\"\"\" Calculates the maximum oblique shock angle \n\n Args:\n mach (float): Mach number of flow ahead of the shock wave\n gamma (float): Ratio of specific heats\n\n Returns:\n float: Maximum value of the oblique shock angle (radians)\n \"\"\"",
"# splitting ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": "Maximum value of the oblique shock angle (radians)",
"docstring_tokens": [
"Maximum",
"value",
"of",
"the",
"oblique",
"shock",
"angle",
"(",
"radians",
")"
],
"type": "float"
... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | calc_mach_from_mach_wave_angle | float | def calc_mach_from_mach_wave_angle(machAngle: float) -> float:
""" Calculates the Mach number fromt he mach wave angle
Args:
machAngle (float): Mach wave angle (mu) (radians)
Returns:
float: mach number
"""
return 1 / sin(machAngle) | Calculates the Mach number fromt he mach wave angle
Args:
machAngle (float): Mach wave angle (mu) (radians)
Returns:
float: mach number
| Calculates the Mach number fromt he mach wave angle | [
"Calculates",
"the",
"Mach",
"number",
"fromt",
"he",
"mach",
"wave",
"angle"
] | def calc_mach_from_mach_wave_angle(machAngle: float) -> float:
return 1 / sin(machAngle) | [
"def",
"calc_mach_from_mach_wave_angle",
"(",
"machAngle",
":",
"float",
")",
"->",
"float",
":",
"return",
"1",
"/",
"sin",
"(",
"machAngle",
")"
] | Calculates the Mach number fromt he mach wave angle | [
"Calculates",
"the",
"Mach",
"number",
"fromt",
"he",
"mach",
"wave",
"angle"
] | [
"\"\"\" Calculates the Mach number fromt he mach wave angle\n\n Args:\n machAngle (float): Mach wave angle (mu) (radians)\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "machAngle",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "machAngle",
"type": "float",
"docstring": "Mach wave angle (mu) (radians)",
"docstring_tokens": [
"Mach"... |
f855abc1996598caf48333299681a99eaf464c32 | Rigel09/CompAero | CompAero/ObliqueShockRelations.py | [
"MIT"
] | Python | plot_theta_beta_mach_chart | None | def plot_theta_beta_mach_chart(self) -> None:
""" Plots the Theta-Beta-Mach plot from the data already in the class
"""
mach = self.mach
machWaveAngle = degrees(ObliqueShockRelations.calc_mach_wave_angle(mach))
maxShockAngle = degrees(ObliqueShockRelations.calc_max_shock_angle(m... | Plots the Theta-Beta-Mach plot from the data already in the class
| Plots the Theta-Beta-Mach plot from the data already in the class | [
"Plots",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"plot",
"from",
"the",
"data",
"already",
"in",
"the",
"class"
] | def plot_theta_beta_mach_chart(self) -> None:
mach = self.mach
machWaveAngle = degrees(ObliqueShockRelations.calc_mach_wave_angle(mach))
maxShockAngle = degrees(ObliqueShockRelations.calc_max_shock_angle(mach, self.gamma))
maxDeflectionAngle = degrees(
ObliqueShockRelations.c... | [
"def",
"plot_theta_beta_mach_chart",
"(",
"self",
")",
"->",
"None",
":",
"mach",
"=",
"self",
".",
"mach",
"machWaveAngle",
"=",
"degrees",
"(",
"ObliqueShockRelations",
".",
"calc_mach_wave_angle",
"(",
"mach",
")",
")",
"maxShockAngle",
"=",
"degrees",
"(",
... | Plots the Theta-Beta-Mach plot from the data already in the class | [
"Plots",
"the",
"Theta",
"-",
"Beta",
"-",
"Mach",
"plot",
"from",
"the",
"data",
"already",
"in",
"the",
"class"
] | [
"\"\"\" Plots the Theta-Beta-Mach plot from the data already in the class\n \"\"\"",
"# ax.plot(np.ones(vertPointLine.shape) * self.wedgeAngle, vertPointLine, 'g')",
"# ax.plot(horzPointLine, np.ones(horzPointLine.shape) * self.shockAngle, 'g')",
"# ax.set_xlim(0, maxDeflectionAngle + 5)",
"# ax.set_... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | apply_pipe_parameters | None | def apply_pipe_parameters(self, diameter: float, length: float, frictionCoeff: float = 0.005) -> None:
"""This functions applies parameters of a known pipe to the determined state of the flow.
This allows the state at the downstream end of the pipe or pipe section to be found
Args:
... | This functions applies parameters of a known pipe to the determined state of the flow.
This allows the state at the downstream end of the pipe or pipe section to be found
Args:
diameter (float): Diameter of pipe
length (float): Length of pipe
frictionCoeff (floa... | This functions applies parameters of a known pipe to the determined state of the flow.
This allows the state at the downstream end of the pipe or pipe section to be found | [
"This",
"functions",
"applies",
"parameters",
"of",
"a",
"known",
"pipe",
"to",
"the",
"determined",
"state",
"of",
"the",
"flow",
".",
"This",
"allows",
"the",
"state",
"at",
"the",
"downstream",
"end",
"of",
"the",
"pipe",
"or",
"pipe",
"section",
"to",
... | def apply_pipe_parameters(self, diameter: float, length: float, frictionCoeff: float = 0.005) -> None:
self.pipeDiameter = diameter
self.pipeLength = length
self.frictionCoeff = frictionCoeff
self.__calculateDownStreamState() | [
"def",
"apply_pipe_parameters",
"(",
"self",
",",
"diameter",
":",
"float",
",",
"length",
":",
"float",
",",
"frictionCoeff",
":",
"float",
"=",
"0.005",
")",
"->",
"None",
":",
"self",
".",
"pipeDiameter",
"=",
"diameter",
"self",
".",
"pipeLength",
"=",... | This functions applies parameters of a known pipe to the determined state of the flow. | [
"This",
"functions",
"applies",
"parameters",
"of",
"a",
"known",
"pipe",
"to",
"the",
"determined",
"state",
"of",
"the",
"flow",
"."
] | [
"\"\"\"This functions applies parameters of a known pipe to the determined state of the flow. \n This allows the state at the downstream end of the pipe or pipe section to be found\n\n Args:\n diameter (float): Diameter of pipe\n length (float): Length of pipe\n fr... | [
{
"param": "self",
"type": null
},
{
"param": "diameter",
"type": "float"
},
{
"param": "length",
"type": "float"
},
{
"param": "frictionCoeff",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "diameter",
"type": "float",
"docstring": "Diameter of pipe",
... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_T_Tstar | float | def calc_T_Tstar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static temperature to sonic temperature T/T*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can... | Calculates Ratio of static temperature to sonic temperature T/T*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static temperature to sonic temperature T/T | [
"Calculates",
"Ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"temperature",
"T",
"/",
"T"
] | def calc_T_Tstar(mach: float, gamma: float, offset: float = 0.0) -> float:
return (gamma + 1) / (2 + (gamma - 1) * pow(mach, 2)) - offset | [
"def",
"calc_T_Tstar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"(",
"gamma",
"+",
"1",
")",
"/",
"(",
"2",
"+",
"(",
"gamma",
"-",
"1",
")",
"*",
"pow",
... | Calculates Ratio of static temperature to sonic temperature T/T | [
"Calculates",
"Ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"temperature",
"T",
"/",
"T"
] | [
"\"\"\"Calculates Ratio of static temperature to sonic temperature T/T*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_T_TStar | float | def calc_mach_from_T_TStar(t_tSt: float, gamma: float) -> float:
"""Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T*
Args:
t_tSt (float): Ratio of static temperature to sonic static temperature T/T*
gamma (float): ratio of spec... | Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T*
Args:
t_tSt (float): Ratio of static temperature to sonic static temperature T/T*
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"static",
"temperature",
"T",
"/",
"T"
] | def calc_mach_from_T_TStar(t_tSt: float, gamma: float) -> float:
return brenth(FannoFlowRelations.calc_T_Tstar, 1e-9, 40, args=(gamma, t_tSt,)) | [
"def",
"calc_mach_from_T_TStar",
"(",
"t_tSt",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"FannoFlowRelations",
".",
"calc_T_Tstar",
",",
"1e-9",
",",
"40",
",",
"args",
"=",
"(",
"gamma",
",",
"t_tSt",
",... | Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"static",
"temperature",
"T",
"/",
"T"
] | [
"\"\"\"Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T*\n\n Args:\n t_tSt (float): Ratio of static temperature to sonic static temperature T/T*\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach numbe... | [
{
"param": "t_tSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "t_tSt",
"type": "float",
"docstring": "Ratio of static temperature to sonic static temperature T/T",
"docstring_... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_P_Pstar | float | def calc_P_Pstar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static pressure to sonic pressure P/P*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be us... | Calculates Ratio of static pressure to sonic pressure P/P*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static pressure to sonic pressure P/P | [
"Calculates",
"Ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"pressure",
"P",
"/",
"P"
] | def calc_P_Pstar(mach: float, gamma: float, offset: float = 0.0) -> float:
return sqrt(FannoFlowRelations.calc_T_Tstar(mach, gamma)) / mach - offset | [
"def",
"calc_P_Pstar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"sqrt",
"(",
"FannoFlowRelations",
".",
"calc_T_Tstar",
"(",
"mach",
",",
"gamma",
")",
")",
"/",
... | Calculates Ratio of static pressure to sonic pressure P/P | [
"Calculates",
"Ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"pressure",
"P",
"/",
"P"
] | [
"\"\"\"Calculates Ratio of static pressure to sonic pressure P/P*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_P_PStar | float | def calc_mach_from_P_PStar(p_pSt: float, gamma: float) -> float:
"""Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P*
Args:
p_pSt (float): Ratio of static pressure to sonic static pressure P/P*
gamma (float): ratio of specific heats
... | Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P*
Args:
p_pSt (float): Ratio of static pressure to sonic static pressure P/P*
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"static",
"pressure",
"P",
"/",
"P"
] | def calc_mach_from_P_PStar(p_pSt: float, gamma: float) -> float:
return brenth(FannoFlowRelations.calc_P_Pstar, 1e-9, 40, args=(gamma, p_pSt,)) | [
"def",
"calc_mach_from_P_PStar",
"(",
"p_pSt",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"FannoFlowRelations",
".",
"calc_P_Pstar",
",",
"1e-9",
",",
"40",
",",
"args",
"=",
"(",
"gamma",
",",
"p_pSt",
",... | Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"static",
"pressure",
"P",
"/",
"P"
] | [
"\"\"\"Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P*\n\n Args:\n p_pSt (float): Ratio of static pressure to sonic static pressure P/P*\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \... | [
{
"param": "p_pSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "p_pSt",
"type": "float",
"docstring": "Ratio of static pressure to sonic static pressure P/P",
"docstring_tokens... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_Rho_RhoStar | float | def calc_Rho_RhoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static density to sonic density Rho/Rho*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can... | Calculates Ratio of static density to sonic density Rho/Rho*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static density to sonic density Rho/Rho | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | def calc_Rho_RhoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
return sqrt(1 / FannoFlowRelations.calc_T_Tstar(mach, gamma)) / mach - offset | [
"def",
"calc_Rho_RhoStar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"sqrt",
"(",
"1",
"/",
"FannoFlowRelations",
".",
"calc_T_Tstar",
"(",
"mach",
",",
"gamma",
"... | Calculates Ratio of static density to sonic density Rho/Rho | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | [
"\"\"\"Calculates Ratio of static density to sonic density Rho/Rho*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_Rho_RhoStar | float | def calc_mach_from_Rho_RhoStar(rho_rhoSt: float, gamma: float) -> float:
"""Calculates the mach number based of the ratio of density to sonic density Rho/Rho*
Args:
rho_rhoSt (float): Ratio of density to sonic density Rho/Rho*
gamma (float): ratio of specific heats
Retu... | Calculates the mach number based of the ratio of density to sonic density Rho/Rho*
Args:
rho_rhoSt (float): Ratio of density to sonic density Rho/Rho*
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based of the ratio of density to sonic density Rho/Rho | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | def calc_mach_from_Rho_RhoStar(rho_rhoSt: float, gamma: float) -> float:
return brenth(FannoFlowRelations.calc_Rho_RhoStar, 1e-9, 40, args=(gamma, rho_rhoSt,),) | [
"def",
"calc_mach_from_Rho_RhoStar",
"(",
"rho_rhoSt",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"FannoFlowRelations",
".",
"calc_Rho_RhoStar",
",",
"1e-9",
",",
"40",
",",
"args",
"=",
"(",
"gamma",
",",
"... | Calculates the mach number based of the ratio of density to sonic density Rho/Rho | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | [
"\"\"\"Calculates the mach number based of the ratio of density to sonic density Rho/Rho*\n\n Args:\n rho_rhoSt (float): Ratio of density to sonic density Rho/Rho*\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "rho_rhoSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "rho_rhoSt",
"type": "float",
"docstring": "Ratio of density to sonic density Rho/Rho",
"docstring_tokens": [
... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_Po_PoStar | float | def calc_Po_PoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static density to sonic density P0/P0*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be ... | Calculates Ratio of static density to sonic density P0/P0*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static density to sonic density P0/P0 | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"P0",
"/",
"P0"
] | def calc_Po_PoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
gp1 = gamma + 1
gm1 = gamma - 1
return pow(1 / FannoFlowRelations.calc_T_Tstar(mach, gamma), gp1 / (2 * gm1)) / mach - offset | [
"def",
"calc_Po_PoStar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"gp1",
"=",
"gamma",
"+",
"1",
"gm1",
"=",
"gamma",
"-",
"1",
"return",
"pow",
"(",
"1",
"/",
"Fanno... | Calculates Ratio of static density to sonic density P0/P0 | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"P0",
"/",
"P0"
] | [
"\"\"\"Calculates Ratio of static density to sonic density P0/P0*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_Po_PoStar | float | def calc_mach_from_Po_PoStar(
po_poSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
"""Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0*
Args:
po_poSt (float): Ratio of total pressure to sonic total pre... | Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0*
Args:
po_poSt (float): Ratio of total pressure to sonic total pressure P0/P0*
gamma (float): ratio of specific heats
flowType (FlowState, optional): States whether the flow is curr... | Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0 | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"total",
"pressure",
"to",
"sonic",
"total",
"pressure",
"P0",
"/",
"P0"
] | def calc_mach_from_Po_PoStar(
po_poSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
tolerance = 1e-5
if po_poSt == 1.0:
return 1
elif flowType == FlowState.SUPER_SONIC:
return brenth(FannoFlowRelations.calc_Po_PoStar, 1 + tolera... | [
"def",
"calc_mach_from_Po_PoStar",
"(",
"po_poSt",
":",
"float",
",",
"gamma",
":",
"float",
",",
"flowType",
":",
"FlowState",
"=",
"FlowState",
".",
"SUPER_SONIC",
")",
"->",
"float",
":",
"tolerance",
"=",
"1e-5",
"if",
"po_poSt",
"==",
"1.0",
":",
"ret... | Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0 | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"total",
"pressure",
"to",
"sonic",
"total",
"pressure",
"P0",
"/",
"P0"
] | [
"\"\"\"Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0*\n\n Args:\n po_poSt (float): Ratio of total pressure to sonic total pressure P0/P0*\n gamma (float): ratio of specific heats\n flowType (FlowState, optional): States whether ... | [
{
"param": "po_poSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "flowType",
"type": "FlowState"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "po_poSt",
"type": "float",
"docstring": "Ratio of total pressure to sonic total pressure P0/P0",
"docstring_toke... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_4FLSt_D | float | def calc_mach_from_4FLSt_D(
f4lSt_d: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
""" Calculates the mach number from the friction parameter
Args:
f4lSt_d (float): friction parameter 4FL*/D
gamma (float): ratio of specific heats
... | Calculates the mach number from the friction parameter
Args:
f4lSt_d (float): friction parameter 4FL*/D
gamma (float): ratio of specific heats
flowType (FlowState, optional): Type of flow whether it is super sonic of subsonic. Defaults to FlowState.SUPER_SONIC.
Ra... | Calculates the mach number from the friction parameter | [
"Calculates",
"the",
"mach",
"number",
"from",
"the",
"friction",
"parameter"
] | def calc_mach_from_4FLSt_D(
f4lSt_d: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
if f4lSt_d == 0.0:
return 1
elif flowType == FlowState.SUPER_SONIC:
return brenth(FannoFlowRelations.calc_4FLSt_D, 1.00001, 50, args=(gamma, f4lSt_d,),)
... | [
"def",
"calc_mach_from_4FLSt_D",
"(",
"f4lSt_d",
":",
"float",
",",
"gamma",
":",
"float",
",",
"flowType",
":",
"FlowState",
"=",
"FlowState",
".",
"SUPER_SONIC",
")",
"->",
"float",
":",
"if",
"f4lSt_d",
"==",
"0.0",
":",
"return",
"1",
"elif",
"flowType... | Calculates the mach number from the friction parameter | [
"Calculates",
"the",
"mach",
"number",
"from",
"the",
"friction",
"parameter"
] | [
"\"\"\" Calculates the mach number from the friction parameter\n\n Args:\n f4lSt_d (float): friction parameter 4FL*/D\n gamma (float): ratio of specific heats\n flowType (FlowState, optional): Type of flow whether it is super sonic of subsonic. Defaults to FlowState.SUPER_SO... | [
{
"param": "f4lSt_d",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "flowType",
"type": "FlowState"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [
{
"docstring": "Raised if Flow State is not supersonic of subsonic",
"docstring_tokens": [
"Raised",
"if",
"Flow",
"State",
... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_U_UStar | float | def calc_U_UStar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static velocity to sonic velocity U/U*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be us... | Calculates Ratio of static velocity to sonic velocity U/U*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static velocity to sonic velocity U/U | [
"Calculates",
"Ratio",
"of",
"static",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | def calc_U_UStar(mach: float, gamma: float, offset: float = 0.0) -> float:
t_tSt = FannoFlowRelations.calc_T_Tstar(mach, gamma)
return mach * sqrt(t_tSt) - offset | [
"def",
"calc_U_UStar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"t_tSt",
"=",
"FannoFlowRelations",
".",
"calc_T_Tstar",
"(",
"mach",
",",
"gamma",
")",
"return",
"mach",
"... | Calculates Ratio of static velocity to sonic velocity U/U | [
"Calculates",
"Ratio",
"of",
"static",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | [
"\"\"\"Calculates Ratio of static velocity to sonic velocity U/U*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
f26ff58b2d7aa8a078155269cdff12122ea05fa2 | Rigel09/CompAero | CompAero/FannoFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_U_USt | float | def calc_mach_from_U_USt(u_uSt: float, gamma: float) -> float:
"""Calculates the mach number based of the ratio of velocity to sonic velocity U/U*
Args:
u_uSt (float): Ratio of velocity to sonic velocity U/U*
gamma (float): ratio of specific heats
Returns:
f... | Calculates the mach number based of the ratio of velocity to sonic velocity U/U*
Args:
u_uSt (float): Ratio of velocity to sonic velocity U/U*
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based of the ratio of velocity to sonic velocity U/U | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | def calc_mach_from_U_USt(u_uSt: float, gamma: float) -> float:
return brenth(FannoFlowRelations.calc_U_UStar, 1e-9, 40, args=(gamma, u_uSt)) | [
"def",
"calc_mach_from_U_USt",
"(",
"u_uSt",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"FannoFlowRelations",
".",
"calc_U_UStar",
",",
"1e-9",
",",
"40",
",",
"args",
"=",
"(",
"gamma",
",",
"u_uSt",
")",... | Calculates the mach number based of the ratio of velocity to sonic velocity U/U | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | [
"\"\"\"Calculates the mach number based of the ratio of velocity to sonic velocity U/U*\n\n Args:\n u_uSt (float): Ratio of velocity to sonic velocity U/U*\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "u_uSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "u_uSt",
"type": "float",
"docstring": "Ratio of velocity to sonic velocity U/U",
"docstring_tokens": [
"... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_P_Pstar | float | def calc_P_Pstar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static pressure to sonic pressure P/P*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be us... | Calculates Ratio of static pressure to sonic pressure P/P*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static pressure to sonic pressure P/P | [
"Calculates",
"Ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"pressure",
"P",
"/",
"P"
] | def calc_P_Pstar(mach: float, gamma: float, offset: float = 0.0) -> float:
return (1 + gamma) / (1 + gamma * pow(mach, 2)) - offset | [
"def",
"calc_P_Pstar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"(",
"1",
"+",
"gamma",
")",
"/",
"(",
"1",
"+",
"gamma",
"*",
"pow",
"(",
"mach",
",",
"2... | Calculates Ratio of static pressure to sonic pressure P/P | [
"Calculates",
"Ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"pressure",
"P",
"/",
"P"
] | [
"\"\"\"Calculates Ratio of static pressure to sonic pressure P/P*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_P_PStar | float | def calc_mach_from_P_PStar(p_pSt: float, gamma: float) -> float:
"""Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P*
Args:
p_pSt (float): Ratio of static pressure to sonic static pressure P/P*
gamma (float): ratio of specific heats
... | Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P*
Args:
p_pSt (float): Ratio of static pressure to sonic static pressure P/P*
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"static",
"pressure",
"P",
"/",
"P"
] | def calc_mach_from_P_PStar(p_pSt: float, gamma: float) -> float:
return brenth(RayleighFlowRelations.calc_P_Pstar, 1e-9, 40, args=(gamma, p_pSt,)) | [
"def",
"calc_mach_from_P_PStar",
"(",
"p_pSt",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"RayleighFlowRelations",
".",
"calc_P_Pstar",
",",
"1e-9",
",",
"40",
",",
"args",
"=",
"(",
"gamma",
",",
"p_pSt",
... | Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"pressure",
"to",
"sonic",
"static",
"pressure",
"P",
"/",
"P"
] | [
"\"\"\"Calculates the mach number based of the ratio of static pressure to sonic static pressure P/P*\n\n Args:\n p_pSt (float): Ratio of static pressure to sonic static pressure P/P*\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \... | [
{
"param": "p_pSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "p_pSt",
"type": "float",
"docstring": "Ratio of static pressure to sonic static pressure P/P",
"docstring_tokens... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_T_Tstar | float | def calc_T_Tstar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static temperature to sonic temperature T/T*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can... | Calculates Ratio of static temperature to sonic temperature T/T*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static temperature to sonic temperature T/T | [
"Calculates",
"Ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"temperature",
"T",
"/",
"T"
] | def calc_T_Tstar(mach: float, gamma: float, offset: float = 0.0) -> float:
return pow(mach, 2) * pow(RayleighFlowRelations.calc_P_Pstar(mach, gamma), 2) - offset | [
"def",
"calc_T_Tstar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"pow",
"(",
"mach",
",",
"2",
")",
"*",
"pow",
"(",
"RayleighFlowRelations",
".",
"calc_P_Pstar",
... | Calculates Ratio of static temperature to sonic temperature T/T | [
"Calculates",
"Ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"temperature",
"T",
"/",
"T"
] | [
"\"\"\"Calculates Ratio of static temperature to sonic temperature T/T*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_T_TStar | float | def calc_mach_from_T_TStar(
t_tSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
"""Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T*
Args:
t_tSt (float): Ratio of static temperature to sonic stati... | Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T*
Args:
t_tSt (float): Ratio of static temperature to sonic static temperature T/T*
gamma (float): ratio of specific heats
flowType (FlowState, optional): States whether the fl... | Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"static",
"temperature",
"T",
"/",
"T"
] | def calc_mach_from_T_TStar(
t_tSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
tolerance = 1e-5
if t_tSt == 1.0:
return 1
elif flowType == FlowState.SUPER_SONIC:
return brenth(RayleighFlowRelations.calc_T_Tstar, 1 + tolerance, ... | [
"def",
"calc_mach_from_T_TStar",
"(",
"t_tSt",
":",
"float",
",",
"gamma",
":",
"float",
",",
"flowType",
":",
"FlowState",
"=",
"FlowState",
".",
"SUPER_SONIC",
")",
"->",
"float",
":",
"tolerance",
"=",
"1e-5",
"if",
"t_tSt",
"==",
"1.0",
":",
"return",
... | Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"static",
"temperature",
"to",
"sonic",
"static",
"temperature",
"T",
"/",
"T"
] | [
"\"\"\"Calculates the mach number based of the ratio of static temperature to sonic static temperature T/T*\n\n Args:\n t_tSt (float): Ratio of static temperature to sonic static temperature T/T*\n gamma (float): ratio of specific heats\n flowType (FlowState, optional): State... | [
{
"param": "t_tSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "flowType",
"type": "FlowState"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "t_tSt",
"type": "float",
"docstring": "Ratio of static temperature to sonic static temperature T/T",
"docstring_... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_Rho_RhoStar | float | def calc_Rho_RhoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static density to sonic density Rho/Rho*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can... | Calculates Ratio of static density to sonic density Rho/Rho*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static density to sonic density Rho/Rho | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | def calc_Rho_RhoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
return 1 / RayleighFlowRelations.calc_P_Pstar(mach, gamma) / pow(mach, 2) - offset | [
"def",
"calc_Rho_RhoStar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"1",
"/",
"RayleighFlowRelations",
".",
"calc_P_Pstar",
"(",
"mach",
",",
"gamma",
")",
"/",
"... | Calculates Ratio of static density to sonic density Rho/Rho | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | [
"\"\"\"Calculates Ratio of static density to sonic density Rho/Rho*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_Rho_RhoStar | float | def calc_mach_from_Rho_RhoStar(rho_rhoSt: float, gamma: float) -> float:
"""Calculates the mach number based of the ratio of density to sonic density Rho/Rho*
Args:
rho_rhoSt (float): Ratio of density to sonic density Rho/Rho*
gamma (float): ratio of specific heats
Retu... | Calculates the mach number based of the ratio of density to sonic density Rho/Rho*
Args:
rho_rhoSt (float): Ratio of density to sonic density Rho/Rho*
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based of the ratio of density to sonic density Rho/Rho | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | def calc_mach_from_Rho_RhoStar(rho_rhoSt: float, gamma: float) -> float:
return brenth(RayleighFlowRelations.calc_Rho_RhoStar, 1e-9, 40, args=(gamma, rho_rhoSt,)) | [
"def",
"calc_mach_from_Rho_RhoStar",
"(",
"rho_rhoSt",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"RayleighFlowRelations",
".",
"calc_Rho_RhoStar",
",",
"1e-9",
",",
"40",
",",
"args",
"=",
"(",
"gamma",
",",
... | Calculates the mach number based of the ratio of density to sonic density Rho/Rho | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"density",
"to",
"sonic",
"density",
"Rho",
"/",
"Rho"
] | [
"\"\"\"Calculates the mach number based of the ratio of density to sonic density Rho/Rho*\n\n Args:\n rho_rhoSt (float): Ratio of density to sonic density Rho/Rho*\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "rho_rhoSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "rho_rhoSt",
"type": "float",
"docstring": "Ratio of density to sonic density Rho/Rho",
"docstring_tokens": [
... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_Po_PoStar | float | def calc_Po_PoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static density to sonic density P0/P0*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be ... | Calculates Ratio of static density to sonic density P0/P0*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static density to sonic density P0/P0 | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"P0",
"/",
"P0"
] | def calc_Po_PoStar(mach: float, gamma: float, offset: float = 0.0) -> float:
gp1 = gamma + 1
gm1 = gamma - 1
p_pSt = RayleighFlowRelations.calc_P_Pstar(mach, gamma)
ratio = (2 + gm1 * pow(mach, 2)) / gp1
return p_pSt * pow(ratio, gamma / gm1) - offset | [
"def",
"calc_Po_PoStar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"gp1",
"=",
"gamma",
"+",
"1",
"gm1",
"=",
"gamma",
"-",
"1",
"p_pSt",
"=",
"RayleighFlowRelations",
"."... | Calculates Ratio of static density to sonic density P0/P0 | [
"Calculates",
"Ratio",
"of",
"static",
"density",
"to",
"sonic",
"density",
"P0",
"/",
"P0"
] | [
"\"\"\"Calculates Ratio of static density to sonic density P0/P0*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_Po_PoStar | float | def calc_mach_from_Po_PoStar(
po_poSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
"""Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0*
Args:
po_poSt (float): Ratio of total pressure to sonic total pre... | Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0*
Args:
po_poSt (float): Ratio of total pressure to sonic total pressure P0/P0*
gamma (float): ratio of specific heats
flowType (FlowState, optional): States whether the flow is curr... | Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0 | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"total",
"pressure",
"to",
"sonic",
"total",
"pressure",
"P0",
"/",
"P0"
] | def calc_mach_from_Po_PoStar(
po_poSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
tolerance = 1e-5
if po_poSt == 1.0:
return 1
elif flowType == FlowState.SUPER_SONIC:
return brenth(RayleighFlowRelations.calc_Po_PoStar, 1 + tol... | [
"def",
"calc_mach_from_Po_PoStar",
"(",
"po_poSt",
":",
"float",
",",
"gamma",
":",
"float",
",",
"flowType",
":",
"FlowState",
"=",
"FlowState",
".",
"SUPER_SONIC",
")",
"->",
"float",
":",
"tolerance",
"=",
"1e-5",
"if",
"po_poSt",
"==",
"1.0",
":",
"ret... | Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0 | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"total",
"pressure",
"to",
"sonic",
"total",
"pressure",
"P0",
"/",
"P0"
] | [
"\"\"\"Calculates the mach number based of the ratio of total pressure to sonic total pressure P0/P0*\n\n Args:\n po_poSt (float): Ratio of total pressure to sonic total pressure P0/P0*\n gamma (float): ratio of specific heats\n flowType (FlowState, optional): States whether ... | [
{
"param": "po_poSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "flowType",
"type": "FlowState"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "po_poSt",
"type": "float",
"docstring": "Ratio of total pressure to sonic total pressure P0/P0",
"docstring_toke... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_To_ToSt | float | def calc_To_ToSt(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates To_To* given gamma and Mach, offset can be applied for root finding"""
gp1 = gamma + 1
gm1 = gamma - 1
mSqr = pow(mach, 2)
return gp1 * mSqr / pow((1 + gamma * mSqr), 2) * (2 + gm1 * mSqr) - ... | Calculates To_To* given gamma and Mach, offset can be applied for root finding | Calculates To_To* given gamma and Mach, offset can be applied for root finding | [
"Calculates",
"To_To",
"*",
"given",
"gamma",
"and",
"Mach",
"offset",
"can",
"be",
"applied",
"for",
"root",
"finding"
] | def calc_To_ToSt(mach: float, gamma: float, offset: float = 0.0) -> float:
gp1 = gamma + 1
gm1 = gamma - 1
mSqr = pow(mach, 2)
return gp1 * mSqr / pow((1 + gamma * mSqr), 2) * (2 + gm1 * mSqr) - offset | [
"def",
"calc_To_ToSt",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"gp1",
"=",
"gamma",
"+",
"1",
"gm1",
"=",
"gamma",
"-",
"1",
"mSqr",
"=",
"pow",
"(",
"mach",
",",
... | Calculates To_To* given gamma and Mach, offset can be applied for root finding | [
"Calculates",
"To_To",
"*",
"given",
"gamma",
"and",
"Mach",
"offset",
"can",
"be",
"applied",
"for",
"root",
"finding"
] | [
"\"\"\"Calculates To_To* given gamma and Mach, offset can be applied for root finding\"\"\""
] | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gamma",
"type": "float",
"docstring": null,
"docstring_tok... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_To_ToStar | float | def calc_mach_from_To_ToStar(
t_tSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
"""Calculates the mach number based of the ratio of total temperature to sonic total temperature T0/T0*
Args:
po_poSt (float): Ratio of total temperature to sonic to... | Calculates the mach number based of the ratio of total temperature to sonic total temperature T0/T0*
Args:
po_poSt (float): Ratio of total temperature to sonic total temperature T0/T0*
gamma (float): ratio of specific heats
flowType (FlowState, optional): States whether the ... | Calculates the mach number based of the ratio of total temperature to sonic total temperature T0/T0 | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"total",
"temperature",
"to",
"sonic",
"total",
"temperature",
"T0",
"/",
"T0"
] | def calc_mach_from_To_ToStar(
t_tSt: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
tolerance = 1e-5
if t_tSt == 1.0:
return 1
elif flowType == FlowState.SUPER_SONIC:
return brenth(RayleighFlowRelations.calc_To_ToSt, 1 + tolerance... | [
"def",
"calc_mach_from_To_ToStar",
"(",
"t_tSt",
":",
"float",
",",
"gamma",
":",
"float",
",",
"flowType",
":",
"FlowState",
"=",
"FlowState",
".",
"SUPER_SONIC",
")",
"->",
"float",
":",
"tolerance",
"=",
"1e-5",
"if",
"t_tSt",
"==",
"1.0",
":",
"return"... | Calculates the mach number based of the ratio of total temperature to sonic total temperature T0/T0 | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"total",
"temperature",
"to",
"sonic",
"total",
"temperature",
"T0",
"/",
"T0"
] | [
"\"\"\"Calculates the mach number based of the ratio of total temperature to sonic total temperature T0/T0*\n\n Args:\n po_poSt (float): Ratio of total temperature to sonic total temperature T0/T0*\n gamma (float): ratio of specific heats\n flowType (FlowState, optional): Sta... | [
{
"param": "t_tSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "flowType",
"type": "FlowState"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "t_tSt",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": ... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_U_UStar | float | def calc_U_UStar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates Ratio of static velocity to sonic velocity U/U*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be us... | Calculates Ratio of static velocity to sonic velocity U/U*
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates Ratio of static velocity to sonic velocity U/U | [
"Calculates",
"Ratio",
"of",
"static",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | def calc_U_UStar(mach: float, gamma: float, offset: float = 0.0) -> float:
gp1 = gamma + 1
mSqr = pow(mach, 2)
return gp1 * mSqr / (1 + gamma * mSqr) - offset | [
"def",
"calc_U_UStar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"gp1",
"=",
"gamma",
"+",
"1",
"mSqr",
"=",
"pow",
"(",
"mach",
",",
"2",
")",
"return",
"gp1",
"*",
... | Calculates Ratio of static velocity to sonic velocity U/U | [
"Calculates",
"Ratio",
"of",
"static",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | [
"\"\"\"Calculates Ratio of static velocity to sonic velocity U/U*\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
4ae67b06c6e66e252bc170b18a71a75ad6016214 | Rigel09/CompAero | CompAero/RayleighFlowRelations.py | [
"MIT"
] | Python | calc_mach_from_U_USt | float | def calc_mach_from_U_USt(u_uSt: float, gamma: float) -> float:
"""Calculates the mach number based of the ratio of velocity to sonic velocity U/U*
Args:
u_uSt (float): Ratio of velocity to sonic velocity U/U*
gamma (float): ratio of specific heats
Returns:
f... | Calculates the mach number based of the ratio of velocity to sonic velocity U/U*
Args:
u_uSt (float): Ratio of velocity to sonic velocity U/U*
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based of the ratio of velocity to sonic velocity U/U | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | def calc_mach_from_U_USt(u_uSt: float, gamma: float) -> float:
return brenth(RayleighFlowRelations.calc_U_UStar, 1e-9, 40, args=(gamma, u_uSt)) | [
"def",
"calc_mach_from_U_USt",
"(",
"u_uSt",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"RayleighFlowRelations",
".",
"calc_U_UStar",
",",
"1e-9",
",",
"40",
",",
"args",
"=",
"(",
"gamma",
",",
"u_uSt",
"... | Calculates the mach number based of the ratio of velocity to sonic velocity U/U | [
"Calculates",
"the",
"mach",
"number",
"based",
"of",
"the",
"ratio",
"of",
"velocity",
"to",
"sonic",
"velocity",
"U",
"/",
"U"
] | [
"\"\"\"Calculates the mach number based of the ratio of velocity to sonic velocity U/U*\n\n Args:\n u_uSt (float): Ratio of velocity to sonic velocity U/U*\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "u_uSt",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "u_uSt",
"type": "float",
"docstring": "Ratio of velocity to sonic velocity U/U",
"docstring_tokens": [
"... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_T0_T | float | def calc_T0_T(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates the ratio of Total Temperature to static temperature (T0/T)
Args:
mach (float): Mach number of the flow
gamma (float): Ratio of specific heats of the flow
offset (float, optional): ... | Calculates the ratio of Total Temperature to static temperature (T0/T)
Args:
mach (float): Mach number of the flow
gamma (float): Ratio of specific heats of the flow
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
... | Calculates the ratio of Total Temperature to static temperature (T0/T) | [
"Calculates",
"the",
"ratio",
"of",
"Total",
"Temperature",
"to",
"static",
"temperature",
"(",
"T0",
"/",
"T",
")"
] | def calc_T0_T(mach: float, gamma: float, offset: float = 0.0) -> float:
return 1 + (gamma - 1) / 2 * pow(mach, 2) - offset | [
"def",
"calc_T0_T",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"1",
"+",
"(",
"gamma",
"-",
"1",
")",
"/",
"2",
"*",
"pow",
"(",
"mach",
",",
"2",
")",
"-... | Calculates the ratio of Total Temperature to static temperature (T0/T) | [
"Calculates",
"the",
"ratio",
"of",
"Total",
"Temperature",
"to",
"static",
"temperature",
"(",
"T0",
"/",
"T",
")"
] | [
"\"\"\"Calculates the ratio of Total Temperature to static temperature (T0/T)\n\n Args:\n mach (float): Mach number of the flow\n gamma (float): Ratio of specific heats of the flow\n offset (float, optional): offset that can be used for root finding for a specific value. Defa... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "Mach number of the flow",
"docstring_tokens": [
"Mach",
"n... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_mach_from_T0_T | float | def calc_mach_from_T0_T(t0_t: float, gamma: float) -> float:
"""Calculates the Mach number for a flow given the ratio of total temperature to static temperature
Args:
t0_t (float): Ratio of total temperature to static temperature
gamma (float): ratio of specific heats
R... | Calculates the Mach number for a flow given the ratio of total temperature to static temperature
Args:
t0_t (float): Ratio of total temperature to static temperature
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the Mach number for a flow given the ratio of total temperature to static temperature | [
"Calculates",
"the",
"Mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"ratio",
"of",
"total",
"temperature",
"to",
"static",
"temperature"
] | def calc_mach_from_T0_T(t0_t: float, gamma: float) -> float:
return sqrt((t0_t - 1) * 2 / (gamma - 1)) | [
"def",
"calc_mach_from_T0_T",
"(",
"t0_t",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"sqrt",
"(",
"(",
"t0_t",
"-",
"1",
")",
"*",
"2",
"/",
"(",
"gamma",
"-",
"1",
")",
")"
] | Calculates the Mach number for a flow given the ratio of total temperature to static temperature | [
"Calculates",
"the",
"Mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"ratio",
"of",
"total",
"temperature",
"to",
"static",
"temperature"
] | [
"\"\"\"Calculates the Mach number for a flow given the ratio of total temperature to static temperature\n\n Args:\n t0_t (float): Ratio of total temperature to static temperature\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\"... | [
{
"param": "t0_t",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "t0_t",
"type": "float",
"docstring": "Ratio of total temperature to static temperature",
"docstring_tokens": [
... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_P0_P | float | def calc_P0_P(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates the ratio of Total pressure to static pressure (P0/P)
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be... | Calculates the ratio of Total pressure to static pressure (P0/P)
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates the ratio of Total pressure to static pressure (P0/P) | [
"Calculates",
"the",
"ratio",
"of",
"Total",
"pressure",
"to",
"static",
"pressure",
"(",
"P0",
"/",
"P",
")"
] | def calc_P0_P(mach: float, gamma: float, offset: float = 0.0) -> float:
return pow((1 + (gamma - 1) / 2 * pow(mach, 2)), gamma / (gamma - 1)) - offset | [
"def",
"calc_P0_P",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"pow",
"(",
"(",
"1",
"+",
"(",
"gamma",
"-",
"1",
")",
"/",
"2",
"*",
"pow",
"(",
"mach",
... | Calculates the ratio of Total pressure to static pressure (P0/P) | [
"Calculates",
"the",
"ratio",
"of",
"Total",
"pressure",
"to",
"static",
"pressure",
"(",
"P0",
"/",
"P",
")"
] | [
"\"\"\"Calculates the ratio of Total pressure to static pressure (P0/P)\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_mach_from_p0_p | float | def calc_mach_from_p0_p(p0_p: float, gamma: float) -> float:
"""Calculates the Mach number for a flow given the ratio of total pressure to static pressure
Args:
p0_p (float): Ratio of total pressure to static pressure
gamma (float): ratio of specific heats
Returns:
... | Calculates the Mach number for a flow given the ratio of total pressure to static pressure
Args:
p0_p (float): Ratio of total pressure to static pressure
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the Mach number for a flow given the ratio of total pressure to static pressure | [
"Calculates",
"the",
"Mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"ratio",
"of",
"total",
"pressure",
"to",
"static",
"pressure"
] | def calc_mach_from_p0_p(p0_p: float, gamma: float) -> float:
return brenth(IsentropicRelations.calc_P0_P, 0, 30, args=(gamma, p0_p)) | [
"def",
"calc_mach_from_p0_p",
"(",
"p0_p",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"IsentropicRelations",
".",
"calc_P0_P",
",",
"0",
",",
"30",
",",
"args",
"=",
"(",
"gamma",
",",
"p0_p",
")",
")"
] | Calculates the Mach number for a flow given the ratio of total pressure to static pressure | [
"Calculates",
"the",
"Mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"ratio",
"of",
"total",
"pressure",
"to",
"static",
"pressure"
] | [
"\"\"\"Calculates the Mach number for a flow given the ratio of total pressure to static pressure\n\n Args:\n p0_p (float): Ratio of total pressure to static pressure\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "p0_p",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "p0_p",
"type": "float",
"docstring": "Ratio of total pressure to static pressure",
"docstring_tokens": [
... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_rho0_rho | float | def calc_rho0_rho(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates the ratio of Total density to static density (rho0/rho)
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that ... | Calculates the ratio of Total density to static density (rho0/rho)
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates the ratio of Total density to static density (rho0/rho) | [
"Calculates",
"the",
"ratio",
"of",
"Total",
"density",
"to",
"static",
"density",
"(",
"rho0",
"/",
"rho",
")"
] | def calc_rho0_rho(mach: float, gamma: float, offset: float = 0.0) -> float:
return pow((1 + (gamma - 1) / 2 * pow(mach, 2)), 1 / (gamma - 1)) - offset | [
"def",
"calc_rho0_rho",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"return",
"pow",
"(",
"(",
"1",
"+",
"(",
"gamma",
"-",
"1",
")",
"/",
"2",
"*",
"pow",
"(",
"mach"... | Calculates the ratio of Total density to static density (rho0/rho) | [
"Calculates",
"the",
"ratio",
"of",
"Total",
"density",
"to",
"static",
"density",
"(",
"rho0",
"/",
"rho",
")"
] | [
"\"\"\"Calculates the ratio of Total density to static density (rho0/rho)\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_mach_from_rho0_rho | float | def calc_mach_from_rho0_rho(rho0_rho: float, gamma: float) -> float:
"""Calculates the Mach number for a flow given the ratio of total density to static density
Args:
rho0_rho (float): Ratio of total density to static density
gamma (float): ratio of specific heats
Retur... | Calculates the Mach number for a flow given the ratio of total density to static density
Args:
rho0_rho (float): Ratio of total density to static density
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the Mach number for a flow given the ratio of total density to static density | [
"Calculates",
"the",
"Mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"ratio",
"of",
"total",
"density",
"to",
"static",
"density"
] | def calc_mach_from_rho0_rho(rho0_rho: float, gamma: float) -> float:
return brenth(IsentropicRelations.calc_rho0_rho, 0, 30, args=(gamma, rho0_rho)) | [
"def",
"calc_mach_from_rho0_rho",
"(",
"rho0_rho",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"return",
"brenth",
"(",
"IsentropicRelations",
".",
"calc_rho0_rho",
",",
"0",
",",
"30",
",",
"args",
"=",
"(",
"gamma",
",",
"rho0_rho"... | Calculates the Mach number for a flow given the ratio of total density to static density | [
"Calculates",
"the",
"Mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"ratio",
"of",
"total",
"density",
"to",
"static",
"density"
] | [
"\"\"\"Calculates the Mach number for a flow given the ratio of total density to static density\n\n Args:\n rho0_rho (float): Ratio of total density to static density\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "rho0_rho",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "rho0_rho",
"type": "float",
"docstring": "Ratio of total density to static density",
"docstring_tokens": [
... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_A_Astar | float | def calc_A_Astar(mach: float, gamma: float, offset: float = 0.0) -> float:
"""Calculates the ratio of Nozzle Area to Sonic Throat Area (A/A*)
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can ... | Calculates the ratio of Nozzle Area to Sonic Throat Area (A/A*)
Args:
mach (float): mach number of the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
... | Calculates the ratio of Nozzle Area to Sonic Throat Area (A/A*) | [
"Calculates",
"the",
"ratio",
"of",
"Nozzle",
"Area",
"to",
"Sonic",
"Throat",
"Area",
"(",
"A",
"/",
"A",
"*",
")"
] | def calc_A_Astar(mach: float, gamma: float, offset: float = 0.0) -> float:
gm1 = gamma - 1
gp1 = gamma + 1
mSqr = pow(mach, 2)
nonRaised = 2 / gp1 * (1 + gm1 / 2 * mSqr)
return sqrt(pow(nonRaised, gp1 / gm1) / mSqr) - offset | [
"def",
"calc_A_Astar",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"gm1",
"=",
"gamma",
"-",
"1",
"gp1",
"=",
"gamma",
"+",
"1",
"mSqr",
"=",
"pow",
"(",
"mach",
",",
... | Calculates the ratio of Nozzle Area to Sonic Throat Area (A/A*) | [
"Calculates",
"the",
"ratio",
"of",
"Nozzle",
"Area",
"to",
"Sonic",
"Throat",
"Area",
"(",
"A",
"/",
"A",
"*",
")"
] | [
"\"\"\"Calculates the ratio of Nozzle Area to Sonic Throat Area (A/A*)\n\n Args:\n mach (float): mach number of the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n ... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the flow",
"docstring_tokens": [
"mach",
"n... |
6b4b88d06165b54a0f677bb5276dac3083c5c3b5 | Rigel09/CompAero | CompAero/IsentropecRelations.py | [
"MIT"
] | Python | calc_mach_from_A_Astar | float | def calc_mach_from_A_Astar(
A_Astar: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
"""Calculates the mach number for a flow given the nozzle area ratio and flow type
Args:
A_Astar (float): Ratio of nozzle area ratio to sonic area ratio
... | Calculates the mach number for a flow given the nozzle area ratio and flow type
Args:
A_Astar (float): Ratio of nozzle area ratio to sonic area ratio
gamma (float): ratio of specific heats
flowType (FlowState, optional): Type of flow whether it is super sonic of subsonic. De... | Calculates the mach number for a flow given the nozzle area ratio and flow type | [
"Calculates",
"the",
"mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"nozzle",
"area",
"ratio",
"and",
"flow",
"type"
] | def calc_mach_from_A_Astar(
A_Astar: float, gamma: float, flowType: FlowState = FlowState.SUPER_SONIC
) -> float:
assert isinstance(flowType, FlowState)
if A_Astar == 1.0:
return A_Astar
elif flowType == FlowState.SUPER_SONIC:
return brenth(IsentropicRelations... | [
"def",
"calc_mach_from_A_Astar",
"(",
"A_Astar",
":",
"float",
",",
"gamma",
":",
"float",
",",
"flowType",
":",
"FlowState",
"=",
"FlowState",
".",
"SUPER_SONIC",
")",
"->",
"float",
":",
"assert",
"isinstance",
"(",
"flowType",
",",
"FlowState",
")",
"if",... | Calculates the mach number for a flow given the nozzle area ratio and flow type | [
"Calculates",
"the",
"mach",
"number",
"for",
"a",
"flow",
"given",
"the",
"nozzle",
"area",
"ratio",
"and",
"flow",
"type"
] | [
"\"\"\"Calculates the mach number for a flow given the nozzle area ratio and flow type\n\n Args:\n A_Astar (float): Ratio of nozzle area ratio to sonic area ratio\n gamma (float): ratio of specific heats\n flowType (FlowState, optional): Type of flow whether it is super sonic... | [
{
"param": "A_Astar",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "flowType",
"type": "FlowState"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "A_Astar",
"type": "float",
"docstring": "Ratio of nozzle area ratio to sonic area ratio",
"docstring_tokens": [
... |
ca9f38b3c476dbc8061c08d51d80c761e46d214f | Rigel09/CompAero | CompAero/internal.py | [
"MIT"
] | Python | to_string | str | def to_string(name: str, value: Union[float, int, bool], precision: int, dot_line: bool = False) -> str:
"""This generates a professional easy to read string for a data value
Args:
name (str): Name that is to be printed with value
value (Union[float, int, bool]): Value that is to be printed
... | This generates a professional easy to read string for a data value
Args:
name (str): Name that is to be printed with value
value (Union[float, int, bool]): Value that is to be printed
precision (int, optional): precision to round value to. Defaults to 4.
dot_line (bool, optional): p... | This generates a professional easy to read string for a data value | [
"This",
"generates",
"a",
"professional",
"easy",
"to",
"read",
"string",
"for",
"a",
"data",
"value"
] | def to_string(name: str, value: Union[float, int, bool], precision: int, dot_line: bool = False) -> str:
valString = str(round(value, precision)) if not isinstance(value, (bool, str,)) else str(value)
name = name + ":"
sep = "-" if dot_line else ""
return "|{:{sep}<{width}}{}|{}\n".format(
name,... | [
"def",
"to_string",
"(",
"name",
":",
"str",
",",
"value",
":",
"Union",
"[",
"float",
",",
"int",
",",
"bool",
"]",
",",
"precision",
":",
"int",
",",
"dot_line",
":",
"bool",
"=",
"False",
")",
"->",
"str",
":",
"valString",
"=",
"str",
"(",
"r... | This generates a professional easy to read string for a data value | [
"This",
"generates",
"a",
"professional",
"easy",
"to",
"read",
"string",
"for",
"a",
"data",
"value"
] | [
"\"\"\"This generates a professional easy to read string for a data value\n\n Args:\n name (str): Name that is to be printed with value\n value (Union[float, int, bool]): Value that is to be printed\n precision (int, optional): precision to round value to. Defaults to 4.\n dot_line (b... | [
{
"param": "name",
"type": "str"
},
{
"param": "value",
"type": "Union[float, int, bool]"
},
{
"param": "precision",
"type": "int"
},
{
"param": "dot_line",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "A formatted string with new line character on the end",
"docstring_tokens": [
"A",
"formatted",
"string",
"with",
"new",
"line",
"character",
"on",
"the",
"end"
],
"type": "str"
... |
ca9f38b3c476dbc8061c08d51d80c761e46d214f | Rigel09/CompAero | CompAero/internal.py | [
"MIT"
] | Python | named_subheader | str | def named_subheader(name: str) -> str:
"""This generates a field which has a name in it with similiar format as to to_string()
To be used in to seperate sub fields
Args:
name (str): name to print, is centered
Returns:
str: A formatted string with new line character on the end
""... | This generates a field which has a name in it with similiar format as to to_string()
To be used in to seperate sub fields
Args:
name (str): name to print, is centered
Returns:
str: A formatted string with new line character on the end
| This generates a field which has a name in it with similiar format as to to_string()
To be used in to seperate sub fields | [
"This",
"generates",
"a",
"field",
"which",
"has",
"a",
"name",
"in",
"it",
"with",
"similiar",
"format",
"as",
"to",
"to_string",
"()",
"To",
"be",
"used",
"in",
"to",
"seperate",
"sub",
"fields"
] | def named_subheader(name: str) -> str:
return "|{:=^{width}}|\n".format(" " + name + " ", width=INTERNAL_VALUE_WIDTH) | [
"def",
"named_subheader",
"(",
"name",
":",
"str",
")",
"->",
"str",
":",
"return",
"\"|{:=^{width}}|\\n\"",
".",
"format",
"(",
"\" \"",
"+",
"name",
"+",
"\" \"",
",",
"width",
"=",
"INTERNAL_VALUE_WIDTH",
")"
] | This generates a field which has a name in it with similiar format as to to_string()
To be used in to seperate sub fields | [
"This",
"generates",
"a",
"field",
"which",
"has",
"a",
"name",
"in",
"it",
"with",
"similiar",
"format",
"as",
"to",
"to_string",
"()",
"To",
"be",
"used",
"in",
"to",
"seperate",
"sub",
"fields"
] | [
"\"\"\"This generates a field which has a name in it with similiar format as to to_string()\n To be used in to seperate sub fields\n\n Args:\n name (str): name to print, is centered\n\n Returns:\n str: A formatted string with new line character on the end\n \"\"\""
] | [
{
"param": "name",
"type": "str"
}
] | {
"returns": [
{
"docstring": "A formatted string with new line character on the end",
"docstring_tokens": [
"A",
"formatted",
"string",
"with",
"new",
"line",
"character",
"on",
"the",
"end"
],
"type": "str"
... |
ca9f38b3c476dbc8061c08d51d80c761e46d214f | Rigel09/CompAero | CompAero/internal.py | [
"MIT"
] | Python | named_header | str | def named_header(name: str, value: Union[float, int], precision: int) -> str:
"""Generates a title header for the table
Args:
name (str): name to be put in header
value (Union[float, int, bool]): Value that is to be printed
precision (int, optional): precision to round value to. Default... | Generates a title header for the table
Args:
name (str): name to be put in header
value (Union[float, int, bool]): Value that is to be printed
precision (int, optional): precision to round value to. Defaults to 4.
Returns:
str: A formatted string that can be used as a header
... | Generates a title header for the table | [
"Generates",
"a",
"title",
"header",
"for",
"the",
"table"
] | def named_header(name: str, value: Union[float, int], precision: int) -> str:
return (
footer()
+ "|{:^{width}}|\n".format(
" {}: {:.{precision}f} ".format(name, round(value, precision), precision=precision),
width=INTERNAL_VALUE_WIDTH,
)
+ footer()
) | [
"def",
"named_header",
"(",
"name",
":",
"str",
",",
"value",
":",
"Union",
"[",
"float",
",",
"int",
"]",
",",
"precision",
":",
"int",
")",
"->",
"str",
":",
"return",
"(",
"footer",
"(",
")",
"+",
"\"|{:^{width}}|\\n\"",
".",
"format",
"(",
"\" {}... | Generates a title header for the table | [
"Generates",
"a",
"title",
"header",
"for",
"the",
"table"
] | [
"\"\"\"Generates a title header for the table\n\n Args:\n name (str): name to be put in header\n value (Union[float, int, bool]): Value that is to be printed\n precision (int, optional): precision to round value to. Defaults to 4.\n Returns:\n str: A formatted string that can be us... | [
{
"param": "name",
"type": "str"
},
{
"param": "value",
"type": "Union[float, int]"
},
{
"param": "precision",
"type": "int"
}
] | {
"returns": [
{
"docstring": "A formatted string that can be used as a header",
"docstring_tokens": [
"A",
"formatted",
"string",
"that",
"can",
"be",
"used",
"as",
"a",
"header"
],
"type": "str"
}
],
... |
ca9f38b3c476dbc8061c08d51d80c761e46d214f | Rigel09/CompAero | CompAero/internal.py | [
"MIT"
] | Python | footer | str | def footer() -> str:
"""Generates a formatted footer for the end of a table
Returns:
str: formatted footer
"""
return "|{:=^{width}}|\n".format("", width=INTERNAL_VALUE_WIDTH) | Generates a formatted footer for the end of a table
Returns:
str: formatted footer
| Generates a formatted footer for the end of a table | [
"Generates",
"a",
"formatted",
"footer",
"for",
"the",
"end",
"of",
"a",
"table"
] | def footer() -> str:
return "|{:=^{width}}|\n".format("", width=INTERNAL_VALUE_WIDTH) | [
"def",
"footer",
"(",
")",
"->",
"str",
":",
"return",
"\"|{:=^{width}}|\\n\"",
".",
"format",
"(",
"\"\"",
",",
"width",
"=",
"INTERNAL_VALUE_WIDTH",
")"
] | Generates a formatted footer for the end of a table | [
"Generates",
"a",
"formatted",
"footer",
"for",
"the",
"end",
"of",
"a",
"table"
] | [
"\"\"\"Generates a formatted footer for the end of a table\n\n Returns:\n str: formatted footer\n \"\"\""
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "str"
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ca9f38b3c476dbc8061c08d51d80c761e46d214f | Rigel09/CompAero | CompAero/internal.py | [
"MIT"
] | Python | checkValue | bool | def checkValue(value: Union[Union[float, int], List[Union[float, int]]]) -> bool:
""" Checks to see if value is non NAN and greater than zero"""
checkVal = True
if isinstance(value, (float, int,)):
value = [value]
if isinstance(value, list):
for val in value:
if isinstance(v... | Checks to see if value is non NAN and greater than zero | Checks to see if value is non NAN and greater than zero | [
"Checks",
"to",
"see",
"if",
"value",
"is",
"non",
"NAN",
"and",
"greater",
"than",
"zero"
] | def checkValue(value: Union[Union[float, int], List[Union[float, int]]]) -> bool:
checkVal = True
if isinstance(value, (float, int,)):
value = [value]
if isinstance(value, list):
for val in value:
if isinstance(val, (FlowState, ShockType,)):
checkVal = checkVal an... | [
"def",
"checkValue",
"(",
"value",
":",
"Union",
"[",
"Union",
"[",
"float",
",",
"int",
"]",
",",
"List",
"[",
"Union",
"[",
"float",
",",
"int",
"]",
"]",
"]",
")",
"->",
"bool",
":",
"checkVal",
"=",
"True",
"if",
"isinstance",
"(",
"value",
"... | Checks to see if value is non NAN and greater than zero | [
"Checks",
"to",
"see",
"if",
"value",
"is",
"non",
"NAN",
"and",
"greater",
"than",
"zero"
] | [
"\"\"\" Checks to see if value is non NAN and greater than zero\"\"\""
] | [
{
"param": "value",
"type": "Union[Union[float, int], List[Union[float, int]]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": "Union[Union[float, int], List[Union[float, int]]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ef43808ebf2f17b1f76c002a75418304fe3b65de | Rigel09/CompAero | CompAero/PrandtlMeyer.py | [
"MIT"
] | Python | calc_nu | float | def calc_nu(mach: float, gamma: float, offset: float = 0.0) -> float:
""" Calculates the prandtl meyer function value (nu)
Args:
mach (float): mach number of the the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for roo... | Calculates the prandtl meyer function value (nu)
Args:
mach (float): mach number of the the flow
gamma (float): ratio of specific heats
offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.
Returns:
fl... | Calculates the prandtl meyer function value (nu) | [
"Calculates",
"the",
"prandtl",
"meyer",
"function",
"value",
"(",
"nu",
")"
] | def calc_nu(mach: float, gamma: float, offset: float = 0.0) -> float:
if mach <= 1.0:
return 0.0
gp1 = gamma + 1
gm1 = gamma - 1
mSqrMinus1 = pow(mach, 2) - 1
return degrees(sqrt(gp1 / gm1) * atan(sqrt(gm1 / gp1 * mSqrMinus1)) - atan(sqrt(mSqrMinus1))) - offset | [
"def",
"calc_nu",
"(",
"mach",
":",
"float",
",",
"gamma",
":",
"float",
",",
"offset",
":",
"float",
"=",
"0.0",
")",
"->",
"float",
":",
"if",
"mach",
"<=",
"1.0",
":",
"return",
"0.0",
"gp1",
"=",
"gamma",
"+",
"1",
"gm1",
"=",
"gamma",
"-",
... | Calculates the prandtl meyer function value (nu) | [
"Calculates",
"the",
"prandtl",
"meyer",
"function",
"value",
"(",
"nu",
")"
] | [
"\"\"\" Calculates the prandtl meyer function value (nu)\n\n Args:\n mach (float): mach number of the the flow\n gamma (float): ratio of specific heats\n offset (float, optional): offset that can be used for root finding for a specific value. Defaults to 0.0.\n\n Retur... | [
{
"param": "mach",
"type": "float"
},
{
"param": "gamma",
"type": "float"
},
{
"param": "offset",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "mach",
"type": "float",
"docstring": "mach number of the the flow",
"docstring_tokens": [
"mach",
... |
ef43808ebf2f17b1f76c002a75418304fe3b65de | Rigel09/CompAero | CompAero/PrandtlMeyer.py | [
"MIT"
] | Python | calc_mach_from_nu | float | def calc_mach_from_nu(nu: float, gamma: float) -> float:
""" Calculates the mach number based on a prandtl meyer function value
Args:
nu (float): prandtl meyer function value
gamma (float): ratio of specific heats
Returns:
float: mach number
"""
... | Calculates the mach number based on a prandtl meyer function value
Args:
nu (float): prandtl meyer function value
gamma (float): ratio of specific heats
Returns:
float: mach number
| Calculates the mach number based on a prandtl meyer function value | [
"Calculates",
"the",
"mach",
"number",
"based",
"on",
"a",
"prandtl",
"meyer",
"function",
"value"
] | def calc_mach_from_nu(nu: float, gamma: float) -> float:
if nu <= 0.0:
return 1.0
return brenth(PrandtlMeyer.calc_nu, 1 + 1e-9, 30, args=(gamma, nu)) | [
"def",
"calc_mach_from_nu",
"(",
"nu",
":",
"float",
",",
"gamma",
":",
"float",
")",
"->",
"float",
":",
"if",
"nu",
"<=",
"0.0",
":",
"return",
"1.0",
"return",
"brenth",
"(",
"PrandtlMeyer",
".",
"calc_nu",
",",
"1",
"+",
"1e-9",
",",
"30",
",",
... | Calculates the mach number based on a prandtl meyer function value | [
"Calculates",
"the",
"mach",
"number",
"based",
"on",
"a",
"prandtl",
"meyer",
"function",
"value"
] | [
"\"\"\" Calculates the mach number based on a prandtl meyer function value\n\n Args:\n nu (float): prandtl meyer function value\n gamma (float): ratio of specific heats\n\n Returns:\n float: mach number\n \"\"\""
] | [
{
"param": "nu",
"type": "float"
},
{
"param": "gamma",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "float"
}
],
"raises": [],
"params": [
{
"identifier": "nu",
"type": "float",
"docstring": "prandtl meyer function value",
"docstring_tokens": [
"prandtl",
... |
e96241d04f5f7624a24deb6278a71e4d3c95188e | EdinburghGenomics/EGCG-Data-Deletion | tests/test_data_delivery.py | [
"MIT"
] | Python | _get_value | <not_specific> | def _get_value(value_template, index):
"""
Take a template and complete it with the index if the template contains %s.
If the template is an iterable (but not a string or dict) then it takes the next one and complete the template.
"""
if not (type(value_template) in [str, dict]) and isinstance(value... |
Take a template and complete it with the index if the template contains %s.
If the template is an iterable (but not a string or dict) then it takes the next one and complete the template.
| Take a template and complete it with the index if the template contains %s.
If the template is an iterable (but not a string or dict) then it takes the next one and complete the template. | [
"Take",
"a",
"template",
"and",
"complete",
"it",
"with",
"the",
"index",
"if",
"the",
"template",
"contains",
"%s",
".",
"If",
"the",
"template",
"is",
"an",
"iterable",
"(",
"but",
"not",
"a",
"string",
"or",
"dict",
")",
"then",
"it",
"takes",
"the"... | def _get_value(value_template, index):
if not (type(value_template) in [str, dict]) and isinstance(value_template, collections.Iterable):
value_template = next(value_template)
if isinstance(value_template, str) and '%s' in value_template:
return value_template % index
else:
return va... | [
"def",
"_get_value",
"(",
"value_template",
",",
"index",
")",
":",
"if",
"not",
"(",
"type",
"(",
"value_template",
")",
"in",
"[",
"str",
",",
"dict",
"]",
")",
"and",
"isinstance",
"(",
"value_template",
",",
"collections",
".",
"Iterable",
")",
":",
... | Take a template and complete it with the index if the template contains %s. | [
"Take",
"a",
"template",
"and",
"complete",
"it",
"with",
"the",
"index",
"if",
"the",
"template",
"contains",
"%s",
"."
] | [
"\"\"\"\n Take a template and complete it with the index if the template contains %s.\n If the template is an iterable (but not a string or dict) then it takes the next one and complete the template.\n \"\"\""
] | [
{
"param": "value_template",
"type": null
},
{
"param": "index",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value_template",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": null,
"docstring": null,
"docstring... |
e96241d04f5f7624a24deb6278a71e4d3c95188e | EdinburghGenomics/EGCG-Data-Deletion | tests/test_data_delivery.py | [
"MIT"
] | Python | create_fake_fastq_fastqc_md5_from_commands | null | def create_fake_fastq_fastqc_md5_from_commands(instance):
"""
This function replaces run_aggregate_commands and take an instance of DataDelivery.
It will create the output as if the command were run.
It only supports fastqc and command that redirects there outputs
"""
for commands in instance.al... |
This function replaces run_aggregate_commands and take an instance of DataDelivery.
It will create the output as if the command were run.
It only supports fastqc and command that redirects there outputs
| This function replaces run_aggregate_commands and take an instance of DataDelivery.
It will create the output as if the command were run.
It only supports fastqc and command that redirects there outputs | [
"This",
"function",
"replaces",
"run_aggregate_commands",
"and",
"take",
"an",
"instance",
"of",
"DataDelivery",
".",
"It",
"will",
"create",
"the",
"output",
"as",
"if",
"the",
"command",
"were",
"run",
".",
"It",
"only",
"supports",
"fastqc",
"and",
"command... | def create_fake_fastq_fastqc_md5_from_commands(instance):
for commands in instance.all_commands_for_cluster:
for command in commands.split(';'):
if len(command.split('>')) > 1:
output = command.split('>')[1].strip()
if output.endswith('.md5'):
... | [
"def",
"create_fake_fastq_fastqc_md5_from_commands",
"(",
"instance",
")",
":",
"for",
"commands",
"in",
"instance",
".",
"all_commands_for_cluster",
":",
"for",
"command",
"in",
"commands",
".",
"split",
"(",
"';'",
")",
":",
"if",
"len",
"(",
"command",
".",
... | This function replaces run_aggregate_commands and take an instance of DataDelivery. | [
"This",
"function",
"replaces",
"run_aggregate_commands",
"and",
"take",
"an",
"instance",
"of",
"DataDelivery",
"."
] | [
"\"\"\"\n This function replaces run_aggregate_commands and take an instance of DataDelivery.\n It will create the output as if the command were run.\n It only supports fastqc and command that redirects there outputs\n \"\"\""
] | [
{
"param": "instance",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "instance",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
40f5f1bf460b90098ce593145527008a61d27a34 | EdinburghGenomics/EGCG-Data-Deletion | project_report/utils.py | [
"MIT"
] | Python | calculate_text_size | <not_specific> | def calculate_text_size(text):
"""
Simplistic function that calculate a size of a text based on the number and type of characters.
It uses an averaged size for lower/upper-case, digits, spaces and underscores.
It also assumes that the font is using latex "scriptsize" text size.
"""
text_size = 0... |
Simplistic function that calculate a size of a text based on the number and type of characters.
It uses an averaged size for lower/upper-case, digits, spaces and underscores.
It also assumes that the font is using latex "scriptsize" text size.
| Simplistic function that calculate a size of a text based on the number and type of characters.
It uses an averaged size for lower/upper-case, digits, spaces and underscores.
It also assumes that the font is using latex "scriptsize" text size. | [
"Simplistic",
"function",
"that",
"calculate",
"a",
"size",
"of",
"a",
"text",
"based",
"on",
"the",
"number",
"and",
"type",
"of",
"characters",
".",
"It",
"uses",
"an",
"averaged",
"size",
"for",
"lower",
"/",
"upper",
"-",
"case",
"digits",
"spaces",
... | def calculate_text_size(text):
text_size = 0
for c in str(text):
if c.islower():
text_size += 13
elif c.isupper() or c.isdigit() or c == '_':
text_size += 20
elif c == ' ':
text_size += 7
else:
text_size += 12
return text_size/1... | [
"def",
"calculate_text_size",
"(",
"text",
")",
":",
"text_size",
"=",
"0",
"for",
"c",
"in",
"str",
"(",
"text",
")",
":",
"if",
"c",
".",
"islower",
"(",
")",
":",
"text_size",
"+=",
"13",
"elif",
"c",
".",
"isupper",
"(",
")",
"or",
"c",
".",
... | Simplistic function that calculate a size of a text based on the number and type of characters. | [
"Simplistic",
"function",
"that",
"calculate",
"a",
"size",
"of",
"a",
"text",
"based",
"on",
"the",
"number",
"and",
"type",
"of",
"characters",
"."
] | [
"\"\"\"\n Simplistic function that calculate a size of a text based on the number and type of characters.\n It uses an averaged size for lower/upper-case, digits, spaces and underscores.\n It also assumes that the font is using latex \"scriptsize\" text size.\n \"\"\""
] | [
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
40f5f1bf460b90098ce593145527008a61d27a34 | EdinburghGenomics/EGCG-Data-Deletion | project_report/utils.py | [
"MIT"
] | Python | estimate_columns_definition | <not_specific> | def estimate_columns_definition(rows, column_types, minimums=None, extend_to=None, separator=' '):
"""
Provided with the rows to of the tables and the latex type for the column. this estimates and provides the best fit
columns definition. It assumes that the font is using latex "scriptsize" text size.
:... |
Provided with the rows to of the tables and the latex type for the column. this estimates and provides the best fit
columns definition. It assumes that the font is using latex "scriptsize" text size.
:param rows: List of lists containing all the text to display in the columns. It assumes that all cell text... | Provided with the rows to of the tables and the latex type for the column. this estimates and provides the best fit
columns definition. It assumes that the font is using latex "scriptsize" text size. | [
"Provided",
"with",
"the",
"rows",
"to",
"of",
"the",
"tables",
"and",
"the",
"latex",
"type",
"for",
"the",
"column",
".",
"this",
"estimates",
"and",
"provides",
"the",
"best",
"fit",
"columns",
"definition",
".",
"It",
"assumes",
"that",
"the",
"font",
... | def estimate_columns_definition(rows, column_types, minimums=None, extend_to=None, separator=' '):
if not minimums:
column_sizes = [0] * len(rows[0])
else:
column_sizes = minimums.copy()
assert len(column_sizes) == len(column_types), "Inconsistent number of column in columns type and column ... | [
"def",
"estimate_columns_definition",
"(",
"rows",
",",
"column_types",
",",
"minimums",
"=",
"None",
",",
"extend_to",
"=",
"None",
",",
"separator",
"=",
"' '",
")",
":",
"if",
"not",
"minimums",
":",
"column_sizes",
"=",
"[",
"0",
"]",
"*",
"len",
"("... | Provided with the rows to of the tables and the latex type for the column. | [
"Provided",
"with",
"the",
"rows",
"to",
"of",
"the",
"tables",
"and",
"the",
"latex",
"type",
"for",
"the",
"column",
"."
] | [
"\"\"\"\n Provided with the rows to of the tables and the latex type for the column. this estimates and provides the best fit\n columns definition. It assumes that the font is using latex \"scriptsize\" text size.\n :param rows: List of lists containing all the text to display in the columns. It assumes th... | [
{
"param": "rows",
"type": null
},
{
"param": "column_types",
"type": null
},
{
"param": "minimums",
"type": null
},
{
"param": "extend_to",
"type": null
},
{
"param": "separator",
"type": null
}
] | {
"returns": [
{
"docstring": "The column definition to be used in the tabu type tables",
"docstring_tokens": [
"The",
"column",
"definition",
"to",
"be",
"used",
"in",
"the",
"tabu",
"type",
"tables"
],
... |
20a3f94e9b84abcf50afb0290173c254de8f9de7 | EdinburghGenomics/EGCG-Data-Deletion | bin/deliver_reviewed_data.py | [
"MIT"
] | Python | deliverable_samples | <not_specific> | def deliverable_samples(self):
"""Retrieve the names of samples that went through the authorisation step. Then get the data associated."""
if self.process.type.name != release_trigger_lims_step_name:
raise ValueError('Process %s is not of the type ' + release_trigger_lims_step_name)
... | Retrieve the names of samples that went through the authorisation step. Then get the data associated. | Retrieve the names of samples that went through the authorisation step. Then get the data associated. | [
"Retrieve",
"the",
"names",
"of",
"samples",
"that",
"went",
"through",
"the",
"authorisation",
"step",
".",
"Then",
"get",
"the",
"data",
"associated",
"."
] | def deliverable_samples(self):
if self.process.type.name != release_trigger_lims_step_name:
raise ValueError('Process %s is not of the type ' + release_trigger_lims_step_name)
sample_names = [a.samples[0].name for a in self.process.all_inputs(resolve=True)]
project_to_samples = defau... | [
"def",
"deliverable_samples",
"(",
"self",
")",
":",
"if",
"self",
".",
"process",
".",
"type",
".",
"name",
"!=",
"release_trigger_lims_step_name",
":",
"raise",
"ValueError",
"(",
"'Process %s is not of the type '",
"+",
"release_trigger_lims_step_name",
")",
"sampl... | Retrieve the names of samples that went through the authorisation step. | [
"Retrieve",
"the",
"names",
"of",
"samples",
"that",
"went",
"through",
"the",
"authorisation",
"step",
"."
] | [
"\"\"\"Retrieve the names of samples that went through the authorisation step. Then get the data associated.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4d0baa965f63154452dec4fffdf9332fbf9da780 | EdinburghGenomics/EGCG-Data-Deletion | data_deletion/__init__.py | [
"MIT"
] | Python | delete_data | null | def delete_data(self):
"""
The main behaviour of the Deleter
:return: None
"""
raise NotImplementedError |
The main behaviour of the Deleter
:return: None
| The main behaviour of the Deleter | [
"The",
"main",
"behaviour",
"of",
"the",
"Deleter"
] | def delete_data(self):
raise NotImplementedError | [
"def",
"delete_data",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | The main behaviour of the Deleter | [
"The",
"main",
"behaviour",
"of",
"the",
"Deleter"
] | [
"\"\"\"\n The main behaviour of the Deleter\n :return: None\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
4d0baa965f63154452dec4fffdf9332fbf9da780 | EdinburghGenomics/EGCG-Data-Deletion | data_deletion/__init__.py | [
"MIT"
] | Python | run | null | def run(self):
"""Runs self.delete_data with exception handling and notifications."""
try:
self.delete_data()
except Exception as e:
etype, value, tb = sys.exc_info()
stacktrace = ''.join(traceback.format_exception(etype, value, tb))
self.critical(... | Runs self.delete_data with exception handling and notifications. | Runs self.delete_data with exception handling and notifications. | [
"Runs",
"self",
".",
"delete_data",
"with",
"exception",
"handling",
"and",
"notifications",
"."
] | def run(self):
try:
self.delete_data()
except Exception as e:
etype, value, tb = sys.exc_info()
stacktrace = ''.join(traceback.format_exception(etype, value, tb))
self.critical('Encountered a %s exception: %s. Stacktrace below:\n%s', e.__class__.__name__, ... | [
"def",
"run",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"delete_data",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"etype",
",",
"value",
",",
"tb",
"=",
"sys",
".",
"exc_info",
"(",
")",
"stacktrace",
"=",
"''",
".",
"join",
"(",
"tra... | Runs self.delete_data with exception handling and notifications. | [
"Runs",
"self",
".",
"delete_data",
"with",
"exception",
"handling",
"and",
"notifications",
"."
] | [
"\"\"\"Runs self.delete_data with exception handling and notifications.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
466d1b9b2f016d5ae5659557023719e30511905d | EdinburghGenomics/EGCG-Data-Deletion | bin/report_runs.py | [
"MIT"
] | Python | remove_duplicate_base_on_flowcell_id | <not_specific> | def remove_duplicate_base_on_flowcell_id(list_runs):
"""
Take a list of runs and remove the duplicated run based on the flowcell id.
It will remove the oldest run when two are found based on the run date.
"""
flowcell_to_run = {}
for run_id in list_runs:
date, machine, run_number, stage_... |
Take a list of runs and remove the duplicated run based on the flowcell id.
It will remove the oldest run when two are found based on the run date.
| Take a list of runs and remove the duplicated run based on the flowcell id.
It will remove the oldest run when two are found based on the run date. | [
"Take",
"a",
"list",
"of",
"runs",
"and",
"remove",
"the",
"duplicated",
"run",
"based",
"on",
"the",
"flowcell",
"id",
".",
"It",
"will",
"remove",
"the",
"oldest",
"run",
"when",
"two",
"are",
"found",
"based",
"on",
"the",
"run",
"date",
"."
] | def remove_duplicate_base_on_flowcell_id(list_runs):
flowcell_to_run = {}
for run_id in list_runs:
date, machine, run_number, stage_flowcell = run_id.split('_')
flowcell = stage_flowcell[1:]
if flowcell not in flowcell_to_run or run_id > flowcell_to_run[flowcell]:
flowcell_to... | [
"def",
"remove_duplicate_base_on_flowcell_id",
"(",
"list_runs",
")",
":",
"flowcell_to_run",
"=",
"{",
"}",
"for",
"run_id",
"in",
"list_runs",
":",
"date",
",",
"machine",
",",
"run_number",
",",
"stage_flowcell",
"=",
"run_id",
".",
"split",
"(",
"'_'",
")"... | Take a list of runs and remove the duplicated run based on the flowcell id. | [
"Take",
"a",
"list",
"of",
"runs",
"and",
"remove",
"the",
"duplicated",
"run",
"based",
"on",
"the",
"flowcell",
"id",
"."
] | [
"\"\"\"\n Take a list of runs and remove the duplicated run based on the flowcell id.\n It will remove the oldest run when two are found based on the run date.\n \"\"\"",
"# If the run id has not been seen or if the date is newer than the previous one then keep it"
] | [
{
"param": "list_runs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "list_runs",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.