repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet._check_label | def _check_label(self, label):
"""Check to see if the label is allowed."""
if not isinstance(label, str):
label = str(label)
if label.lower() in _forbidden_labels:
raise ValueError("'{}' is forbidden to be used as a label"
.format(label))
... | python | def _check_label(self, label):
"""Check to see if the label is allowed."""
if not isinstance(label, str):
label = str(label)
if label.lower() in _forbidden_labels:
raise ValueError("'{}' is forbidden to be used as a label"
.format(label))
... | [
"def",
"_check_label",
"(",
"self",
",",
"label",
")",
":",
"if",
"not",
"isinstance",
"(",
"label",
",",
"str",
")",
":",
"label",
"=",
"str",
"(",
"label",
")",
"if",
"label",
".",
"lower",
"(",
")",
"in",
"_forbidden_labels",
":",
"raise",
"ValueE... | Check to see if the label is allowed. | [
"Check",
"to",
"see",
"if",
"the",
"label",
"is",
"allowed",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L929-L943 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.open | def open(cls, filename):
"""
Open a ParameterSet from a JSON-formatted file.
This is a constructor so should be called as:
>>> b = ParameterSet.open('test.json')
:parameter str filename: relative or full path to the file
:return: instantiated :class:`ParameterSet` obj... | python | def open(cls, filename):
"""
Open a ParameterSet from a JSON-formatted file.
This is a constructor so should be called as:
>>> b = ParameterSet.open('test.json')
:parameter str filename: relative or full path to the file
:return: instantiated :class:`ParameterSet` obj... | [
"def",
"open",
"(",
"cls",
",",
"filename",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"filename",
")",
"f",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
"if",
"_can_ujson",
":",
"# NOTE: this will not parse the unicode. Bundle.... | Open a ParameterSet from a JSON-formatted file.
This is a constructor so should be called as:
>>> b = ParameterSet.open('test.json')
:parameter str filename: relative or full path to the file
:return: instantiated :class:`ParameterSet` object | [
"Open",
"a",
"ParameterSet",
"from",
"a",
"JSON",
"-",
"formatted",
"file",
".",
"This",
"is",
"a",
"constructor",
"so",
"should",
"be",
"called",
"as",
":"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L981-L1002 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.save | def save(self, filename, incl_uniqueid=False, compact=False):
"""
Save the ParameterSet to a JSON-formatted ASCII file
:parameter str filename: relative or fullpath to the file
:parameter bool incl_uniqueid: whether to including uniqueids in the
file (only needed if its nece... | python | def save(self, filename, incl_uniqueid=False, compact=False):
"""
Save the ParameterSet to a JSON-formatted ASCII file
:parameter str filename: relative or fullpath to the file
:parameter bool incl_uniqueid: whether to including uniqueids in the
file (only needed if its nece... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"incl_uniqueid",
"=",
"False",
",",
"compact",
"=",
"False",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"filename",
")",
"f",
"=",
"open",
"(",
"filename",
",",
"'w'",
")",
... | Save the ParameterSet to a JSON-formatted ASCII file
:parameter str filename: relative or fullpath to the file
:parameter bool incl_uniqueid: whether to including uniqueids in the
file (only needed if its necessary to maintain the uniqueids when
reloading)
:parameter boo... | [
"Save",
"the",
"ParameterSet",
"to",
"a",
"JSON",
"-",
"formatted",
"ASCII",
"file"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1004-L1032 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.ui | def ui(self, client='http://localhost:4200', **kwargs):
"""
[NOT IMPLEMENTED]
The bundle must be in client mode in order to open the web-interface.
See :meth:`Bundle:as_client` to switch to client mode.
:parameter str client: URL of the running client which must be connected
... | python | def ui(self, client='http://localhost:4200', **kwargs):
"""
[NOT IMPLEMENTED]
The bundle must be in client mode in order to open the web-interface.
See :meth:`Bundle:as_client` to switch to client mode.
:parameter str client: URL of the running client which must be connected
... | [
"def",
"ui",
"(",
"self",
",",
"client",
"=",
"'http://localhost:4200'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_bundle",
"is",
"None",
"or",
"not",
"self",
".",
"_bundle",
".",
"is_client",
":",
"raise",
"ValueError",
"(",
"\"bundle must... | [NOT IMPLEMENTED]
The bundle must be in client mode in order to open the web-interface.
See :meth:`Bundle:as_client` to switch to client mode.
:parameter str client: URL of the running client which must be connected
to the same server as the bundle
:return: URL of the param... | [
"[",
"NOT",
"IMPLEMENTED",
"]"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1034-L1060 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.to_list | def to_list(self, **kwargs):
"""
Convert the :class:`ParameterSet` to a list of :class:`Parameter`s
:return: list of class:`Parameter` objects
"""
if kwargs:
return self.filter(**kwargs).to_list()
return self._params | python | def to_list(self, **kwargs):
"""
Convert the :class:`ParameterSet` to a list of :class:`Parameter`s
:return: list of class:`Parameter` objects
"""
if kwargs:
return self.filter(**kwargs).to_list()
return self._params | [
"def",
"to_list",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"return",
"self",
".",
"filter",
"(",
"*",
"*",
"kwargs",
")",
".",
"to_list",
"(",
")",
"return",
"self",
".",
"_params"
] | Convert the :class:`ParameterSet` to a list of :class:`Parameter`s
:return: list of class:`Parameter` objects | [
"Convert",
"the",
":",
"class",
":",
"ParameterSet",
"to",
"a",
"list",
"of",
":",
"class",
":",
"Parameter",
"s"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1062-L1070 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.to_list_of_dicts | def to_list_of_dicts(self, **kwargs):
"""
Convert the :class:`ParameterSet` to a list of the dictionary representation
of each :class:`Parameter`
:return: list of dicts
"""
if kwargs:
return self.filter(**kwargs).to_list_of_dicts()
return [param.to_di... | python | def to_list_of_dicts(self, **kwargs):
"""
Convert the :class:`ParameterSet` to a list of the dictionary representation
of each :class:`Parameter`
:return: list of dicts
"""
if kwargs:
return self.filter(**kwargs).to_list_of_dicts()
return [param.to_di... | [
"def",
"to_list_of_dicts",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"return",
"self",
".",
"filter",
"(",
"*",
"*",
"kwargs",
")",
".",
"to_list_of_dicts",
"(",
")",
"return",
"[",
"param",
".",
"to_dict",
"(",
")",
"for",... | Convert the :class:`ParameterSet` to a list of the dictionary representation
of each :class:`Parameter`
:return: list of dicts | [
"Convert",
"the",
":",
"class",
":",
"ParameterSet",
"to",
"a",
"list",
"of",
"the",
"dictionary",
"representation",
"of",
"each",
":",
"class",
":",
"Parameter"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1078-L1087 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.to_flat_dict | def to_flat_dict(self, **kwargs):
"""
Convert the :class:`ParameterSet` to a flat dictionary, with keys being
uniquetwigs to access the parameter and values being the :class:`Parameter`
objects themselves.
:return: dict of :class:`Parameter`s
"""
if kwargs:
... | python | def to_flat_dict(self, **kwargs):
"""
Convert the :class:`ParameterSet` to a flat dictionary, with keys being
uniquetwigs to access the parameter and values being the :class:`Parameter`
objects themselves.
:return: dict of :class:`Parameter`s
"""
if kwargs:
... | [
"def",
"to_flat_dict",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"return",
"self",
".",
"filter",
"(",
"*",
"*",
"kwargs",
")",
".",
"to_flat_dict",
"(",
")",
"return",
"{",
"param",
".",
"uniquetwig",
":",
"param",
"for",
... | Convert the :class:`ParameterSet` to a flat dictionary, with keys being
uniquetwigs to access the parameter and values being the :class:`Parameter`
objects themselves.
:return: dict of :class:`Parameter`s | [
"Convert",
"the",
":",
"class",
":",
"ParameterSet",
"to",
"a",
"flat",
"dictionary",
"with",
"keys",
"being",
"uniquetwigs",
"to",
"access",
"the",
"parameter",
"and",
"values",
"being",
"the",
":",
"class",
":",
"Parameter",
"objects",
"themselves",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1093-L1103 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.to_dict | def to_dict(self, field=None, **kwargs):
"""
Convert the ParameterSet to a structured (nested) dictionary
to allow traversing the structure from the bottom up
:parameter str field: (optional) build the dictionary with keys at
a given level/field. Can be any of the keys in
... | python | def to_dict(self, field=None, **kwargs):
"""
Convert the ParameterSet to a structured (nested) dictionary
to allow traversing the structure from the bottom up
:parameter str field: (optional) build the dictionary with keys at
a given level/field. Can be any of the keys in
... | [
"def",
"to_dict",
"(",
"self",
",",
"field",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"return",
"self",
".",
"filter",
"(",
"*",
"*",
"kwargs",
")",
".",
"to_dict",
"(",
"field",
"=",
"field",
")",
"if",
"field",
"is",... | Convert the ParameterSet to a structured (nested) dictionary
to allow traversing the structure from the bottom up
:parameter str field: (optional) build the dictionary with keys at
a given level/field. Can be any of the keys in
:func:`meta`. If None, the keys will be the lowes... | [
"Convert",
"the",
"ParameterSet",
"to",
"a",
"structured",
"(",
"nested",
")",
"dictionary",
"to",
"allow",
"traversing",
"the",
"structure",
"from",
"the",
"bottom",
"up"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1105-L1151 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.set | def set(self, key, value, **kwargs):
"""
Set the value of a Parameter in the ParameterSet.
If :func:`get` would retrieve a Parameter, this will set the
value of that parameter.
Or you can provide 'value@...' or 'default_unit@...', etc
to specify what attribute to set.
... | python | def set(self, key, value, **kwargs):
"""
Set the value of a Parameter in the ParameterSet.
If :func:`get` would retrieve a Parameter, this will set the
value of that parameter.
Or you can provide 'value@...' or 'default_unit@...', etc
to specify what attribute to set.
... | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"twig",
"=",
"key",
"method",
"=",
"None",
"twigsplit",
"=",
"re",
".",
"findall",
"(",
"r\"[\\w']+\"",
",",
"twig",
")",
"if",
"twigsplit",
"[",
"0",
"]",
"=... | Set the value of a Parameter in the ParameterSet.
If :func:`get` would retrieve a Parameter, this will set the
value of that parameter.
Or you can provide 'value@...' or 'default_unit@...', etc
to specify what attribute to set.
:parameter str key: the twig (called key here to ... | [
"Set",
"the",
"value",
"of",
"a",
"Parameter",
"in",
"the",
"ParameterSet",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1177-L1225 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.to_json | def to_json(self, incl_uniqueid=False):
"""
Convert the ParameterSet to a json-compatible dictionary
:return: list of dictionaries
"""
lst = []
for context in _contexts:
lst += [v.to_json(incl_uniqueid=incl_uniqueid)
for v in self.filter(c... | python | def to_json(self, incl_uniqueid=False):
"""
Convert the ParameterSet to a json-compatible dictionary
:return: list of dictionaries
"""
lst = []
for context in _contexts:
lst += [v.to_json(incl_uniqueid=incl_uniqueid)
for v in self.filter(c... | [
"def",
"to_json",
"(",
"self",
",",
"incl_uniqueid",
"=",
"False",
")",
":",
"lst",
"=",
"[",
"]",
"for",
"context",
"in",
"_contexts",
":",
"lst",
"+=",
"[",
"v",
".",
"to_json",
"(",
"incl_uniqueid",
"=",
"incl_uniqueid",
")",
"for",
"v",
"in",
"se... | Convert the ParameterSet to a json-compatible dictionary
:return: list of dictionaries | [
"Convert",
"the",
"ParameterSet",
"to",
"a",
"json",
"-",
"compatible",
"dictionary"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1268-L1280 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.filter | def filter(self, twig=None, check_visible=True, check_default=True, **kwargs):
"""
Filter the ParameterSet based on the meta-tags of the Parameters
and return another ParameterSet.
Because another ParameterSet is returned, these filter calls are
chainable.
>>> b.filter(... | python | def filter(self, twig=None, check_visible=True, check_default=True, **kwargs):
"""
Filter the ParameterSet based on the meta-tags of the Parameters
and return another ParameterSet.
Because another ParameterSet is returned, these filter calls are
chainable.
>>> b.filter(... | [
"def",
"filter",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"check_visible",
"=",
"True",
",",
"check_default",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'check_visible'",
"]",
"=",
"check_visible",
"kwargs",
"[",
"'check_default'",
... | Filter the ParameterSet based on the meta-tags of the Parameters
and return another ParameterSet.
Because another ParameterSet is returned, these filter calls are
chainable.
>>> b.filter(context='component').filter(component='starA')
:parameter str twig: (optional) the search ... | [
"Filter",
"the",
"ParameterSet",
"based",
"on",
"the",
"meta",
"-",
"tags",
"of",
"the",
"Parameters",
"and",
"return",
"another",
"ParameterSet",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1283-L1314 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.get | def get(self, twig=None, check_visible=True, check_default=True, **kwargs):
"""
Get a single parameter from this ParameterSet. This works exactly the
same as filter except there must be only a single result, and the Parameter
itself is returned instead of a ParameterSet.
Also s... | python | def get(self, twig=None, check_visible=True, check_default=True, **kwargs):
"""
Get a single parameter from this ParameterSet. This works exactly the
same as filter except there must be only a single result, and the Parameter
itself is returned instead of a ParameterSet.
Also s... | [
"def",
"get",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"check_visible",
"=",
"True",
",",
"check_default",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'check_visible'",
"]",
"=",
"check_visible",
"kwargs",
"[",
"'check_default'",
"... | Get a single parameter from this ParameterSet. This works exactly the
same as filter except there must be only a single result, and the Parameter
itself is returned instead of a ParameterSet.
Also see :meth:`get_parameter` (which is simply an alias of this method)
:parameter str twig:... | [
"Get",
"a",
"single",
"parameter",
"from",
"this",
"ParameterSet",
".",
"This",
"works",
"exactly",
"the",
"same",
"as",
"filter",
"except",
"there",
"must",
"be",
"only",
"a",
"single",
"result",
"and",
"the",
"Parameter",
"itself",
"is",
"returned",
"inste... | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1316-L1357 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.exclude | def exclude(self, twig=None, check_visible=True, **kwargs):
"""
Exclude the results from this filter from the current ParameterSet.
See :meth:`filter` for options.
"""
return self - self.filter(twig=twig,
check_visible=check_visible,
... | python | def exclude(self, twig=None, check_visible=True, **kwargs):
"""
Exclude the results from this filter from the current ParameterSet.
See :meth:`filter` for options.
"""
return self - self.filter(twig=twig,
check_visible=check_visible,
... | [
"def",
"exclude",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"check_visible",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
"-",
"self",
".",
"filter",
"(",
"twig",
"=",
"twig",
",",
"check_visible",
"=",
"check_visible",
",",
"*... | Exclude the results from this filter from the current ParameterSet.
See :meth:`filter` for options. | [
"Exclude",
"the",
"results",
"from",
"this",
"filter",
"from",
"the",
"current",
"ParameterSet",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1576-L1584 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.get_or_create | def get_or_create(self, qualifier, new_parameter, **kwargs):
"""
Get a :class:`Parameter` from the ParameterSet, if it does not exist,
create and attach it.
Note: running this on a ParameterSet that is NOT a
:class:`phoebe.frontend.bundle.Bundle`,
will NOT add the Parame... | python | def get_or_create(self, qualifier, new_parameter, **kwargs):
"""
Get a :class:`Parameter` from the ParameterSet, if it does not exist,
create and attach it.
Note: running this on a ParameterSet that is NOT a
:class:`phoebe.frontend.bundle.Bundle`,
will NOT add the Parame... | [
"def",
"get_or_create",
"(",
"self",
",",
"qualifier",
",",
"new_parameter",
",",
"*",
"*",
"kwargs",
")",
":",
"ps",
"=",
"self",
".",
"filter_or_get",
"(",
"qualifier",
"=",
"qualifier",
",",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"ps",
",... | Get a :class:`Parameter` from the ParameterSet, if it does not exist,
create and attach it.
Note: running this on a ParameterSet that is NOT a
:class:`phoebe.frontend.bundle.Bundle`,
will NOT add the Parameter to the bundle, but only the temporary
ParameterSet
:paramete... | [
"Get",
"a",
":",
"class",
":",
"Parameter",
"from",
"the",
"ParameterSet",
"if",
"it",
"does",
"not",
"exist",
"create",
"and",
"attach",
"it",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1608-L1641 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet._remove_parameter | def _remove_parameter(self, param):
"""
Remove a Parameter from the ParameterSet
:parameter param: the :class:`Parameter` object to be removed
:type param: :class:`Parameter`
"""
# TODO: check to see if protected (required by a current constraint or
# by a backen... | python | def _remove_parameter(self, param):
"""
Remove a Parameter from the ParameterSet
:parameter param: the :class:`Parameter` object to be removed
:type param: :class:`Parameter`
"""
# TODO: check to see if protected (required by a current constraint or
# by a backen... | [
"def",
"_remove_parameter",
"(",
"self",
",",
"param",
")",
":",
"# TODO: check to see if protected (required by a current constraint or",
"# by a backend)",
"self",
".",
"_params",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"_params",
"if",
"p",
"!=",
"param",
... | Remove a Parameter from the ParameterSet
:parameter param: the :class:`Parameter` object to be removed
:type param: :class:`Parameter` | [
"Remove",
"a",
"Parameter",
"from",
"the",
"ParameterSet"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1643-L1652 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.remove_parameter | def remove_parameter(self, twig=None, **kwargs):
"""
Remove a :class:`Parameter` from the ParameterSet
Note: removing Parameters from a ParameterSet will not remove
them from any parent ParameterSets
(including the :class:`phoebe.frontend.bundle.Bundle`)
:parameter str ... | python | def remove_parameter(self, twig=None, **kwargs):
"""
Remove a :class:`Parameter` from the ParameterSet
Note: removing Parameters from a ParameterSet will not remove
them from any parent ParameterSets
(including the :class:`phoebe.frontend.bundle.Bundle`)
:parameter str ... | [
"def",
"remove_parameter",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"param",
"=",
"self",
".",
"get",
"(",
"twig",
"=",
"twig",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_remove_parameter",
"(",
"param",
")"
] | Remove a :class:`Parameter` from the ParameterSet
Note: removing Parameters from a ParameterSet will not remove
them from any parent ParameterSets
(including the :class:`phoebe.frontend.bundle.Bundle`)
:parameter str twig: the twig to search for the parameter
:parameter **kwarg... | [
"Remove",
"a",
":",
"class",
":",
"Parameter",
"from",
"the",
"ParameterSet"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1654-L1669 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.remove_parameters_all | def remove_parameters_all(self, twig=None, **kwargs):
"""
Remove all :class:`Parameter`s that match the search from the
ParameterSet.
Any Parameter that would be included in the resulting ParameterSet
from a :func:`filter` call with the same arguments will be
removed fro... | python | def remove_parameters_all(self, twig=None, **kwargs):
"""
Remove all :class:`Parameter`s that match the search from the
ParameterSet.
Any Parameter that would be included in the resulting ParameterSet
from a :func:`filter` call with the same arguments will be
removed fro... | [
"def",
"remove_parameters_all",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"self",
".",
"filter",
"(",
"twig",
"=",
"twig",
",",
"check_visible",
"=",
"False",
",",
"check_default",
"=",
"False",
",",
"*",
... | Remove all :class:`Parameter`s that match the search from the
ParameterSet.
Any Parameter that would be included in the resulting ParameterSet
from a :func:`filter` call with the same arguments will be
removed from this ParameterSet.
Note: removing Parameters from a ParameterSe... | [
"Remove",
"all",
":",
"class",
":",
"Parameter",
"s",
"that",
"match",
"the",
"search",
"from",
"the",
"ParameterSet",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1671-L1690 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.get_quantity | def get_quantity(self, twig=None, unit=None,
default=None, t=None, **kwargs):
"""
TODO: add documentation
"""
# TODO: for time derivatives will need to use t instead of time (time
# gets passed to twig filtering)
if default is not None is not None:
... | python | def get_quantity(self, twig=None, unit=None,
default=None, t=None, **kwargs):
"""
TODO: add documentation
"""
# TODO: for time derivatives will need to use t instead of time (time
# gets passed to twig filtering)
if default is not None is not None:
... | [
"def",
"get_quantity",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"unit",
"=",
"None",
",",
"default",
"=",
"None",
",",
"t",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: for time derivatives will need to use t instead of time (time",
"# gets passed... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1692-L1713 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.set_quantity | def set_quantity(self, twig=None, value=None, **kwargs):
"""
TODO: add documentation
"""
# TODO: handle twig having parameter key (value@, default_unit@, adjust@, etc)
# TODO: does this return anything (update the docstring)?
return self.get_parameter(twig=twig, **kwargs)... | python | def set_quantity(self, twig=None, value=None, **kwargs):
"""
TODO: add documentation
"""
# TODO: handle twig having parameter key (value@, default_unit@, adjust@, etc)
# TODO: does this return anything (update the docstring)?
return self.get_parameter(twig=twig, **kwargs)... | [
"def",
"set_quantity",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: handle twig having parameter key (value@, default_unit@, adjust@, etc)",
"# TODO: does this return anything (update the docstring)?",
"return",... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1715-L1721 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.get_value | def get_value(self, twig=None, unit=None, default=None, t=None, **kwargs):
"""
Get the value of a :class:`Parameter` in this ParameterSet
:parameter str twig: the twig to search for the parameter
:parameter unit: units for the returned result (if
applicable). If None or not... | python | def get_value(self, twig=None, unit=None, default=None, t=None, **kwargs):
"""
Get the value of a :class:`Parameter` in this ParameterSet
:parameter str twig: the twig to search for the parameter
:parameter unit: units for the returned result (if
applicable). If None or not... | [
"def",
"get_value",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"unit",
"=",
"None",
",",
"default",
"=",
"None",
",",
"t",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: for time derivatives will need to use t instead of time (time",
"# gets passed to... | Get the value of a :class:`Parameter` in this ParameterSet
:parameter str twig: the twig to search for the parameter
:parameter unit: units for the returned result (if
applicable). If None or not provided, the value will
be returned in that Parameter's default_unit (if
... | [
"Get",
"the",
"value",
"of",
"a",
":",
"class",
":",
"Parameter",
"in",
"this",
"ParameterSet"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1723-L1759 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.set_value | def set_value(self, twig=None, value=None, **kwargs):
"""
Set the value of a :class:`Parameter` in this ParameterSet
Note: setting the value of a Parameter in a ParameterSet WILL
change that Parameter across any parent ParameterSets (including
the :class:`phoebe.frontend.bundle.... | python | def set_value(self, twig=None, value=None, **kwargs):
"""
Set the value of a :class:`Parameter` in this ParameterSet
Note: setting the value of a Parameter in a ParameterSet WILL
change that Parameter across any parent ParameterSets (including
the :class:`phoebe.frontend.bundle.... | [
"def",
"set_value",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: handle twig having parameter key (value@, default_unit@, adjust@, etc)",
"# TODO: does this return anything (update the docstring)?",
"if",
"twi... | Set the value of a :class:`Parameter` in this ParameterSet
Note: setting the value of a Parameter in a ParameterSet WILL
change that Parameter across any parent ParameterSets (including
the :class:`phoebe.frontend.bundle.Bundle`)
:parameter set twig: the twig to search for the paramete... | [
"Set",
"the",
"value",
"of",
"a",
":",
"class",
":",
"Parameter",
"in",
"this",
"ParameterSet"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1761-L1818 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.set_value_all | def set_value_all(self, twig=None, value=None, check_default=False, **kwargs):
"""
Set the value of all returned :class:`Parameter`s in this ParameterSet.
Any :class:`Parameter` that would be included in the resulting ParameterSet
from a :func:`filter` call with the same arguments will ... | python | def set_value_all(self, twig=None, value=None, check_default=False, **kwargs):
"""
Set the value of all returned :class:`Parameter`s in this ParameterSet.
Any :class:`Parameter` that would be included in the resulting ParameterSet
from a :func:`filter` call with the same arguments will ... | [
"def",
"set_value_all",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"value",
"=",
"None",
",",
"check_default",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"twig",
"is",
"not",
"None",
"and",
"value",
"is",
"None",
":",
"# then try to suppor... | Set the value of all returned :class:`Parameter`s in this ParameterSet.
Any :class:`Parameter` that would be included in the resulting ParameterSet
from a :func:`filter` call with the same arguments will have
their value set.
Note: setting the value of a Parameter in a ParameterSet WIL... | [
"Set",
"the",
"value",
"of",
"all",
"returned",
":",
"class",
":",
"Parameter",
"s",
"in",
"this",
"ParameterSet",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1820-L1863 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.get_default_unit | def get_default_unit(self, twig=None, **kwargs):
"""
TODO: add documentation
"""
return self.get_parameter(twig=twig, **kwargs).get_default_unit() | python | def get_default_unit(self, twig=None, **kwargs):
"""
TODO: add documentation
"""
return self.get_parameter(twig=twig, **kwargs).get_default_unit() | [
"def",
"get_default_unit",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"get_parameter",
"(",
"twig",
"=",
"twig",
",",
"*",
"*",
"kwargs",
")",
".",
"get_default_unit",
"(",
")"
] | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1865-L1869 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.set_default_unit | def set_default_unit(self, twig=None, unit=None, **kwargs):
"""
TODO: add documentation
"""
if twig is not None and unit is None:
# then try to support value as the first argument if no matches with twigs
if isinstance(unit, u.Unit) or not isinstance(twig, str):
... | python | def set_default_unit(self, twig=None, unit=None, **kwargs):
"""
TODO: add documentation
"""
if twig is not None and unit is None:
# then try to support value as the first argument if no matches with twigs
if isinstance(unit, u.Unit) or not isinstance(twig, str):
... | [
"def",
"set_default_unit",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"unit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"twig",
"is",
"not",
"None",
"and",
"unit",
"is",
"None",
":",
"# then try to support value as the first argument if no matches... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1871-L1885 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.set_default_unit_all | def set_default_unit_all(self, twig=None, unit=None, **kwargs):
"""
TODO: add documentation
"""
if twig is not None and unit is None:
# then try to support value as the first argument if no matches with twigs
if isinstance(unit, u.Unit) or not isinstance(twig, str... | python | def set_default_unit_all(self, twig=None, unit=None, **kwargs):
"""
TODO: add documentation
"""
if twig is not None and unit is None:
# then try to support value as the first argument if no matches with twigs
if isinstance(unit, u.Unit) or not isinstance(twig, str... | [
"def",
"set_default_unit_all",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"unit",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"twig",
"is",
"not",
"None",
"and",
"unit",
"is",
"None",
":",
"# then try to support value as the first argument if no mat... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1887-L1902 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.get_description | def get_description(self, twig=None, **kwargs):
"""
TODO: add documentation
"""
return self.get_parameter(twig=twig, **kwargs).get_description() | python | def get_description(self, twig=None, **kwargs):
"""
TODO: add documentation
"""
return self.get_parameter(twig=twig, **kwargs).get_description() | [
"def",
"get_description",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"get_parameter",
"(",
"twig",
"=",
"twig",
",",
"*",
"*",
"kwargs",
")",
".",
"get_description",
"(",
")"
] | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1944-L1948 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.plot | def plot(self, twig=None, **kwargs):
"""
High-level wrapper around matplotlib (by default, but also has some support
for other plotting backends). This function smartly makes one
or multiple calls to the plotting backend based on the type of data.
Individual lines are each give... | python | def plot(self, twig=None, **kwargs):
"""
High-level wrapper around matplotlib (by default, but also has some support
for other plotting backends). This function smartly makes one
or multiple calls to the plotting backend based on the type of data.
Individual lines are each give... | [
"def",
"plot",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"_use_autofig",
":",
"if",
"os",
".",
"getenv",
"(",
"'PHOEBE_ENABLE_PLOTTING'",
",",
"'TRUE'",
")",
".",
"upper",
"(",
")",
"!=",
"'TRUE'",
":",
... | High-level wrapper around matplotlib (by default, but also has some support
for other plotting backends). This function smartly makes one
or multiple calls to the plotting backend based on the type of data.
Individual lines are each given a label (automatic if not provided),
to see the... | [
"High",
"-",
"level",
"wrapper",
"around",
"matplotlib",
"(",
"by",
"default",
"but",
"also",
"has",
"some",
"support",
"for",
"other",
"plotting",
"backends",
")",
".",
"This",
"function",
"smartly",
"makes",
"one",
"or",
"multiple",
"calls",
"to",
"the",
... | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2534-L2708 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet._show_or_save | def _show_or_save(self, save, show, animate,
draw_sidebars=True,
draw_title=True,
tight_layout=False,
subplot_grid=None,
**kwargs):
"""
Draw/animate and show and/or save a autofig plot
"... | python | def _show_or_save(self, save, show, animate,
draw_sidebars=True,
draw_title=True,
tight_layout=False,
subplot_grid=None,
**kwargs):
"""
Draw/animate and show and/or save a autofig plot
"... | [
"def",
"_show_or_save",
"(",
"self",
",",
"save",
",",
"show",
",",
"animate",
",",
"draw_sidebars",
"=",
"True",
",",
"draw_title",
"=",
"True",
",",
"tight_layout",
"=",
"False",
",",
"subplot_grid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"i... | Draw/animate and show and/or save a autofig plot | [
"Draw",
"/",
"animate",
"and",
"show",
"and",
"/",
"or",
"save",
"a",
"autofig",
"plot"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2710-L2780 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.show | def show(self, **kwargs):
"""
Draw and show the plot.
"""
kwargs.setdefault('show', True)
kwargs.setdefault('save', False)
kwargs.setdefault('animate', False)
return self._show_or_save(**kwargs) | python | def show(self, **kwargs):
"""
Draw and show the plot.
"""
kwargs.setdefault('show', True)
kwargs.setdefault('save', False)
kwargs.setdefault('animate', False)
return self._show_or_save(**kwargs) | [
"def",
"show",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'show'",
",",
"True",
")",
"kwargs",
".",
"setdefault",
"(",
"'save'",
",",
"False",
")",
"kwargs",
".",
"setdefault",
"(",
"'animate'",
",",
"False",
"... | Draw and show the plot. | [
"Draw",
"and",
"show",
"the",
"plot",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2783-L2790 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.savefig | def savefig(self, filename, **kwargs):
"""
Draw and save the plot.
:parameter str filename: filename to save to. Be careful of extensions here...
matplotlib accepts many different image formats while other
backends will only export to html.
"""
f... | python | def savefig(self, filename, **kwargs):
"""
Draw and save the plot.
:parameter str filename: filename to save to. Be careful of extensions here...
matplotlib accepts many different image formats while other
backends will only export to html.
"""
f... | [
"def",
"savefig",
"(",
"self",
",",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"filename",
")",
"kwargs",
".",
"setdefault",
"(",
"'show'",
",",
"False",
")",
"kwargs",
".",
"setdefault",
... | Draw and save the plot.
:parameter str filename: filename to save to. Be careful of extensions here...
matplotlib accepts many different image formats while other
backends will only export to html. | [
"Draw",
"and",
"save",
"the",
"plot",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2792-L2804 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.copy | def copy(self):
"""
Deepcopy the parameter (with a new uniqueid). All other tags will remain
the same... so some other tag should be changed before attaching back to
a ParameterSet or Bundle.
:return: the copied :class:`Parameter` object
"""
s = self.to_json()
... | python | def copy(self):
"""
Deepcopy the parameter (with a new uniqueid). All other tags will remain
the same... so some other tag should be changed before attaching back to
a ParameterSet or Bundle.
:return: the copied :class:`Parameter` object
"""
s = self.to_json()
... | [
"def",
"copy",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"to_json",
"(",
")",
"cpy",
"=",
"parameter_from_json",
"(",
"s",
")",
"# TODO: may need to subclass for Parameters that require bundle by using this line instead:",
"# cpy = parameter_from_json(s, bundle=self._bund... | Deepcopy the parameter (with a new uniqueid). All other tags will remain
the same... so some other tag should be changed before attaching back to
a ParameterSet or Bundle.
:return: the copied :class:`Parameter` object | [
"Deepcopy",
"the",
"parameter",
"(",
"with",
"a",
"new",
"uniqueid",
")",
".",
"All",
"other",
"tags",
"will",
"remain",
"the",
"same",
"...",
"so",
"some",
"other",
"tag",
"should",
"be",
"changed",
"before",
"attaching",
"back",
"to",
"a",
"ParameterSet"... | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2974-L2987 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.to_string_short | def to_string_short(self):
"""
see also :meth:`to_string`
:return: a shorter abreviated string reprentation of the parameter
"""
if hasattr(self, 'constrained_by') and len(self.constrained_by) > 0:
return "* {:>30}: {}".format(self.uniquetwig_trunc, self.get_quantity... | python | def to_string_short(self):
"""
see also :meth:`to_string`
:return: a shorter abreviated string reprentation of the parameter
"""
if hasattr(self, 'constrained_by') and len(self.constrained_by) > 0:
return "* {:>30}: {}".format(self.uniquetwig_trunc, self.get_quantity... | [
"def",
"to_string_short",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'constrained_by'",
")",
"and",
"len",
"(",
"self",
".",
"constrained_by",
")",
">",
"0",
":",
"return",
"\"* {:>30}: {}\"",
".",
"format",
"(",
"self",
".",
"uniquetwig_tr... | see also :meth:`to_string`
:return: a shorter abreviated string reprentation of the parameter | [
"see",
"also",
":",
"meth",
":",
"to_string"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2997-L3006 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.save | def save(self, filename, incl_uniqueid=False):
"""
Save the Parameter to a JSON-formatted ASCII file
:parameter str filename: relative or fullpath to the file
:return: filename
:rtype: str
"""
filename = os.path.expanduser(filename)
f = open(filename, 'w'... | python | def save(self, filename, incl_uniqueid=False):
"""
Save the Parameter to a JSON-formatted ASCII file
:parameter str filename: relative or fullpath to the file
:return: filename
:rtype: str
"""
filename = os.path.expanduser(filename)
f = open(filename, 'w'... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"incl_uniqueid",
"=",
"False",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"filename",
")",
"f",
"=",
"open",
"(",
"filename",
",",
"'w'",
")",
"json",
".",
"dump",
"(",
"s... | Save the Parameter to a JSON-formatted ASCII file
:parameter str filename: relative or fullpath to the file
:return: filename
:rtype: str | [
"Save",
"the",
"Parameter",
"to",
"a",
"JSON",
"-",
"formatted",
"ASCII",
"file"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3053-L3067 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.to_json | def to_json(self, incl_uniqueid=False):
"""
:return: a JSON-ready dictionary holding all information for this
parameter
"""
def _parse(k, v):
"""
"""
if k=='value':
if isinstance(self._value, nparray.ndarray):
... | python | def to_json(self, incl_uniqueid=False):
"""
:return: a JSON-ready dictionary holding all information for this
parameter
"""
def _parse(k, v):
"""
"""
if k=='value':
if isinstance(self._value, nparray.ndarray):
... | [
"def",
"to_json",
"(",
"self",
",",
"incl_uniqueid",
"=",
"False",
")",
":",
"def",
"_parse",
"(",
"k",
",",
"v",
")",
":",
"\"\"\"\n \"\"\"",
"if",
"k",
"==",
"'value'",
":",
"if",
"isinstance",
"(",
"self",
".",
"_value",
",",
"nparray",
"... | :return: a JSON-ready dictionary holding all information for this
parameter | [
":",
"return",
":",
"a",
"JSON",
"-",
"ready",
"dictionary",
"holding",
"all",
"information",
"for",
"this",
"parameter"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3069-L3106 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.get_meta | def get_meta(self, ignore=['uniqueid']):
"""
See all the meta-tag properties for this Parameter
:parameter list ignore: list of keys to exclude from the returned
dictionary
:return: an ordered dictionary of tag properties
"""
return OrderedDict([(k, getattr(s... | python | def get_meta(self, ignore=['uniqueid']):
"""
See all the meta-tag properties for this Parameter
:parameter list ignore: list of keys to exclude from the returned
dictionary
:return: an ordered dictionary of tag properties
"""
return OrderedDict([(k, getattr(s... | [
"def",
"get_meta",
"(",
"self",
",",
"ignore",
"=",
"[",
"'uniqueid'",
"]",
")",
":",
"return",
"OrderedDict",
"(",
"[",
"(",
"k",
",",
"getattr",
"(",
"self",
",",
"k",
")",
")",
"for",
"k",
"in",
"_meta_fields_all",
"if",
"k",
"not",
"in",
"ignor... | See all the meta-tag properties for this Parameter
:parameter list ignore: list of keys to exclude from the returned
dictionary
:return: an ordered dictionary of tag properties | [
"See",
"all",
"the",
"meta",
"-",
"tag",
"properties",
"for",
"this",
"Parameter"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3130-L3138 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.uniquetwig | def uniquetwig(self, ps=None):
"""
see also :meth:`twig`
Determine the shortest (more-or-less) twig which will point
to this single Parameter in a given parent :class:`ParameterSet`
:parameter ps: :class:`ParameterSet` in which the returned
uniquetwig will point to ... | python | def uniquetwig(self, ps=None):
"""
see also :meth:`twig`
Determine the shortest (more-or-less) twig which will point
to this single Parameter in a given parent :class:`ParameterSet`
:parameter ps: :class:`ParameterSet` in which the returned
uniquetwig will point to ... | [
"def",
"uniquetwig",
"(",
"self",
",",
"ps",
"=",
"None",
")",
":",
"if",
"ps",
"is",
"None",
":",
"ps",
"=",
"self",
".",
"_bundle",
"if",
"ps",
"is",
"None",
":",
"return",
"self",
".",
"twig",
"return",
"ps",
".",
"_uniquetwig",
"(",
"self",
"... | see also :meth:`twig`
Determine the shortest (more-or-less) twig which will point
to this single Parameter in a given parent :class:`ParameterSet`
:parameter ps: :class:`ParameterSet` in which the returned
uniquetwig will point to this Parameter. If not provided
or Non... | [
"see",
"also",
":",
"meth",
":",
"twig"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3265-L3284 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.twig | def twig(self):
"""
The twig of a Parameter is a single string with the individual
:meth:`meta` tags separated by '@' symbols. This twig gives
a single string which can point back to this Parameter.
see also :meth:`uniquetwig`
:return: twig (full) of this Parameter
... | python | def twig(self):
"""
The twig of a Parameter is a single string with the individual
:meth:`meta` tags separated by '@' symbols. This twig gives
a single string which can point back to this Parameter.
see also :meth:`uniquetwig`
:return: twig (full) of this Parameter
... | [
"def",
"twig",
"(",
"self",
")",
":",
"return",
"\"@\"",
".",
"join",
"(",
"[",
"getattr",
"(",
"self",
",",
"k",
")",
"for",
"k",
"in",
"_meta_fields_twig",
"if",
"getattr",
"(",
"self",
",",
"k",
")",
"is",
"not",
"None",
"]",
")"
] | The twig of a Parameter is a single string with the individual
:meth:`meta` tags separated by '@' symbols. This twig gives
a single string which can point back to this Parameter.
see also :meth:`uniquetwig`
:return: twig (full) of this Parameter | [
"The",
"twig",
"of",
"a",
"Parameter",
"is",
"a",
"single",
"string",
"with",
"the",
"individual",
":",
"meth",
":",
"meta",
"tags",
"separated",
"by",
"@",
"symbols",
".",
"This",
"twig",
"gives",
"a",
"single",
"string",
"which",
"can",
"point",
"back"... | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3287-L3297 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.is_visible | def is_visible(self):
"""
see also :meth:`visible_if`
:return: whether this parameter is currently visible (and
therefore shown in ParameterSets and visible to :meth:`ParameterSet.filter`)
:rtype: bool
"""
def is_visible_single(visible_if):
# visi... | python | def is_visible(self):
"""
see also :meth:`visible_if`
:return: whether this parameter is currently visible (and
therefore shown in ParameterSets and visible to :meth:`ParameterSet.filter`)
:rtype: bool
"""
def is_visible_single(visible_if):
# visi... | [
"def",
"is_visible",
"(",
"self",
")",
":",
"def",
"is_visible_single",
"(",
"visible_if",
")",
":",
"# visible_if syntax: [ignore,these]qualifier:value",
"if",
"visible_if",
".",
"lower",
"(",
")",
"==",
"'false'",
":",
"return",
"False",
"# otherwise we need to find... | see also :meth:`visible_if`
:return: whether this parameter is currently visible (and
therefore shown in ParameterSets and visible to :meth:`ParameterSet.filter`)
:rtype: bool | [
"see",
"also",
":",
"meth",
":",
"visible_if"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3307-L3395 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.get_parent_ps | def get_parent_ps(self):
"""
Return a :class:`ParameterSet` of all Parameters in the same
:class:`phoebe.frontend.bundle.Bundle` which share the same
meta-tags (except qualifier, twig, uniquetwig)
:return: the parent :class:`ParameterSet`
"""
if self._bundle is N... | python | def get_parent_ps(self):
"""
Return a :class:`ParameterSet` of all Parameters in the same
:class:`phoebe.frontend.bundle.Bundle` which share the same
meta-tags (except qualifier, twig, uniquetwig)
:return: the parent :class:`ParameterSet`
"""
if self._bundle is N... | [
"def",
"get_parent_ps",
"(",
"self",
")",
":",
"if",
"self",
".",
"_bundle",
"is",
"None",
":",
"return",
"None",
"metawargs",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"meta",
".",
"items",
"(",
")",
"if",
"k",
"not",
"... | Return a :class:`ParameterSet` of all Parameters in the same
:class:`phoebe.frontend.bundle.Bundle` which share the same
meta-tags (except qualifier, twig, uniquetwig)
:return: the parent :class:`ParameterSet` | [
"Return",
"a",
":",
"class",
":",
"ParameterSet",
"of",
"all",
"Parameters",
"in",
"the",
"same",
":",
"class",
":",
"phoebe",
".",
"frontend",
".",
"bundle",
".",
"Bundle",
"which",
"share",
"the",
"same",
"meta",
"-",
"tags",
"(",
"except",
"qualifier"... | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3447-L3460 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | Parameter.get_value | def get_value(self, *args, **kwargs):
"""
This method should be overriden by any subclass of Parameter, and should
be decorated with the @update_if_client decorator.
Please see the individual classes documentation:
* :meth:`FloatParameter.get_value`
* :meth:`Arra... | python | def get_value(self, *args, **kwargs):
"""
This method should be overriden by any subclass of Parameter, and should
be decorated with the @update_if_client decorator.
Please see the individual classes documentation:
* :meth:`FloatParameter.get_value`
* :meth:`Arra... | [
"def",
"get_value",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"qualifier",
"in",
"kwargs",
".",
"keys",
"(",
")",
":",
"# then we have an \"override\" value that was passed, and we should",
"# just return that.",
"# Examp... | This method should be overriden by any subclass of Parameter, and should
be decorated with the @update_if_client decorator.
Please see the individual classes documentation:
* :meth:`FloatParameter.get_value`
* :meth:`ArrayParameter.get_value`
* :meth:`HierarchyParame... | [
"This",
"method",
"should",
"be",
"overriden",
"by",
"any",
"subclass",
"of",
"Parameter",
"and",
"should",
"be",
"decorated",
"with",
"the",
"@update_if_client",
"decorator",
".",
"Please",
"see",
"the",
"individual",
"classes",
"documentation",
":"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3600-L3627 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | SelectParameter.expand_value | def expand_value(self, **kwargs):
"""
expand the selection to account for wildcards
"""
selection = []
for v in self.get_value(**kwargs):
for choice in self.choices:
if v==choice and choice not in selection:
selection.append(choice)... | python | def expand_value(self, **kwargs):
"""
expand the selection to account for wildcards
"""
selection = []
for v in self.get_value(**kwargs):
for choice in self.choices:
if v==choice and choice not in selection:
selection.append(choice)... | [
"def",
"expand_value",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"selection",
"=",
"[",
"]",
"for",
"v",
"in",
"self",
".",
"get_value",
"(",
"*",
"*",
"kwargs",
")",
":",
"for",
"choice",
"in",
"self",
".",
"choices",
":",
"if",
"v",
"==",... | expand the selection to account for wildcards | [
"expand",
"the",
"selection",
"to",
"account",
"for",
"wildcards"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3882-L3894 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | SelectParameter.remove_not_valid_selections | def remove_not_valid_selections(self):
"""
update the value to remove any that are (no longer) valid
"""
value = [v for v in self.get_value() if self.valid_selection(v)]
self.set_value(value) | python | def remove_not_valid_selections(self):
"""
update the value to remove any that are (no longer) valid
"""
value = [v for v in self.get_value() if self.valid_selection(v)]
self.set_value(value) | [
"def",
"remove_not_valid_selections",
"(",
"self",
")",
":",
"value",
"=",
"[",
"v",
"for",
"v",
"in",
"self",
".",
"get_value",
"(",
")",
"if",
"self",
".",
"valid_selection",
"(",
"v",
")",
"]",
"self",
".",
"set_value",
"(",
"value",
")"
] | update the value to remove any that are (no longer) valid | [
"update",
"the",
"value",
"to",
"remove",
"any",
"that",
"are",
"(",
"no",
"longer",
")",
"valid"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3935-L3940 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | IntParameter.within_limits | def within_limits(self, value):
"""
check whether a value falls within the set limits
:parameter value: float or Quantity to test. If value is a float, it is
assumed that it has the same units as default_units
"""
return (self.limits[0] is None or value >= self.lim... | python | def within_limits(self, value):
"""
check whether a value falls within the set limits
:parameter value: float or Quantity to test. If value is a float, it is
assumed that it has the same units as default_units
"""
return (self.limits[0] is None or value >= self.lim... | [
"def",
"within_limits",
"(",
"self",
",",
"value",
")",
":",
"return",
"(",
"self",
".",
"limits",
"[",
"0",
"]",
"is",
"None",
"or",
"value",
">=",
"self",
".",
"limits",
"[",
"0",
"]",
")",
"and",
"(",
"self",
".",
"limits",
"[",
"1",
"]",
"i... | check whether a value falls within the set limits
:parameter value: float or Quantity to test. If value is a float, it is
assumed that it has the same units as default_units | [
"check",
"whether",
"a",
"value",
"falls",
"within",
"the",
"set",
"limits"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4074-L4082 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatParameter.within_limits | def within_limits(self, value):
"""
check whether a value falls within the set limits
:parameter value: float or Quantity to test. If value is a float, it is
assumed that it has the same units as default_units
"""
if isinstance(value, int) or isinstance(value, floa... | python | def within_limits(self, value):
"""
check whether a value falls within the set limits
:parameter value: float or Quantity to test. If value is a float, it is
assumed that it has the same units as default_units
"""
if isinstance(value, int) or isinstance(value, floa... | [
"def",
"within_limits",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"int",
")",
"or",
"isinstance",
"(",
"value",
",",
"float",
")",
":",
"value",
"=",
"value",
"*",
"self",
".",
"default_unit",
"return",
"(",
"self",
... | check whether a value falls within the set limits
:parameter value: float or Quantity to test. If value is a float, it is
assumed that it has the same units as default_units | [
"check",
"whether",
"a",
"value",
"falls",
"within",
"the",
"set",
"limits"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4214-L4225 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatParameter.is_constraint | def is_constraint(self):
"""
returns the expression of the constraint that constrains this parameter
"""
if self._is_constraint is None:
return None
return self._bundle.get_parameter(context='constraint', uniqueid=self._is_constraint) | python | def is_constraint(self):
"""
returns the expression of the constraint that constrains this parameter
"""
if self._is_constraint is None:
return None
return self._bundle.get_parameter(context='constraint', uniqueid=self._is_constraint) | [
"def",
"is_constraint",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_constraint",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_bundle",
".",
"get_parameter",
"(",
"context",
"=",
"'constraint'",
",",
"uniqueid",
"=",
"self",
".",
"_is_co... | returns the expression of the constraint that constrains this parameter | [
"returns",
"the",
"expression",
"of",
"the",
"constraint",
"that",
"constrains",
"this",
"parameter"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4479-L4485 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatParameter.constrained_by | def constrained_by(self):
"""
returns a list of parameters that constrain this parameter
"""
if self._is_constraint is None:
return []
params = []
for var in self.is_constraint._vars:
param = var.get_parameter()
if param.uniqueid != sel... | python | def constrained_by(self):
"""
returns a list of parameters that constrain this parameter
"""
if self._is_constraint is None:
return []
params = []
for var in self.is_constraint._vars:
param = var.get_parameter()
if param.uniqueid != sel... | [
"def",
"constrained_by",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_constraint",
"is",
"None",
":",
"return",
"[",
"]",
"params",
"=",
"[",
"]",
"for",
"var",
"in",
"self",
".",
"is_constraint",
".",
"_vars",
":",
"param",
"=",
"var",
".",
"get_p... | returns a list of parameters that constrain this parameter | [
"returns",
"a",
"list",
"of",
"parameters",
"that",
"constrain",
"this",
"parameter"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4488-L4499 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatParameter.in_constraints | def in_constraints(self):
"""
returns a list of the expressions in which this parameter constrains another
"""
expressions = []
for uniqueid in self._in_constraints:
expressions.append(self._bundle.get_parameter(context='constraint', uniqueid=uniqueid))
return... | python | def in_constraints(self):
"""
returns a list of the expressions in which this parameter constrains another
"""
expressions = []
for uniqueid in self._in_constraints:
expressions.append(self._bundle.get_parameter(context='constraint', uniqueid=uniqueid))
return... | [
"def",
"in_constraints",
"(",
"self",
")",
":",
"expressions",
"=",
"[",
"]",
"for",
"uniqueid",
"in",
"self",
".",
"_in_constraints",
":",
"expressions",
".",
"append",
"(",
"self",
".",
"_bundle",
".",
"get_parameter",
"(",
"context",
"=",
"'constraint'",
... | returns a list of the expressions in which this parameter constrains another | [
"returns",
"a",
"list",
"of",
"the",
"expressions",
"in",
"which",
"this",
"parameter",
"constrains",
"another"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4511-L4518 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatParameter.constrains | def constrains(self):
"""
returns a list of parameters that are constrained by this parameter
"""
params = []
for constraint in self.in_constraints:
for var in constraint._vars:
param = var.get_parameter()
if param.component == constrai... | python | def constrains(self):
"""
returns a list of parameters that are constrained by this parameter
"""
params = []
for constraint in self.in_constraints:
for var in constraint._vars:
param = var.get_parameter()
if param.component == constrai... | [
"def",
"constrains",
"(",
"self",
")",
":",
"params",
"=",
"[",
"]",
"for",
"constraint",
"in",
"self",
".",
"in_constraints",
":",
"for",
"var",
"in",
"constraint",
".",
"_vars",
":",
"param",
"=",
"var",
".",
"get_parameter",
"(",
")",
"if",
"param",... | returns a list of parameters that are constrained by this parameter | [
"returns",
"a",
"list",
"of",
"parameters",
"that",
"are",
"constrained",
"by",
"this",
"parameter"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4521-L4532 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatParameter.related_to | def related_to(self):
"""
returns a list of all parameters that are either constrained by or constrain this parameter
"""
params = []
constraints = self.in_constraints
if self.is_constraint is not None:
constraints.append(self.is_constraint)
for const... | python | def related_to(self):
"""
returns a list of all parameters that are either constrained by or constrain this parameter
"""
params = []
constraints = self.in_constraints
if self.is_constraint is not None:
constraints.append(self.is_constraint)
for const... | [
"def",
"related_to",
"(",
"self",
")",
":",
"params",
"=",
"[",
"]",
"constraints",
"=",
"self",
".",
"in_constraints",
"if",
"self",
".",
"is_constraint",
"is",
"not",
"None",
":",
"constraints",
".",
"append",
"(",
"self",
".",
"is_constraint",
")",
"f... | returns a list of all parameters that are either constrained by or constrain this parameter | [
"returns",
"a",
"list",
"of",
"all",
"parameters",
"that",
"are",
"either",
"constrained",
"by",
"or",
"constrain",
"this",
"parameter"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4535-L4550 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatArrayParameter.to_string_short | def to_string_short(self):
"""
see also :meth:`to_string`
:return: a shorter abreviated string reprentation of the parameter
"""
opt = np.get_printoptions()
np.set_printoptions(threshold=8, edgeitems=3, linewidth=opt['linewidth']-len(self.uniquetwig)-2)
str_ = su... | python | def to_string_short(self):
"""
see also :meth:`to_string`
:return: a shorter abreviated string reprentation of the parameter
"""
opt = np.get_printoptions()
np.set_printoptions(threshold=8, edgeitems=3, linewidth=opt['linewidth']-len(self.uniquetwig)-2)
str_ = su... | [
"def",
"to_string_short",
"(",
"self",
")",
":",
"opt",
"=",
"np",
".",
"get_printoptions",
"(",
")",
"np",
".",
"set_printoptions",
"(",
"threshold",
"=",
"8",
",",
"edgeitems",
"=",
"3",
",",
"linewidth",
"=",
"opt",
"[",
"'linewidth'",
"]",
"-",
"le... | see also :meth:`to_string`
:return: a shorter abreviated string reprentation of the parameter | [
"see",
"also",
":",
"meth",
":",
"to_string"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4596-L4606 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatArrayParameter.interp_value | def interp_value(self, **kwargs):
"""
Interpolate to find the value in THIS array given a value from
ANOTHER array in the SAME parent :class:`ParameterSet`
This currently only supports simple 1d linear interpolation (via
numpy.interp) and does no checks to make sure you're inter... | python | def interp_value(self, **kwargs):
"""
Interpolate to find the value in THIS array given a value from
ANOTHER array in the SAME parent :class:`ParameterSet`
This currently only supports simple 1d linear interpolation (via
numpy.interp) and does no checks to make sure you're inter... | [
"def",
"interp_value",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: add support for units",
"# TODO: add support for non-linear interpolation (probably would need to use scipy)?",
"# TODO: add support for interpolating in phase_space",
"if",
"len",
"(",
"kwargs",
".",
... | Interpolate to find the value in THIS array given a value from
ANOTHER array in the SAME parent :class:`ParameterSet`
This currently only supports simple 1d linear interpolation (via
numpy.interp) and does no checks to make sure you're interpolating
with respect to an independent parame... | [
"Interpolate",
"to",
"find",
"the",
"value",
"in",
"THIS",
"array",
"given",
"a",
"value",
"from",
"ANOTHER",
"array",
"in",
"the",
"SAME",
"parent",
":",
"class",
":",
"ParameterSet"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4608-L4672 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | FloatArrayParameter.set_property | def set_property(self, **kwargs):
"""
set any property of the underlying nparray object
"""
if not isinstance(self._value, nparray.ndarray):
raise ValueError("value is not a nparray object")
for property, value in kwargs.items():
setattr(self._value, prop... | python | def set_property(self, **kwargs):
"""
set any property of the underlying nparray object
"""
if not isinstance(self._value, nparray.ndarray):
raise ValueError("value is not a nparray object")
for property, value in kwargs.items():
setattr(self._value, prop... | [
"def",
"set_property",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"_value",
",",
"nparray",
".",
"ndarray",
")",
":",
"raise",
"ValueError",
"(",
"\"value is not a nparray object\"",
")",
"for",
"property",
... | set any property of the underlying nparray object | [
"set",
"any",
"property",
"of",
"the",
"underlying",
"nparray",
"object"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4756-L4764 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter._parse_repr | def _parse_repr(self):
"""
turn something like "orbit:outer(orbit:inner(star:starA, star:starB), star:starC)"
into ['orbit:outer', ['orbit:inner', ['star:starA', 'star:starB'], 'star:starC']]
"""
repr_ = self.get_value()
repr_str = '["{}"]'.format(repr_.replace(', ... | python | def _parse_repr(self):
"""
turn something like "orbit:outer(orbit:inner(star:starA, star:starB), star:starC)"
into ['orbit:outer', ['orbit:inner', ['star:starA', 'star:starB'], 'star:starC']]
"""
repr_ = self.get_value()
repr_str = '["{}"]'.format(repr_.replace(', ... | [
"def",
"_parse_repr",
"(",
"self",
")",
":",
"repr_",
"=",
"self",
".",
"get_value",
"(",
")",
"repr_str",
"=",
"'[\"{}\"]'",
".",
"format",
"(",
"repr_",
".",
"replace",
"(",
"', '",
",",
"'\", \"'",
")",
".",
"replace",
"(",
"'('",
",",
"'\", [\"'",
... | turn something like "orbit:outer(orbit:inner(star:starA, star:starB), star:starC)"
into ['orbit:outer', ['orbit:inner', ['star:starA', 'star:starB'], 'star:starC']] | [
"turn",
"something",
"like",
"orbit",
":",
"outer",
"(",
"orbit",
":",
"inner",
"(",
"star",
":",
"starA",
"star",
":",
"starB",
")",
"star",
":",
"starC",
")",
"into",
"[",
"orbit",
":",
"outer",
"[",
"orbit",
":",
"inner",
"[",
"star",
":",
"star... | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4938-L4946 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter._recurse_find_trace | def _recurse_find_trace(self, structure, item, trace=[]):
"""
given a nested structure from _parse_repr and find the trace route to get to item
"""
try:
i = structure.index(item)
except ValueError:
for j,substructure in enumerate(structure):
... | python | def _recurse_find_trace(self, structure, item, trace=[]):
"""
given a nested structure from _parse_repr and find the trace route to get to item
"""
try:
i = structure.index(item)
except ValueError:
for j,substructure in enumerate(structure):
... | [
"def",
"_recurse_find_trace",
"(",
"self",
",",
"structure",
",",
"item",
",",
"trace",
"=",
"[",
"]",
")",
":",
"try",
":",
"i",
"=",
"structure",
".",
"index",
"(",
"item",
")",
"except",
"ValueError",
":",
"for",
"j",
",",
"substructure",
"in",
"e... | given a nested structure from _parse_repr and find the trace route to get to item | [
"given",
"a",
"nested",
"structure",
"from",
"_parse_repr",
"and",
"find",
"the",
"trace",
"route",
"to",
"get",
"to",
"item"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4948-L4960 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter._get_by_trace | def _get_by_trace(self, structure, trace):
"""
retrieve an item from the nested structure from _parse_repr given a trace (probably modified from _recurse_find_trace)
"""
for i in trace:
structure = structure[i]
return structure | python | def _get_by_trace(self, structure, trace):
"""
retrieve an item from the nested structure from _parse_repr given a trace (probably modified from _recurse_find_trace)
"""
for i in trace:
structure = structure[i]
return structure | [
"def",
"_get_by_trace",
"(",
"self",
",",
"structure",
",",
"trace",
")",
":",
"for",
"i",
"in",
"trace",
":",
"structure",
"=",
"structure",
"[",
"i",
"]",
"return",
"structure"
] | retrieve an item from the nested structure from _parse_repr given a trace (probably modified from _recurse_find_trace) | [
"retrieve",
"an",
"item",
"from",
"the",
"nested",
"structure",
"from",
"_parse_repr",
"given",
"a",
"trace",
"(",
"probably",
"modified",
"from",
"_recurse_find_trace",
")"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4962-L4969 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_stars | def get_stars(self):
"""
get 'component' of all stars in order primary -> secondary
"""
l = re.findall(r"[\w']+", self.get_value())
# now search for indices of star and take the next entry from this flat list
return [l[i+1] for i,s in enumerate(l) if s=='star'] | python | def get_stars(self):
"""
get 'component' of all stars in order primary -> secondary
"""
l = re.findall(r"[\w']+", self.get_value())
# now search for indices of star and take the next entry from this flat list
return [l[i+1] for i,s in enumerate(l) if s=='star'] | [
"def",
"get_stars",
"(",
"self",
")",
":",
"l",
"=",
"re",
".",
"findall",
"(",
"r\"[\\w']+\"",
",",
"self",
".",
"get_value",
"(",
")",
")",
"# now search for indices of star and take the next entry from this flat list",
"return",
"[",
"l",
"[",
"i",
"+",
"1",
... | get 'component' of all stars in order primary -> secondary | [
"get",
"component",
"of",
"all",
"stars",
"in",
"order",
"primary",
"-",
">",
"secondary"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5008-L5014 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_orbits | def get_orbits(self):
"""
get 'component' of all orbits in order primary -> secondary
"""
#~ l = re.findall(r"[\w']+", self.get_value())
# now search for indices of orbit and take the next entry from this flat list
#~ return [l[i+1] for i,s in enumerate(l) if s=='orbit']
... | python | def get_orbits(self):
"""
get 'component' of all orbits in order primary -> secondary
"""
#~ l = re.findall(r"[\w']+", self.get_value())
# now search for indices of orbit and take the next entry from this flat list
#~ return [l[i+1] for i,s in enumerate(l) if s=='orbit']
... | [
"def",
"get_orbits",
"(",
"self",
")",
":",
"#~ l = re.findall(r\"[\\w']+\", self.get_value())",
"# now search for indices of orbit and take the next entry from this flat list",
"#~ return [l[i+1] for i,s in enumerate(l) if s=='orbit']",
"orbits",
"=",
"[",
"]",
"for",
"star",
"in",
... | get 'component' of all orbits in order primary -> secondary | [
"get",
"component",
"of",
"all",
"orbits",
"in",
"order",
"primary",
"-",
">",
"secondary"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5024-L5036 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_stars_of_sibling_of | def get_stars_of_sibling_of(self, component):
"""
same as get_sibling_of except if the sibling is an orbit, this will recursively
follow the tree to return a list of all stars under that orbit
"""
sibling = self.get_sibling_of(component)
if sibling in self.get_stars():
... | python | def get_stars_of_sibling_of(self, component):
"""
same as get_sibling_of except if the sibling is an orbit, this will recursively
follow the tree to return a list of all stars under that orbit
"""
sibling = self.get_sibling_of(component)
if sibling in self.get_stars():
... | [
"def",
"get_stars_of_sibling_of",
"(",
"self",
",",
"component",
")",
":",
"sibling",
"=",
"self",
".",
"get_sibling_of",
"(",
"component",
")",
"if",
"sibling",
"in",
"self",
".",
"get_stars",
"(",
")",
":",
"return",
"sibling",
"stars",
"=",
"[",
"child"... | same as get_sibling_of except if the sibling is an orbit, this will recursively
follow the tree to return a list of all stars under that orbit | [
"same",
"as",
"get_sibling_of",
"except",
"if",
"the",
"sibling",
"is",
"an",
"orbit",
"this",
"will",
"recursively",
"follow",
"the",
"tree",
"to",
"return",
"a",
"list",
"of",
"all",
"stars",
"under",
"that",
"orbit"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5097-L5113 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_children_of | def get_children_of(self, component, kind=None):
"""
get to component labels of the children of a given component
"""
structure, trace, item = self._get_structure_and_trace(component)
item_kind, item_label = item.split(':')
if isinstance(kind, str):
kind = [... | python | def get_children_of(self, component, kind=None):
"""
get to component labels of the children of a given component
"""
structure, trace, item = self._get_structure_and_trace(component)
item_kind, item_label = item.split(':')
if isinstance(kind, str):
kind = [... | [
"def",
"get_children_of",
"(",
"self",
",",
"component",
",",
"kind",
"=",
"None",
")",
":",
"structure",
",",
"trace",
",",
"item",
"=",
"self",
".",
"_get_structure_and_trace",
"(",
"component",
")",
"item_kind",
",",
"item_label",
"=",
"item",
".",
"spl... | get to component labels of the children of a given component | [
"get",
"to",
"component",
"labels",
"of",
"the",
"children",
"of",
"a",
"given",
"component"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5116-L5134 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_stars_of_children_of | def get_stars_of_children_of(self, component):
"""
same as get_children_of except if any of the children are orbits, this will recursively
follow the tree to return a list of all children (grandchildren, etc) stars under that orbit
"""
stars = self.get_stars()
orbits = s... | python | def get_stars_of_children_of(self, component):
"""
same as get_children_of except if any of the children are orbits, this will recursively
follow the tree to return a list of all children (grandchildren, etc) stars under that orbit
"""
stars = self.get_stars()
orbits = s... | [
"def",
"get_stars_of_children_of",
"(",
"self",
",",
"component",
")",
":",
"stars",
"=",
"self",
".",
"get_stars",
"(",
")",
"orbits",
"=",
"self",
".",
"get_orbits",
"(",
")",
"stars_children",
"=",
"[",
"]",
"for",
"child",
"in",
"self",
".",
"get_chi... | same as get_children_of except if any of the children are orbits, this will recursively
follow the tree to return a list of all children (grandchildren, etc) stars under that orbit | [
"same",
"as",
"get_children_of",
"except",
"if",
"any",
"of",
"the",
"children",
"are",
"orbits",
"this",
"will",
"recursively",
"follow",
"the",
"tree",
"to",
"return",
"a",
"list",
"of",
"all",
"children",
"(",
"grandchildren",
"etc",
")",
"stars",
"under"... | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5136-L5155 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_child_of | def get_child_of(self, component, ind, kind=None):
"""
get a child (by index) of a given component
"""
children = self.get_children_of(component, kind=kind)
if children is None:
return None
else:
return children[ind] | python | def get_child_of(self, component, ind, kind=None):
"""
get a child (by index) of a given component
"""
children = self.get_children_of(component, kind=kind)
if children is None:
return None
else:
return children[ind] | [
"def",
"get_child_of",
"(",
"self",
",",
"component",
",",
"ind",
",",
"kind",
"=",
"None",
")",
":",
"children",
"=",
"self",
".",
"get_children_of",
"(",
"component",
",",
"kind",
"=",
"kind",
")",
"if",
"children",
"is",
"None",
":",
"return",
"None... | get a child (by index) of a given component | [
"get",
"a",
"child",
"(",
"by",
"index",
")",
"of",
"a",
"given",
"component"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5159-L5167 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_primary_or_secondary | def get_primary_or_secondary(self, component, return_ind=False):
"""
return whether a given component is the 'primary' or 'secondary'
component in its parent orbit
"""
parent = self.get_parent_of(component)
if parent is None:
# then this is a single component,... | python | def get_primary_or_secondary(self, component, return_ind=False):
"""
return whether a given component is the 'primary' or 'secondary'
component in its parent orbit
"""
parent = self.get_parent_of(component)
if parent is None:
# then this is a single component,... | [
"def",
"get_primary_or_secondary",
"(",
"self",
",",
"component",
",",
"return_ind",
"=",
"False",
")",
":",
"parent",
"=",
"self",
".",
"get_parent_of",
"(",
"component",
")",
"if",
"parent",
"is",
"None",
":",
"# then this is a single component, not in a binary",
... | return whether a given component is the 'primary' or 'secondary'
component in its parent orbit | [
"return",
"whether",
"a",
"given",
"component",
"is",
"the",
"primary",
"or",
"secondary",
"component",
"in",
"its",
"parent",
"orbit"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5171-L5191 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.get_meshables | def get_meshables(self):
"""
return a list of components that are meshable (generally stars, but handles
the envelope for an contact_binary)
"""
l = re.findall(r"[\w']+", self.get_value())
# now search for indices of star and take the next entry from this flat list
... | python | def get_meshables(self):
"""
return a list of components that are meshable (generally stars, but handles
the envelope for an contact_binary)
"""
l = re.findall(r"[\w']+", self.get_value())
# now search for indices of star and take the next entry from this flat list
... | [
"def",
"get_meshables",
"(",
"self",
")",
":",
"l",
"=",
"re",
".",
"findall",
"(",
"r\"[\\w']+\"",
",",
"self",
".",
"get_value",
"(",
")",
")",
"# now search for indices of star and take the next entry from this flat list",
"meshables",
"=",
"[",
"l",
"[",
"i",
... | return a list of components that are meshable (generally stars, but handles
the envelope for an contact_binary) | [
"return",
"a",
"list",
"of",
"components",
"that",
"are",
"meshable",
"(",
"generally",
"stars",
"but",
"handles",
"the",
"envelope",
"for",
"an",
"contact_binary",
")"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5193-L5209 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.is_contact_binary | def is_contact_binary(self, component):
"""
especially useful for constraints
tells whether any component (star, envelope) is part of a contact_binary
by checking its siblings for an envelope
"""
if component not in self._is_contact_binary.keys():
self._updat... | python | def is_contact_binary(self, component):
"""
especially useful for constraints
tells whether any component (star, envelope) is part of a contact_binary
by checking its siblings for an envelope
"""
if component not in self._is_contact_binary.keys():
self._updat... | [
"def",
"is_contact_binary",
"(",
"self",
",",
"component",
")",
":",
"if",
"component",
"not",
"in",
"self",
".",
"_is_contact_binary",
".",
"keys",
"(",
")",
":",
"self",
".",
"_update_cache",
"(",
")",
"return",
"self",
".",
"_is_contact_binary",
".",
"g... | especially useful for constraints
tells whether any component (star, envelope) is part of a contact_binary
by checking its siblings for an envelope | [
"especially",
"useful",
"for",
"constraints"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5233-L5243 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | HierarchyParameter.is_binary | def is_binary(self, component):
"""
especially useful for constraints
tells whether any component (star, envelope) is part of a binary
by checking its parent
"""
if component not in self._is_binary.keys():
self._update_cache()
return self._is_binary.... | python | def is_binary(self, component):
"""
especially useful for constraints
tells whether any component (star, envelope) is part of a binary
by checking its parent
"""
if component not in self._is_binary.keys():
self._update_cache()
return self._is_binary.... | [
"def",
"is_binary",
"(",
"self",
",",
"component",
")",
":",
"if",
"component",
"not",
"in",
"self",
".",
"_is_binary",
".",
"keys",
"(",
")",
":",
"self",
".",
"_update_cache",
"(",
")",
"return",
"self",
".",
"_is_binary",
".",
"get",
"(",
"component... | especially useful for constraints
tells whether any component (star, envelope) is part of a binary
by checking its parent | [
"especially",
"useful",
"for",
"constraints"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5257-L5267 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ConstraintParameter.vars | def vars(self):
"""
return all the variables in a PS
"""
# cache _var_params
if self._var_params is None:
self._var_params = ParameterSet([var.get_parameter() for var in self._vars])
return self._var_params | python | def vars(self):
"""
return all the variables in a PS
"""
# cache _var_params
if self._var_params is None:
self._var_params = ParameterSet([var.get_parameter() for var in self._vars])
return self._var_params | [
"def",
"vars",
"(",
"self",
")",
":",
"# cache _var_params",
"if",
"self",
".",
"_var_params",
"is",
"None",
":",
"self",
".",
"_var_params",
"=",
"ParameterSet",
"(",
"[",
"var",
".",
"get_parameter",
"(",
")",
"for",
"var",
"in",
"self",
".",
"_vars",
... | return all the variables in a PS | [
"return",
"all",
"the",
"variables",
"in",
"a",
"PS"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5331-L5338 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ConstraintParameter.get_parameter | def get_parameter(self, twig=None, **kwargs):
"""
get a parameter from those that are variables
"""
kwargs['twig'] = twig
kwargs['check_default'] = False
kwargs['check_visible'] = False
ps = self.vars.filter(**kwargs)
if len(ps)==1:
return ps.g... | python | def get_parameter(self, twig=None, **kwargs):
"""
get a parameter from those that are variables
"""
kwargs['twig'] = twig
kwargs['check_default'] = False
kwargs['check_visible'] = False
ps = self.vars.filter(**kwargs)
if len(ps)==1:
return ps.g... | [
"def",
"get_parameter",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'twig'",
"]",
"=",
"twig",
"kwargs",
"[",
"'check_default'",
"]",
"=",
"False",
"kwargs",
"[",
"'check_visible'",
"]",
"=",
"False",
"ps",... | get a parameter from those that are variables | [
"get",
"a",
"parameter",
"from",
"those",
"that",
"are",
"variables"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5404-L5420 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ConstraintParameter.flip_for | def flip_for(self, twig=None, expression=None, **kwargs):
"""
flip the constraint to solve for for any of the parameters in the expression
expression (optional if sympy available, required if not)
"""
_orig_expression = self.get_value()
# try to get the parameter from ... | python | def flip_for(self, twig=None, expression=None, **kwargs):
"""
flip the constraint to solve for for any of the parameters in the expression
expression (optional if sympy available, required if not)
"""
_orig_expression = self.get_value()
# try to get the parameter from ... | [
"def",
"flip_for",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"expression",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"_orig_expression",
"=",
"self",
".",
"get_value",
"(",
")",
"# try to get the parameter from the bundle",
"kwargs",
"[",
"'twig'",
"... | flip the constraint to solve for for any of the parameters in the expression
expression (optional if sympy available, required if not) | [
"flip",
"the",
"constraint",
"to",
"solve",
"for",
"for",
"any",
"of",
"the",
"parameters",
"in",
"the",
"expression"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5719-L5791 |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | JobParameter.get_status | def get_status(self):
"""
[NOT IMPLEMENTED]
"""
if self._value == 'loaded':
status = 'loaded'
elif not _is_server and self._bundle is not None and self._server_status is not None:
if not _can_requests:
raise ImportError("requests module re... | python | def get_status(self):
"""
[NOT IMPLEMENTED]
"""
if self._value == 'loaded':
status = 'loaded'
elif not _is_server and self._bundle is not None and self._server_status is not None:
if not _can_requests:
raise ImportError("requests module re... | [
"def",
"get_status",
"(",
"self",
")",
":",
"if",
"self",
".",
"_value",
"==",
"'loaded'",
":",
"status",
"=",
"'loaded'",
"elif",
"not",
"_is_server",
"and",
"self",
".",
"_bundle",
"is",
"not",
"None",
"and",
"self",
".",
"_server_status",
"is",
"not",... | [NOT IMPLEMENTED] | [
"[",
"NOT",
"IMPLEMENTED",
"]"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L6034-L6076 |
pinax/pinax-teams | pinax/teams/views.py | TeamInviteView.get_unbound_form | def get_unbound_form(self):
"""
Overrides behavior of FormView.get_form_kwargs
when method is POST or PUT
"""
form_kwargs = self.get_form_kwargs()
# @@@ remove fields that would cause the form to be bound
# when instantiated
bound_fields = ["data", "files"... | python | def get_unbound_form(self):
"""
Overrides behavior of FormView.get_form_kwargs
when method is POST or PUT
"""
form_kwargs = self.get_form_kwargs()
# @@@ remove fields that would cause the form to be bound
# when instantiated
bound_fields = ["data", "files"... | [
"def",
"get_unbound_form",
"(",
"self",
")",
":",
"form_kwargs",
"=",
"self",
".",
"get_form_kwargs",
"(",
")",
"# @@@ remove fields that would cause the form to be bound",
"# when instantiated",
"bound_fields",
"=",
"[",
"\"data\"",
",",
"\"files\"",
"]",
"for",
"field... | Overrides behavior of FormView.get_form_kwargs
when method is POST or PUT | [
"Overrides",
"behavior",
"of",
"FormView",
".",
"get_form_kwargs",
"when",
"method",
"is",
"POST",
"or",
"PUT"
] | train | https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/views.py#L216-L227 |
pinax/pinax-teams | pinax/teams/views.py | TeamInviteView.get_form_success_data | def get_form_success_data(self, form):
"""
Allows customization of the JSON data returned when a valid form submission occurs.
"""
data = {
"html": render_to_string(
"pinax/teams/_invite_form.html",
{
"invite_form": self.get... | python | def get_form_success_data(self, form):
"""
Allows customization of the JSON data returned when a valid form submission occurs.
"""
data = {
"html": render_to_string(
"pinax/teams/_invite_form.html",
{
"invite_form": self.get... | [
"def",
"get_form_success_data",
"(",
"self",
",",
"form",
")",
":",
"data",
"=",
"{",
"\"html\"",
":",
"render_to_string",
"(",
"\"pinax/teams/_invite_form.html\"",
",",
"{",
"\"invite_form\"",
":",
"self",
".",
"get_unbound_form",
"(",
")",
",",
"\"team\"",
":"... | Allows customization of the JSON data returned when a valid form submission occurs. | [
"Allows",
"customization",
"of",
"the",
"JSON",
"data",
"returned",
"when",
"a",
"valid",
"form",
"submission",
"occurs",
"."
] | train | https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/views.py#L236-L275 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | _value | def _value(obj):
"""
make sure to get a float
"""
# TODO: this is ugly and makes everything ugly
# can we handle this with a clean decorator or just requiring that only floats be passed??
if hasattr(obj, 'value'):
return obj.value
elif isinstance(obj, np.ndarray):
return np.a... | python | def _value(obj):
"""
make sure to get a float
"""
# TODO: this is ugly and makes everything ugly
# can we handle this with a clean decorator or just requiring that only floats be passed??
if hasattr(obj, 'value'):
return obj.value
elif isinstance(obj, np.ndarray):
return np.a... | [
"def",
"_value",
"(",
"obj",
")",
":",
"# TODO: this is ugly and makes everything ugly",
"# can we handle this with a clean decorator or just requiring that only floats be passed??",
"if",
"hasattr",
"(",
"obj",
",",
"'value'",
")",
":",
"return",
"obj",
".",
"value",
"elif",... | make sure to get a float | [
"make",
"sure",
"to",
"get",
"a",
"float"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L74-L86 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | _estimate_delta | def _estimate_delta(ntriangles, area):
"""
estimate the value for delta to send to marching based on the number of
requested triangles and the expected surface area of mesh
"""
return np.sqrt(4./np.sqrt(3) * float(area) / float(ntriangles)) | python | def _estimate_delta(ntriangles, area):
"""
estimate the value for delta to send to marching based on the number of
requested triangles and the expected surface area of mesh
"""
return np.sqrt(4./np.sqrt(3) * float(area) / float(ntriangles)) | [
"def",
"_estimate_delta",
"(",
"ntriangles",
",",
"area",
")",
":",
"return",
"np",
".",
"sqrt",
"(",
"4.",
"/",
"np",
".",
"sqrt",
"(",
"3",
")",
"*",
"float",
"(",
"area",
")",
"/",
"float",
"(",
"ntriangles",
")",
")"
] | estimate the value for delta to send to marching based on the number of
requested triangles and the expected surface area of mesh | [
"estimate",
"the",
"value",
"for",
"delta",
"to",
"send",
"to",
"marching",
"based",
"on",
"the",
"number",
"of",
"requested",
"triangles",
"and",
"the",
"expected",
"surface",
"area",
"of",
"mesh"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L88-L93 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | System.from_bundle | def from_bundle(cls, b, compute=None, datasets=[], **kwargs):
"""
Build a system from the :class:`phoebe.frontend.bundle.Bundle` and its
hierarchy.
:parameter b: the :class:`phoebe.frontend.bundle.Bundle`
:parameter str compute: name of the computeoptions in the bundle
:... | python | def from_bundle(cls, b, compute=None, datasets=[], **kwargs):
"""
Build a system from the :class:`phoebe.frontend.bundle.Bundle` and its
hierarchy.
:parameter b: the :class:`phoebe.frontend.bundle.Bundle`
:parameter str compute: name of the computeoptions in the bundle
:... | [
"def",
"from_bundle",
"(",
"cls",
",",
"b",
",",
"compute",
"=",
"None",
",",
"datasets",
"=",
"[",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"hier",
"=",
"b",
".",
"hierarchy",
"if",
"not",
"len",
"(",
"hier",
".",
"get_value",
"(",
")",
")",
":... | Build a system from the :class:`phoebe.frontend.bundle.Bundle` and its
hierarchy.
:parameter b: the :class:`phoebe.frontend.bundle.Bundle`
:parameter str compute: name of the computeoptions in the bundle
:parameter list datasets: list of names of datasets
:parameter **kwargs: te... | [
"Build",
"a",
"system",
"from",
"the",
":",
"class",
":",
"phoebe",
".",
"frontend",
".",
"bundle",
".",
"Bundle",
"and",
"its",
"hierarchy",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L129-L203 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | System.get_body | def get_body(self, component):
"""
TODO: add documentation
"""
if component in self._bodies.keys():
return self._bodies[component]
else:
# then hopefully we're a child star of an contact_binary envelope
parent_component = self._parent_envelope_... | python | def get_body(self, component):
"""
TODO: add documentation
"""
if component in self._bodies.keys():
return self._bodies[component]
else:
# then hopefully we're a child star of an contact_binary envelope
parent_component = self._parent_envelope_... | [
"def",
"get_body",
"(",
"self",
",",
"component",
")",
":",
"if",
"component",
"in",
"self",
".",
"_bodies",
".",
"keys",
"(",
")",
":",
"return",
"self",
".",
"_bodies",
"[",
"component",
"]",
"else",
":",
"# then hopefully we're a child star of an contact_bi... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L230-L239 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | System.update_positions | def update_positions(self, time, xs, ys, zs, vxs, vys, vzs,
ethetas, elongans, eincls,
ds=None, Fs=None, ignore_effects=False):
"""
TODO: add documentation
all arrays should be for the current time, but iterable over all bodies
"""
... | python | def update_positions(self, time, xs, ys, zs, vxs, vys, vzs,
ethetas, elongans, eincls,
ds=None, Fs=None, ignore_effects=False):
"""
TODO: add documentation
all arrays should be for the current time, but iterable over all bodies
"""
... | [
"def",
"update_positions",
"(",
"self",
",",
"time",
",",
"xs",
",",
"ys",
",",
"zs",
",",
"vxs",
",",
"vys",
",",
"vzs",
",",
"ethetas",
",",
"elongans",
",",
"eincls",
",",
"ds",
"=",
"None",
",",
"Fs",
"=",
"None",
",",
"ignore_effects",
"=",
... | TODO: add documentation
all arrays should be for the current time, but iterable over all bodies | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L283-L298 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | System.populate_observables | def populate_observables(self, time, kinds, datasets, ignore_effects=False):
"""
TODO: add documentation
ignore_effects: whether to ignore reflection and features (useful for computing luminosities)
"""
if self.irrad_method is not 'none' and not ignore_effects:
# T... | python | def populate_observables(self, time, kinds, datasets, ignore_effects=False):
"""
TODO: add documentation
ignore_effects: whether to ignore reflection and features (useful for computing luminosities)
"""
if self.irrad_method is not 'none' and not ignore_effects:
# T... | [
"def",
"populate_observables",
"(",
"self",
",",
"time",
",",
"kinds",
",",
"datasets",
",",
"ignore_effects",
"=",
"False",
")",
":",
"if",
"self",
".",
"irrad_method",
"is",
"not",
"'none'",
"and",
"not",
"ignore_effects",
":",
"# TODO: only for kinds that req... | TODO: add documentation
ignore_effects: whether to ignore reflection and features (useful for computing luminosities) | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L301-L316 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | System.handle_eclipses | def handle_eclipses(self, expose_horizon=False, **kwargs):
"""
Detect the triangles at the horizon and the eclipsed triangles, handling
any necessary subdivision.
:parameter str eclipse_method: name of the algorithm to use to detect
the horizon or eclipses (defaults to the v... | python | def handle_eclipses(self, expose_horizon=False, **kwargs):
"""
Detect the triangles at the horizon and the eclipsed triangles, handling
any necessary subdivision.
:parameter str eclipse_method: name of the algorithm to use to detect
the horizon or eclipses (defaults to the v... | [
"def",
"handle_eclipses",
"(",
"self",
",",
"expose_horizon",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"eclipse_method",
"=",
"kwargs",
".",
"get",
"(",
"'eclipse_method'",
",",
"self",
".",
"eclipse_method",
")",
"horizon_method",
"=",
"kwargs",
"."... | Detect the triangles at the horizon and the eclipsed triangles, handling
any necessary subdivision.
:parameter str eclipse_method: name of the algorithm to use to detect
the horizon or eclipses (defaults to the value set by computeoptions)
:parameter str subdiv_alg: name of the algo... | [
"Detect",
"the",
"triangles",
"at",
"the",
"horizon",
"and",
"the",
"eclipsed",
"triangles",
"handling",
"any",
"necessary",
"subdivision",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L464-L544 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | System.observe | def observe(self, dataset, kind, components=None, distance=1.0, l3=0.0, **kwargs):
"""
TODO: add documentation
Integrate over visible surface elements and return a dictionary of observable values
distance (m)
"""
meshes = self.meshes
if kind=='lp':
... | python | def observe(self, dataset, kind, components=None, distance=1.0, l3=0.0, **kwargs):
"""
TODO: add documentation
Integrate over visible surface elements and return a dictionary of observable values
distance (m)
"""
meshes = self.meshes
if kind=='lp':
... | [
"def",
"observe",
"(",
"self",
",",
"dataset",
",",
"kind",
",",
"components",
"=",
"None",
",",
"distance",
"=",
"1.0",
",",
"l3",
"=",
"0.0",
",",
"*",
"*",
"kwargs",
")",
":",
"meshes",
"=",
"self",
".",
"meshes",
"if",
"kind",
"==",
"'lp'",
"... | TODO: add documentation
Integrate over visible surface elements and return a dictionary of observable values
distance (m) | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L547-L661 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Body.instantaneous_maxr | def instantaneous_maxr(self):
"""
Recall the maximum r (triangle furthest from the center of the star) of
this star at the given time
:return: maximum r
:rtype: float
"""
logger.debug("{}.instantaneous_maxr".format(self.component))
if 'maxr' not in self.... | python | def instantaneous_maxr(self):
"""
Recall the maximum r (triangle furthest from the center of the star) of
this star at the given time
:return: maximum r
:rtype: float
"""
logger.debug("{}.instantaneous_maxr".format(self.component))
if 'maxr' not in self.... | [
"def",
"instantaneous_maxr",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}.instantaneous_maxr\"",
".",
"format",
"(",
"self",
".",
"component",
")",
")",
"if",
"'maxr'",
"not",
"in",
"self",
".",
"inst_vals",
".",
"keys",
"(",
")",
":",
"logg... | Recall the maximum r (triangle furthest from the center of the star) of
this star at the given time
:return: maximum r
:rtype: float | [
"Recall",
"the",
"maximum",
"r",
"(",
"triangle",
"furthest",
"from",
"the",
"center",
"of",
"the",
"star",
")",
"of",
"this",
"star",
"at",
"the",
"given",
"time"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L778-L793 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Body._get_mass_by_index | def _get_mass_by_index(self, index):
"""
where index can either by an integer or a list of integers (returns some of masses)
"""
if hasattr(index, '__iter__'):
return sum([self.masses[i] for i in index])
else:
return self.masses[index] | python | def _get_mass_by_index(self, index):
"""
where index can either by an integer or a list of integers (returns some of masses)
"""
if hasattr(index, '__iter__'):
return sum([self.masses[i] for i in index])
else:
return self.masses[index] | [
"def",
"_get_mass_by_index",
"(",
"self",
",",
"index",
")",
":",
"if",
"hasattr",
"(",
"index",
",",
"'__iter__'",
")",
":",
"return",
"sum",
"(",
"[",
"self",
".",
"masses",
"[",
"i",
"]",
"for",
"i",
"in",
"index",
"]",
")",
"else",
":",
"return... | where index can either by an integer or a list of integers (returns some of masses) | [
"where",
"index",
"can",
"either",
"by",
"an",
"integer",
"or",
"a",
"list",
"of",
"integers",
"(",
"returns",
"some",
"of",
"masses",
")"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L799-L806 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Body._get_coords_by_index | def _get_coords_by_index(self, coords_array, index):
"""
where index can either by an integer or a list of integers (returns some of masses)
coords_array should be a single array (xs, ys, or zs)
"""
if hasattr(index, '__iter__'):
# then we want the center-of-mass coor... | python | def _get_coords_by_index(self, coords_array, index):
"""
where index can either by an integer or a list of integers (returns some of masses)
coords_array should be a single array (xs, ys, or zs)
"""
if hasattr(index, '__iter__'):
# then we want the center-of-mass coor... | [
"def",
"_get_coords_by_index",
"(",
"self",
",",
"coords_array",
",",
"index",
")",
":",
"if",
"hasattr",
"(",
"index",
",",
"'__iter__'",
")",
":",
"# then we want the center-of-mass coordinates",
"# TODO: clean this up",
"return",
"np",
".",
"average",
"(",
"[",
... | where index can either by an integer or a list of integers (returns some of masses)
coords_array should be a single array (xs, ys, or zs) | [
"where",
"index",
"can",
"either",
"by",
"an",
"integer",
"or",
"a",
"list",
"of",
"integers",
"(",
"returns",
"some",
"of",
"masses",
")",
"coords_array",
"should",
"be",
"a",
"single",
"array",
"(",
"xs",
"ys",
"or",
"zs",
")"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L808-L819 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Body.get_standard_mesh | def get_standard_mesh(self, scaled=True):
"""
TODO: add documentation
"""
# TODO: allow this to take etheta and retreive a mesh at that true anomaly
theta = 0.0
protomesh = self._standard_meshes[theta] #.copy() # if theta in self._standard_meshes.keys() else self.mesh.cop... | python | def get_standard_mesh(self, scaled=True):
"""
TODO: add documentation
"""
# TODO: allow this to take etheta and retreive a mesh at that true anomaly
theta = 0.0
protomesh = self._standard_meshes[theta] #.copy() # if theta in self._standard_meshes.keys() else self.mesh.cop... | [
"def",
"get_standard_mesh",
"(",
"self",
",",
"scaled",
"=",
"True",
")",
":",
"# TODO: allow this to take etheta and retreive a mesh at that true anomaly",
"theta",
"=",
"0.0",
"protomesh",
"=",
"self",
".",
"_standard_meshes",
"[",
"theta",
"]",
"#.copy() # if theta in ... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L885-L897 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Body.reset_time | def reset_time(self, time, true_anom, elongan, eincl):
"""
TODO: add documentation
"""
self.true_anom = true_anom
self.elongan = elongan
self.eincl = eincl
self.time = time
self.populated_at_time = []
self.reset()
return | python | def reset_time(self, time, true_anom, elongan, eincl):
"""
TODO: add documentation
"""
self.true_anom = true_anom
self.elongan = elongan
self.eincl = eincl
self.time = time
self.populated_at_time = []
self.reset()
return | [
"def",
"reset_time",
"(",
"self",
",",
"time",
",",
"true_anom",
",",
"elongan",
",",
"eincl",
")",
":",
"self",
".",
"true_anom",
"=",
"true_anom",
"self",
".",
"elongan",
"=",
"elongan",
"self",
".",
"eincl",
"=",
"eincl",
"self",
".",
"time",
"=",
... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L913-L925 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Body.update_position | def update_position(self, time,
xs, ys, zs, vxs, vys, vzs,
ethetas, elongans, eincls,
ds=None, Fs=None,
ignore_effects=False,
component_com_x=None,
**kwargs):
"""
... | python | def update_position(self, time,
xs, ys, zs, vxs, vys, vzs,
ethetas, elongans, eincls,
ds=None, Fs=None,
ignore_effects=False,
component_com_x=None,
**kwargs):
"""
... | [
"def",
"update_position",
"(",
"self",
",",
"time",
",",
"xs",
",",
"ys",
",",
"zs",
",",
"vxs",
",",
"vys",
",",
"vzs",
",",
"ethetas",
",",
"elongans",
",",
"eincls",
",",
"ds",
"=",
"None",
",",
"Fs",
"=",
"None",
",",
"ignore_effects",
"=",
"... | Update the position of the star into its orbit
:parameter float time: the current time
:parameter list xs: a list/array of x-positions of ALL COMPONENTS in the :class:`System`
:parameter list ys: a list/array of y-positions of ALL COMPONENTS in the :class:`System`
:parameter list zs: a ... | [
"Update",
"the",
"position",
"of",
"the",
"star",
"into",
"its",
"orbit"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L933-L1081 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Body.populate_observable | def populate_observable(self, time, kind, dataset, **kwargs):
"""
TODO: add documentation
"""
if kind in ['mesh', 'orb']:
return
if time==self.time and dataset in self.populated_at_time and 'pblum' not in kind:
# then we've already computed the needed co... | python | def populate_observable(self, time, kind, dataset, **kwargs):
"""
TODO: add documentation
"""
if kind in ['mesh', 'orb']:
return
if time==self.time and dataset in self.populated_at_time and 'pblum' not in kind:
# then we've already computed the needed co... | [
"def",
"populate_observable",
"(",
"self",
",",
"time",
",",
"kind",
",",
"dataset",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kind",
"in",
"[",
"'mesh'",
",",
"'orb'",
"]",
":",
"return",
"if",
"time",
"==",
"self",
".",
"time",
"and",
"dataset",
... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1088-L1110 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star.from_bundle | def from_bundle(cls, b, component, compute=None,
mesh_init_phi=0.0, datasets=[], **kwargs):
"""
Build a star from the :class:`phoebe.frontend.bundle.Bundle` and its
hierarchy.
Usually it makes more sense to call :meth:`System.from_bundle` directly.
:paramete... | python | def from_bundle(cls, b, component, compute=None,
mesh_init_phi=0.0, datasets=[], **kwargs):
"""
Build a star from the :class:`phoebe.frontend.bundle.Bundle` and its
hierarchy.
Usually it makes more sense to call :meth:`System.from_bundle` directly.
:paramete... | [
"def",
"from_bundle",
"(",
"cls",
",",
"b",
",",
"component",
",",
"compute",
"=",
"None",
",",
"mesh_init_phi",
"=",
"0.0",
",",
"datasets",
"=",
"[",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO [DONE?]: handle overriding options from kwargs",
"# TODO [DO... | Build a star from the :class:`phoebe.frontend.bundle.Bundle` and its
hierarchy.
Usually it makes more sense to call :meth:`System.from_bundle` directly.
:parameter b: the :class:`phoebe.frontend.bundle.Bundle`
:parameter str component: label of the component in the bundle
:para... | [
"Build",
"a",
"star",
"from",
"the",
":",
"class",
":",
"phoebe",
".",
"frontend",
".",
"bundle",
".",
"Bundle",
"and",
"its",
"hierarchy",
"."
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1172-L1323 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star.polar_direction_xyz | def polar_direction_xyz(self):
"""
get current polar direction in Roche (xyz) coordinates
"""
return mesh.spin_in_roche(self.polar_direction_uvw,
self.true_anom, self.elongan, self.eincl).astype(float) | python | def polar_direction_xyz(self):
"""
get current polar direction in Roche (xyz) coordinates
"""
return mesh.spin_in_roche(self.polar_direction_uvw,
self.true_anom, self.elongan, self.eincl).astype(float) | [
"def",
"polar_direction_xyz",
"(",
"self",
")",
":",
"return",
"mesh",
".",
"spin_in_roche",
"(",
"self",
".",
"polar_direction_uvw",
",",
"self",
".",
"true_anom",
",",
"self",
".",
"elongan",
",",
"self",
".",
"eincl",
")",
".",
"astype",
"(",
"float",
... | get current polar direction in Roche (xyz) coordinates | [
"get",
"current",
"polar",
"direction",
"in",
"Roche",
"(",
"xyz",
")",
"coordinates"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1370-L1375 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star.get_target_volume | def get_target_volume(self, etheta=0.0, scaled=False):
"""
TODO: add documentation
get the volume that the Star should have at a given euler theta
"""
# TODO: make this a function of d instead of etheta?
logger.debug("determining target volume at t={}, theta={}".format(s... | python | def get_target_volume(self, etheta=0.0, scaled=False):
"""
TODO: add documentation
get the volume that the Star should have at a given euler theta
"""
# TODO: make this a function of d instead of etheta?
logger.debug("determining target volume at t={}, theta={}".format(s... | [
"def",
"get_target_volume",
"(",
"self",
",",
"etheta",
"=",
"0.0",
",",
"scaled",
"=",
"False",
")",
":",
"# TODO: make this a function of d instead of etheta?",
"logger",
".",
"debug",
"(",
"\"determining target volume at t={}, theta={}\"",
".",
"format",
"(",
"self",... | TODO: add documentation
get the volume that the Star should have at a given euler theta | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1377-L1395 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star.north_pole_uvw | def north_pole_uvw(self):
"""location of the north pole in the global/system frame"""
# TODO: is this rpole scaling true for all distortion_methods??
rpole = self.instantaneous_rpole*self.sma
return self.polar_direction_uvw*rpole+self.mesh._pos | python | def north_pole_uvw(self):
"""location of the north pole in the global/system frame"""
# TODO: is this rpole scaling true for all distortion_methods??
rpole = self.instantaneous_rpole*self.sma
return self.polar_direction_uvw*rpole+self.mesh._pos | [
"def",
"north_pole_uvw",
"(",
"self",
")",
":",
"# TODO: is this rpole scaling true for all distortion_methods??",
"rpole",
"=",
"self",
".",
"instantaneous_rpole",
"*",
"self",
".",
"sma",
"return",
"self",
".",
"polar_direction_uvw",
"*",
"rpole",
"+",
"self",
".",
... | location of the north pole in the global/system frame | [
"location",
"of",
"the",
"north",
"pole",
"in",
"the",
"global",
"/",
"system",
"frame"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1398-L1402 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star.instantaneous_tpole | def instantaneous_tpole(self):
"""
compute the instantaenous temperature at the pole to achieve the mean
effective temperature (teff) provided by the user
"""
logger.debug("{}.instantaneous_tpole".format(self.component))
if 'tpole' not in self.inst_vals.keys():
... | python | def instantaneous_tpole(self):
"""
compute the instantaenous temperature at the pole to achieve the mean
effective temperature (teff) provided by the user
"""
logger.debug("{}.instantaneous_tpole".format(self.component))
if 'tpole' not in self.inst_vals.keys():
... | [
"def",
"instantaneous_tpole",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}.instantaneous_tpole\"",
".",
"format",
"(",
"self",
".",
"component",
")",
")",
"if",
"'tpole'",
"not",
"in",
"self",
".",
"inst_vals",
".",
"keys",
"(",
")",
":",
"l... | compute the instantaenous temperature at the pole to achieve the mean
effective temperature (teff) provided by the user | [
"compute",
"the",
"instantaenous",
"temperature",
"at",
"the",
"pole",
"to",
"achieve",
"the",
"mean",
"effective",
"temperature",
"(",
"teff",
")",
"provided",
"by",
"the",
"user"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1482-L1498 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._fill_loggs | def _fill_loggs(self, mesh=None, ignore_effects=False):
"""
TODO: add documentation
Calculate local surface gravity
GMSunNom = 1.3271244e20 m**3 s**-2
RSunNom = 6.597e8 m
"""
logger.debug("{}._fill_loggs".format(self.component))
if mesh is None:
... | python | def _fill_loggs(self, mesh=None, ignore_effects=False):
"""
TODO: add documentation
Calculate local surface gravity
GMSunNom = 1.3271244e20 m**3 s**-2
RSunNom = 6.597e8 m
"""
logger.debug("{}._fill_loggs".format(self.component))
if mesh is None:
... | [
"def",
"_fill_loggs",
"(",
"self",
",",
"mesh",
"=",
"None",
",",
"ignore_effects",
"=",
"False",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._fill_loggs\"",
".",
"format",
"(",
"self",
".",
"component",
")",
")",
"if",
"mesh",
"is",
"None",
":",
"mes... | TODO: add documentation
Calculate local surface gravity
GMSunNom = 1.3271244e20 m**3 s**-2
RSunNom = 6.597e8 m | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1507-L1535 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._fill_gravs | def _fill_gravs(self, mesh=None, **kwargs):
"""
TODO: add documentation
requires _fill_loggs to have been called
"""
logger.debug("{}._fill_gravs".format(self.component))
if mesh is None:
mesh = self.mesh
# TODO: rename 'gravs' to 'gdcs' (gravity da... | python | def _fill_gravs(self, mesh=None, **kwargs):
"""
TODO: add documentation
requires _fill_loggs to have been called
"""
logger.debug("{}._fill_gravs".format(self.component))
if mesh is None:
mesh = self.mesh
# TODO: rename 'gravs' to 'gdcs' (gravity da... | [
"def",
"_fill_gravs",
"(",
"self",
",",
"mesh",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._fill_gravs\"",
".",
"format",
"(",
"self",
".",
"component",
")",
")",
"if",
"mesh",
"is",
"None",
":",
"mesh",
"=",
... | TODO: add documentation
requires _fill_loggs to have been called | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1537-L1557 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._fill_teffs | def _fill_teffs(self, mesh=None, ignore_effects=False, **kwargs):
r"""
requires _fill_loggs and _fill_gravs to have been called
Calculate local temperature of a Star.
"""
logger.debug("{}._fill_teffs".format(self.component))
if mesh is None:
mesh = self.mes... | python | def _fill_teffs(self, mesh=None, ignore_effects=False, **kwargs):
r"""
requires _fill_loggs and _fill_gravs to have been called
Calculate local temperature of a Star.
"""
logger.debug("{}._fill_teffs".format(self.component))
if mesh is None:
mesh = self.mes... | [
"def",
"_fill_teffs",
"(",
"self",
",",
"mesh",
"=",
"None",
",",
"ignore_effects",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._fill_teffs\"",
".",
"format",
"(",
"self",
".",
"component",
")",
")",
"if",
"mesh"... | r"""
requires _fill_loggs and _fill_gravs to have been called
Calculate local temperature of a Star. | [
"r"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1560-L1588 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._fill_abuns | def _fill_abuns(self, mesh=None, abun=0.0):
"""
TODO: add documentation
"""
logger.debug("{}._fill_abuns".format(self.component))
if mesh is None:
mesh = self.mesh
# TODO: support from frontend
mesh.update_columns(abuns=abun)
if not self.ne... | python | def _fill_abuns(self, mesh=None, abun=0.0):
"""
TODO: add documentation
"""
logger.debug("{}._fill_abuns".format(self.component))
if mesh is None:
mesh = self.mesh
# TODO: support from frontend
mesh.update_columns(abuns=abun)
if not self.ne... | [
"def",
"_fill_abuns",
"(",
"self",
",",
"mesh",
"=",
"None",
",",
"abun",
"=",
"0.0",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._fill_abuns\"",
".",
"format",
"(",
"self",
".",
"component",
")",
")",
"if",
"mesh",
"is",
"None",
":",
"mesh",
"=",
... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1590-L1606 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._fill_albedos | def _fill_albedos(self, mesh=None, irrad_frac_refl=0.0):
"""
TODO: add documentation
"""
logger.debug("{}._fill_albedos".format(self.component))
if mesh is None:
mesh = self.mesh
mesh.update_columns(irrad_frac_refl=irrad_frac_refl)
if not self.needs... | python | def _fill_albedos(self, mesh=None, irrad_frac_refl=0.0):
"""
TODO: add documentation
"""
logger.debug("{}._fill_albedos".format(self.component))
if mesh is None:
mesh = self.mesh
mesh.update_columns(irrad_frac_refl=irrad_frac_refl)
if not self.needs... | [
"def",
"_fill_albedos",
"(",
"self",
",",
"mesh",
"=",
"None",
",",
"irrad_frac_refl",
"=",
"0.0",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._fill_albedos\"",
".",
"format",
"(",
"self",
".",
"component",
")",
")",
"if",
"mesh",
"is",
"None",
":",
"... | TODO: add documentation | [
"TODO",
":",
"add",
"documentation"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1608-L1622 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star.compute_pblum_scale | def compute_pblum_scale(self, dataset, pblum, **kwargs):
"""
intensities should already be computed for this dataset at the time for which pblum is being provided
TODO: add documentation
"""
logger.debug("{}.compute_pblum_scale(dataset={}, pblum={})".format(self.component, datas... | python | def compute_pblum_scale(self, dataset, pblum, **kwargs):
"""
intensities should already be computed for this dataset at the time for which pblum is being provided
TODO: add documentation
"""
logger.debug("{}.compute_pblum_scale(dataset={}, pblum={})".format(self.component, datas... | [
"def",
"compute_pblum_scale",
"(",
"self",
",",
"dataset",
",",
"pblum",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}.compute_pblum_scale(dataset={}, pblum={})\"",
".",
"format",
"(",
"self",
".",
"component",
",",
"dataset",
",",
"pbl... | intensities should already be computed for this dataset at the time for which pblum is being provided
TODO: add documentation | [
"intensities",
"should",
"already",
"be",
"computed",
"for",
"this",
"dataset",
"at",
"the",
"time",
"for",
"which",
"pblum",
"is",
"being",
"provided"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1655-L1669 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._populate_lp | def _populate_lp(self, dataset, **kwargs):
"""
Populate columns necessary for an LP dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables`
"""
logger.debug("{}._populate_lp(dataset={})".format(se... | python | def _populate_lp(self, dataset, **kwargs):
"""
Populate columns necessary for an LP dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables`
"""
logger.debug("{}._populate_lp(dataset={})".format(se... | [
"def",
"_populate_lp",
"(",
"self",
",",
"dataset",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._populate_lp(dataset={})\"",
".",
"format",
"(",
"self",
".",
"component",
",",
"dataset",
")",
")",
"profile_rest",
"=",
"kwargs",
".... | Populate columns necessary for an LP dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables` | [
"Populate",
"columns",
"necessary",
"for",
"an",
"LP",
"dataset"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1699-L1716 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._populate_rv | def _populate_rv(self, dataset, **kwargs):
"""
Populate columns necessary for an RV dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables`
"""
logger.debug("{}._populate_rv(dataset={})".format(se... | python | def _populate_rv(self, dataset, **kwargs):
"""
Populate columns necessary for an RV dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables`
"""
logger.debug("{}._populate_rv(dataset={})".format(se... | [
"def",
"_populate_rv",
"(",
"self",
",",
"dataset",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._populate_rv(dataset={})\"",
".",
"format",
"(",
"self",
".",
"component",
",",
"dataset",
")",
")",
"# We need to fill all the flux-related... | Populate columns necessary for an RV dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables` | [
"Populate",
"columns",
"necessary",
"for",
"an",
"RV",
"dataset"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1718-L1748 |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Star._populate_lc | def _populate_lc(self, dataset, **kwargs):
"""
Populate columns necessary for an LC dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables`
:raises NotImplementedError: if lc_method is not supported
... | python | def _populate_lc(self, dataset, **kwargs):
"""
Populate columns necessary for an LC dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables`
:raises NotImplementedError: if lc_method is not supported
... | [
"def",
"_populate_lc",
"(",
"self",
",",
"dataset",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"debug",
"(",
"\"{}._populate_lc(dataset={})\"",
".",
"format",
"(",
"self",
".",
"component",
",",
"dataset",
")",
")",
"lc_method",
"=",
"kwargs",
".",
... | Populate columns necessary for an LC dataset
This should not be called directly, but rather via :meth:`Body.populate_observable`
or :meth:`System.populate_observables`
:raises NotImplementedError: if lc_method is not supported | [
"Populate",
"columns",
"necessary",
"for",
"an",
"LC",
"dataset"
] | train | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1751-L1854 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.