repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
zabuldon/teslajsonpy | teslajsonpy/battery_sensor.py | Battery.update | def update(self):
"""Update the battery state."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_charging_params(self._id)
if data:
self.__battery_level = data['battery_level']
self.__charging_state = data['charging_state'] | python | def update(self):
"""Update the battery state."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_charging_params(self._id)
if data:
self.__battery_level = data['battery_level']
self.__charging_state = data['charging_state'] | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_controller",
".",
"update",
"(",
"self",
".",
"_id",
",",
"wake_if_asleep",
"=",
"False",
")",
"data",
"=",
"self",
".",
"_controller",
".",
"get_charging_params",
"(",
"self",
".",
"_id",
")",
"if... | Update the battery state. | [
"Update",
"the",
"battery",
"state",
"."
] | 673ecdb5c9483160fb1b97e30e62f2c863761c39 | https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/battery_sensor.py#L44-L50 | train |
zabuldon/teslajsonpy | teslajsonpy/battery_sensor.py | Range.update | def update(self):
"""Update the battery range state."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_charging_params(self._id)
if data:
self.__battery_range = data['battery_range']
self.__est_battery_range = data['est_battery... | python | def update(self):
"""Update the battery range state."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_charging_params(self._id)
if data:
self.__battery_range = data['battery_range']
self.__est_battery_range = data['est_battery... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_controller",
".",
"update",
"(",
"self",
".",
"_id",
",",
"wake_if_asleep",
"=",
"False",
")",
"data",
"=",
"self",
".",
"_controller",
".",
"get_charging_params",
"(",
"self",
".",
"_id",
")",
"if... | Update the battery range state. | [
"Update",
"the",
"battery",
"range",
"state",
"."
] | 673ecdb5c9483160fb1b97e30e62f2c863761c39 | https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/battery_sensor.py#L94-L108 | train |
zabuldon/teslajsonpy | teslajsonpy/vehicle.py | VehicleDevice.assumed_state | def assumed_state(self):
# pylint: disable=protected-access
"""Return whether the data is from an online vehicle."""
return (not self._controller.car_online[self.id()] and
(self._controller._last_update_time[self.id()] -
self._controller._last_wake_up_time[self.i... | python | def assumed_state(self):
# pylint: disable=protected-access
"""Return whether the data is from an online vehicle."""
return (not self._controller.car_online[self.id()] and
(self._controller._last_update_time[self.id()] -
self._controller._last_wake_up_time[self.i... | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"_controller",
".",
"car_online",
"[",
"self",
".",
"id",
"(",
")",
"]",
"and",
"(",
"self",
".",
"_controller",
".",
"_last_update_time",
"[",
"self",
".",
"id",
"(",
... | Return whether the data is from an online vehicle. | [
"Return",
"whether",
"the",
"data",
"is",
"from",
"an",
"online",
"vehicle",
"."
] | 673ecdb5c9483160fb1b97e30e62f2c863761c39 | https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/vehicle.py#L59-L65 | train |
zabuldon/teslajsonpy | teslajsonpy/gps.py | GPS.update | def update(self):
"""Update the current GPS location."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_drive_params(self._id)
if data:
self.__longitude = data['longitude']
self.__latitude = data['latitude']
self.__... | python | def update(self):
"""Update the current GPS location."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_drive_params(self._id)
if data:
self.__longitude = data['longitude']
self.__latitude = data['latitude']
self.__... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_controller",
".",
"update",
"(",
"self",
".",
"_id",
",",
"wake_if_asleep",
"=",
"False",
")",
"data",
"=",
"self",
".",
"_controller",
".",
"get_drive_params",
"(",
"self",
".",
"_id",
")",
"if",
... | Update the current GPS location. | [
"Update",
"the",
"current",
"GPS",
"location",
"."
] | 673ecdb5c9483160fb1b97e30e62f2c863761c39 | https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/gps.py#L53-L64 | train |
zabuldon/teslajsonpy | teslajsonpy/gps.py | Odometer.update | def update(self):
"""Update the odometer and the unit of measurement based on GUI."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_state_params(self._id)
if data:
self.__odometer = data['odometer']
data = self._controller.get_gui... | python | def update(self):
"""Update the odometer and the unit of measurement based on GUI."""
self._controller.update(self._id, wake_if_asleep=False)
data = self._controller.get_state_params(self._id)
if data:
self.__odometer = data['odometer']
data = self._controller.get_gui... | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_controller",
".",
"update",
"(",
"self",
".",
"_id",
",",
"wake_if_asleep",
"=",
"False",
")",
"data",
"=",
"self",
".",
"_controller",
".",
"get_state_params",
"(",
"self",
".",
"_id",
")",
"if",
... | Update the odometer and the unit of measurement based on GUI. | [
"Update",
"the",
"odometer",
"and",
"the",
"unit",
"of",
"measurement",
"based",
"on",
"GUI",
"."
] | 673ecdb5c9483160fb1b97e30e62f2c863761c39 | https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/gps.py#L102-L114 | train |
phoebe-project/phoebe2 | phoebe/parameters/dataset.py | lc | def lc(**kwargs):
"""
Create parameters for a new light curve dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.p... | python | def lc(**kwargs):
"""
Create parameters for a new light curve dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.p... | [
"def",
"lc",
"(",
"**",
"kwargs",
")",
":",
"obs_params",
"=",
"[",
"]",
"syn_params",
",",
"constraints",
"=",
"lc_syn",
"(",
"syn",
"=",
"False",
",",
"**",
"kwargs",
")",
"obs_params",
"+=",
"syn_params",
".",
"to_list",
"(",
")",
"return",
"Paramet... | Create parameters for a new light curve dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.ParameterSet` of all... | [
"Create",
"parameters",
"for",
"a",
"new",
"light",
"curve",
"dataset",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L58-L82 | train |
phoebe-project/phoebe2 | phoebe/parameters/dataset.py | rv | def rv(**kwargs):
"""
Create parameters for a new radial velocity dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.paramete... | python | def rv(**kwargs):
"""
Create parameters for a new radial velocity dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.paramete... | [
"def",
"rv",
"(",
"**",
"kwargs",
")",
":",
"obs_params",
"=",
"[",
"]",
"syn_params",
",",
"constraints",
"=",
"rv_syn",
"(",
"syn",
"=",
"False",
",",
"**",
"kwargs",
")",
"obs_params",
"+=",
"syn_params",
".",
"to_list",
"(",
")",
"return",
"Paramet... | Create parameters for a new radial velocity dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.ParameterSet` of... | [
"Create",
"parameters",
"for",
"a",
"new",
"radial",
"velocity",
"dataset",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L121-L140 | train |
phoebe-project/phoebe2 | phoebe/parameters/dataset.py | lp | def lp(**kwargs):
"""
Create parameters for a new line profile dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.... | python | def lp(**kwargs):
"""
Create parameters for a new line profile dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.... | [
"def",
"lp",
"(",
"**",
"kwargs",
")",
":",
"obs_params",
"=",
"[",
"]",
"syn_params",
",",
"constraints",
"=",
"lp_syn",
"(",
"syn",
"=",
"False",
",",
"**",
"kwargs",
")",
"obs_params",
"+=",
"syn_params",
".",
"to_list",
"(",
")",
"return",
"Paramet... | Create parameters for a new line profile dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.ParameterSet` of al... | [
"Create",
"parameters",
"for",
"a",
"new",
"line",
"profile",
"dataset",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L170-L189 | train |
phoebe-project/phoebe2 | phoebe/parameters/dataset.py | etv | def etv(**kwargs):
"""
Create parameters for a new eclipse timing variations dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: default for the values of any of the ParameterSet
:return: a :class:`pho... | python | def etv(**kwargs):
"""
Create parameters for a new eclipse timing variations dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: default for the values of any of the ParameterSet
:return: a :class:`pho... | [
"def",
"etv",
"(",
"**",
"kwargs",
")",
":",
"if",
"not",
"conf",
".",
"devel",
":",
"raise",
"NotImplementedError",
"(",
"\"'etv' dataset not officially supported for this release. Enable developer mode to test.\"",
")",
"obs_params",
"=",
"[",
"]",
"syn_params",
",",... | Create parameters for a new eclipse timing variations dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: default for the values of any of the ParameterSet
:return: a :class:`phoebe.parameters.parameters.Param... | [
"Create",
"parameters",
"for",
"a",
"new",
"eclipse",
"timing",
"variations",
"dataset",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L233-L253 | train |
phoebe-project/phoebe2 | phoebe/parameters/dataset.py | orb | def orb(**kwargs):
"""
Create parameters for a new orbit dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parame... | python | def orb(**kwargs):
"""
Create parameters for a new orbit dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parame... | [
"def",
"orb",
"(",
"**",
"kwargs",
")",
":",
"obs_params",
"=",
"[",
"]",
"syn_params",
",",
"constraints",
"=",
"orb_syn",
"(",
"syn",
"=",
"False",
",",
"**",
"kwargs",
")",
"obs_params",
"+=",
"syn_params",
".",
"to_list",
"(",
")",
"return",
"Param... | Create parameters for a new orbit dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.ParameterSet` of all newly... | [
"Create",
"parameters",
"for",
"a",
"new",
"orbit",
"dataset",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L291-L316 | train |
phoebe-project/phoebe2 | phoebe/parameters/dataset.py | mesh | def mesh(**kwargs):
"""
Create parameters for a new mesh dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parame... | python | def mesh(**kwargs):
"""
Create parameters for a new mesh dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parame... | [
"def",
"mesh",
"(",
"**",
"kwargs",
")",
":",
"obs_params",
"=",
"[",
"]",
"syn_params",
",",
"constraints",
"=",
"mesh_syn",
"(",
"syn",
"=",
"False",
",",
"**",
"kwargs",
")",
"obs_params",
"+=",
"syn_params",
".",
"to_list",
"(",
")",
"obs_params",
... | Create parameters for a new mesh dataset.
Generally, this will be used as an input to the kind argument in
:meth:`phoebe.frontend.bundle.Bundle.add_dataset`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.ParameterSet` of all newly
... | [
"Create",
"parameters",
"for",
"a",
"new",
"mesh",
"dataset",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L345-L367 | train |
pinax/pinax-teams | pinax/teams/decorators.py | team_required | def team_required(func=None):
"""
Decorator for views that require a team be supplied wither via a slug in the
url pattern or already set on the request object from the TeamMiddleware
"""
def decorator(view_func):
@functools.wraps(view_func, assigned=available_attrs(view_func))
def _... | python | def team_required(func=None):
"""
Decorator for views that require a team be supplied wither via a slug in the
url pattern or already set on the request object from the TeamMiddleware
"""
def decorator(view_func):
@functools.wraps(view_func, assigned=available_attrs(view_func))
def _... | [
"def",
"team_required",
"(",
"func",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"view_func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"view_func",
",",
"assigned",
"=",
"available_attrs",
"(",
"view_func",
")",
")",
"def",
"_wrapped_view",
"(",
... | Decorator for views that require a team be supplied wither via a slug in the
url pattern or already set on the request object from the TeamMiddleware | [
"Decorator",
"for",
"views",
"that",
"require",
"a",
"team",
"be",
"supplied",
"wither",
"via",
"a",
"slug",
"in",
"the",
"url",
"pattern",
"or",
"already",
"set",
"on",
"the",
"request",
"object",
"from",
"the",
"TeamMiddleware"
] | f8354ba0d32b3979d1dc18f50d23fd0096445ab7 | https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/decorators.py#L14-L29 | train |
pinax/pinax-teams | pinax/teams/decorators.py | manager_required | def manager_required(func=None):
"""
Decorator for views that require not only a team but also that a user be
logged in and be the manager or owner of that team.
"""
def decorator(view_func):
@team_required
@login_required
@functools.wraps(view_func, assigned=available_attrs(... | python | def manager_required(func=None):
"""
Decorator for views that require not only a team but also that a user be
logged in and be the manager or owner of that team.
"""
def decorator(view_func):
@team_required
@login_required
@functools.wraps(view_func, assigned=available_attrs(... | [
"def",
"manager_required",
"(",
"func",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"view_func",
")",
":",
"@",
"team_required",
"@",
"login_required",
"@",
"functools",
".",
"wraps",
"(",
"view_func",
",",
"assigned",
"=",
"available_attrs",
"(",
"view_... | Decorator for views that require not only a team but also that a user be
logged in and be the manager or owner of that team. | [
"Decorator",
"for",
"views",
"that",
"require",
"not",
"only",
"a",
"team",
"but",
"also",
"that",
"a",
"user",
"be",
"logged",
"in",
"and",
"be",
"the",
"manager",
"or",
"owner",
"of",
"that",
"team",
"."
] | f8354ba0d32b3979d1dc18f50d23fd0096445ab7 | https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/decorators.py#L32-L49 | train |
phoebe-project/phoebe2 | phoebe/backend/backends.py | _create_syns | def _create_syns(b, needed_syns):
"""
Create empty synthetics
:parameter b: the :class:`phoebe.frontend.bundle.Bundle`
:parameter list needed_syns: list of dictionaries containing kwargs to access
the dataset (dataset, component, kind)
:return: :class:`phoebe.parameters.parameters.Parameter... | python | def _create_syns(b, needed_syns):
"""
Create empty synthetics
:parameter b: the :class:`phoebe.frontend.bundle.Bundle`
:parameter list needed_syns: list of dictionaries containing kwargs to access
the dataset (dataset, component, kind)
:return: :class:`phoebe.parameters.parameters.Parameter... | [
"def",
"_create_syns",
"(",
"b",
",",
"needed_syns",
")",
":",
"params",
"=",
"[",
"]",
"for",
"needed_syn",
"in",
"needed_syns",
":",
"syn_kind",
"=",
"'{}'",
".",
"format",
"(",
"needed_syn",
"[",
"'kind'",
"]",
")",
"if",
"'times'",
"in",
"needed_syn"... | Create empty synthetics
:parameter b: the :class:`phoebe.frontend.bundle.Bundle`
:parameter list needed_syns: list of dictionaries containing kwargs to access
the dataset (dataset, component, kind)
:return: :class:`phoebe.parameters.parameters.ParameterSet` of all new parameters | [
"Create",
"empty",
"synthetics"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L253-L303 | train |
phoebe-project/phoebe2 | phoebe/backend/backends.py | _make_packet | def _make_packet(qualifier, value, time, info, **kwargs):
"""
where kwargs overrides info
"""
packet = {'dataset': kwargs.get('dataset', info['dataset']),
'component': kwargs.get('component', info['component']),
'kind': kwargs.get('kind', info['kind']),
'qualifi... | python | def _make_packet(qualifier, value, time, info, **kwargs):
"""
where kwargs overrides info
"""
packet = {'dataset': kwargs.get('dataset', info['dataset']),
'component': kwargs.get('component', info['component']),
'kind': kwargs.get('kind', info['kind']),
'qualifi... | [
"def",
"_make_packet",
"(",
"qualifier",
",",
"value",
",",
"time",
",",
"info",
",",
"**",
"kwargs",
")",
":",
"packet",
"=",
"{",
"'dataset'",
":",
"kwargs",
".",
"get",
"(",
"'dataset'",
",",
"info",
"[",
"'dataset'",
"]",
")",
",",
"'component'",
... | where kwargs overrides info | [
"where",
"kwargs",
"overrides",
"info"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L305-L317 | train |
phoebe-project/phoebe2 | phoebe/backend/backends.py | BaseBackend.run_checks | def run_checks(self, b, compute, times=[], **kwargs):
"""
run any sanity checks to make sure the parameters and options are legal
for this backend. If they are not, raise an error here to avoid errors
within the workers.
Any physics-checks that are backend-independent should be... | python | def run_checks(self, b, compute, times=[], **kwargs):
"""
run any sanity checks to make sure the parameters and options are legal
for this backend. If they are not, raise an error here to avoid errors
within the workers.
Any physics-checks that are backend-independent should be... | [
"def",
"run_checks",
"(",
"self",
",",
"b",
",",
"compute",
",",
"times",
"=",
"[",
"]",
",",
"**",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"run_checks is not implemented by the {} backend\"",
".",
"format",
"(",
"self",
".",
"__class__",
".... | run any sanity checks to make sure the parameters and options are legal
for this backend. If they are not, raise an error here to avoid errors
within the workers.
Any physics-checks that are backend-independent should be in
Bundle.run_checks, and don't need to be repeated here.
... | [
"run",
"any",
"sanity",
"checks",
"to",
"make",
"sure",
"the",
"parameters",
"and",
"options",
"are",
"legal",
"for",
"this",
"backend",
".",
"If",
"they",
"are",
"not",
"raise",
"an",
"error",
"here",
"to",
"avoid",
"errors",
"within",
"the",
"workers",
... | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L323-L335 | train |
phoebe-project/phoebe2 | phoebe/backend/backends.py | BaseBackend._fill_syns | def _fill_syns(self, new_syns, rpacketlists_per_worker):
"""
rpacket_per_worker is a list of packetlists as returned by _run_chunk
"""
# TODO: move to BaseBackendByDataset or BaseBackend?
logger.debug("rank:{}/{} {}._fill_syns".format(mpi.myrank, mpi.nprocs, self.__class__.__name... | python | def _fill_syns(self, new_syns, rpacketlists_per_worker):
"""
rpacket_per_worker is a list of packetlists as returned by _run_chunk
"""
# TODO: move to BaseBackendByDataset or BaseBackend?
logger.debug("rank:{}/{} {}._fill_syns".format(mpi.myrank, mpi.nprocs, self.__class__.__name... | [
"def",
"_fill_syns",
"(",
"self",
",",
"new_syns",
",",
"rpacketlists_per_worker",
")",
":",
"logger",
".",
"debug",
"(",
"\"rank:{}/{} {}._fill_syns\"",
".",
"format",
"(",
"mpi",
".",
"myrank",
",",
"mpi",
".",
"nprocs",
",",
"self",
".",
"__class__",
".",... | rpacket_per_worker is a list of packetlists as returned by _run_chunk | [
"rpacket_per_worker",
"is",
"a",
"list",
"of",
"packetlists",
"as",
"returned",
"by",
"_run_chunk"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L378-L393 | train |
phoebe-project/phoebe2 | phoebe/backend/backends.py | BaseBackend.run | def run(self, b, compute, times=[], **kwargs):
"""
if within mpirun, workers should call _run_worker instead of run
"""
self.run_checks(b, compute, times, **kwargs)
logger.debug("rank:{}/{} calling get_packet_and_syns".format(mpi.myrank, mpi.nprocs))
packet, new_syns = s... | python | def run(self, b, compute, times=[], **kwargs):
"""
if within mpirun, workers should call _run_worker instead of run
"""
self.run_checks(b, compute, times, **kwargs)
logger.debug("rank:{}/{} calling get_packet_and_syns".format(mpi.myrank, mpi.nprocs))
packet, new_syns = s... | [
"def",
"run",
"(",
"self",
",",
"b",
",",
"compute",
",",
"times",
"=",
"[",
"]",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"run_checks",
"(",
"b",
",",
"compute",
",",
"times",
",",
"**",
"kwargs",
")",
"logger",
".",
"debug",
"(",
"\"rank:{}/... | if within mpirun, workers should call _run_worker instead of run | [
"if",
"within",
"mpirun",
"workers",
"should",
"call",
"_run_worker",
"instead",
"of",
"run"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L404-L427 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | compute_volume | def compute_volume(sizes, centers, normals):
"""
Compute the numerical volume of a convex mesh
:parameter array sizes: array of sizes of triangles
:parameter array centers: array of centers of triangles (x,y,z)
:parameter array normals: array of normals of triangles (will normalize if not already)
... | python | def compute_volume(sizes, centers, normals):
"""
Compute the numerical volume of a convex mesh
:parameter array sizes: array of sizes of triangles
:parameter array centers: array of centers of triangles (x,y,z)
:parameter array normals: array of normals of triangles (will normalize if not already)
... | [
"def",
"compute_volume",
"(",
"sizes",
",",
"centers",
",",
"normals",
")",
":",
"normal_mags",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"normals",
",",
"axis",
"=",
"1",
")",
"return",
"np",
".",
"sum",
"(",
"sizes",
"*",
"(",
"(",
"centers",
"... | Compute the numerical volume of a convex mesh
:parameter array sizes: array of sizes of triangles
:parameter array centers: array of centers of triangles (x,y,z)
:parameter array normals: array of normals of triangles (will normalize if not already)
:return: the volume (float) | [
"Compute",
"the",
"numerical",
"volume",
"of",
"a",
"convex",
"mesh"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L13-L30 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | spin_in_system | def spin_in_system(incl, long_an):
"""
Spin in the plane of sky of a star given its inclination and "long_an"
incl - inclination of the star in the plane of sky
long_an - longitude of ascending node (equator) of the star in the plane of sky
Return:
spin - in plane of sky
"""
... | python | def spin_in_system(incl, long_an):
"""
Spin in the plane of sky of a star given its inclination and "long_an"
incl - inclination of the star in the plane of sky
long_an - longitude of ascending node (equator) of the star in the plane of sky
Return:
spin - in plane of sky
"""
... | [
"def",
"spin_in_system",
"(",
"incl",
",",
"long_an",
")",
":",
"return",
"np",
".",
"dot",
"(",
"Rz",
"(",
"long_an",
")",
",",
"np",
".",
"dot",
"(",
"Rx",
"(",
"-",
"incl",
")",
",",
"np",
".",
"array",
"(",
"[",
"0.",
",",
"0.",
",",
"1."... | Spin in the plane of sky of a star given its inclination and "long_an"
incl - inclination of the star in the plane of sky
long_an - longitude of ascending node (equator) of the star in the plane of sky
Return:
spin - in plane of sky | [
"Spin",
"in",
"the",
"plane",
"of",
"sky",
"of",
"a",
"star",
"given",
"its",
"inclination",
"and",
"long_an"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L103-L115 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | spin_in_roche | def spin_in_roche(s, etheta, elongan, eincl):
"""
Transform the spin s of a star on Kerpler orbit with
etheta - true anomaly
elongan - longitude of ascending node
eincl - inclination
from in the plane of sky reference frame into
the Roche reference frame.
"""
# m = Rz(long).Rx(-i... | python | def spin_in_roche(s, etheta, elongan, eincl):
"""
Transform the spin s of a star on Kerpler orbit with
etheta - true anomaly
elongan - longitude of ascending node
eincl - inclination
from in the plane of sky reference frame into
the Roche reference frame.
"""
# m = Rz(long).Rx(-i... | [
"def",
"spin_in_roche",
"(",
"s",
",",
"etheta",
",",
"elongan",
",",
"eincl",
")",
":",
"m",
"=",
"euler_trans_matrix",
"(",
"etheta",
",",
"elongan",
",",
"eincl",
")",
"return",
"np",
".",
"dot",
"(",
"m",
".",
"T",
",",
"s",
")"
] | Transform the spin s of a star on Kerpler orbit with
etheta - true anomaly
elongan - longitude of ascending node
eincl - inclination
from in the plane of sky reference frame into
the Roche reference frame. | [
"Transform",
"the",
"spin",
"s",
"of",
"a",
"star",
"on",
"Kerpler",
"orbit",
"with"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L117-L131 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | transform_position_array | def transform_position_array(array, pos, euler, is_normal, reverse=False):
"""
Transform any Nx3 position array by translating to a center-of-mass 'pos'
and applying an euler transformation
:parameter array array: numpy array of Nx3 positions in the original (star)
coordinate frame
:paramet... | python | def transform_position_array(array, pos, euler, is_normal, reverse=False):
"""
Transform any Nx3 position array by translating to a center-of-mass 'pos'
and applying an euler transformation
:parameter array array: numpy array of Nx3 positions in the original (star)
coordinate frame
:paramet... | [
"def",
"transform_position_array",
"(",
"array",
",",
"pos",
",",
"euler",
",",
"is_normal",
",",
"reverse",
"=",
"False",
")",
":",
"trans_matrix",
"=",
"euler_trans_matrix",
"(",
"*",
"euler",
")",
"if",
"not",
"reverse",
":",
"trans_matrix",
"=",
"trans_m... | Transform any Nx3 position array by translating to a center-of-mass 'pos'
and applying an euler transformation
:parameter array array: numpy array of Nx3 positions in the original (star)
coordinate frame
:parameter array pos: numpy array with length 3 giving cartesian
coordinates to offset ... | [
"Transform",
"any",
"Nx3",
"position",
"array",
"by",
"translating",
"to",
"a",
"center",
"-",
"of",
"-",
"mass",
"pos",
"and",
"applying",
"an",
"euler",
"transformation"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L165-L192 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | transform_velocity_array | def transform_velocity_array(array, pos_array, vel, euler, rotation_vel=(0,0,0)):
"""
Transform any Nx3 velocity vector array by adding the center-of-mass 'vel',
accounting for solid-body rotation, and applying an euler transformation.
:parameter array array: numpy array of Nx3 velocity vectors in the ... | python | def transform_velocity_array(array, pos_array, vel, euler, rotation_vel=(0,0,0)):
"""
Transform any Nx3 velocity vector array by adding the center-of-mass 'vel',
accounting for solid-body rotation, and applying an euler transformation.
:parameter array array: numpy array of Nx3 velocity vectors in the ... | [
"def",
"transform_velocity_array",
"(",
"array",
",",
"pos_array",
",",
"vel",
",",
"euler",
",",
"rotation_vel",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"trans_matrix",
"=",
"euler_trans_matrix",
"(",
"*",
"euler",
")",
"rotation_component",
"="... | Transform any Nx3 velocity vector array by adding the center-of-mass 'vel',
accounting for solid-body rotation, and applying an euler transformation.
:parameter array array: numpy array of Nx3 velocity vectors in the original
(star) coordinate frame
:parameter array pos_array: positions of the elem... | [
"Transform",
"any",
"Nx3",
"velocity",
"vector",
"array",
"by",
"adding",
"the",
"center",
"-",
"of",
"-",
"mass",
"vel",
"accounting",
"for",
"solid",
"-",
"body",
"rotation",
"and",
"applying",
"an",
"euler",
"transformation",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L194-L222 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | wd_grid_to_mesh_dict | def wd_grid_to_mesh_dict(the_grid, q, F, d):
"""
Transform a wd-style mesh to the format used by PHOEBE. Namely this handles
translating vertices from Nx9 to Nx3x3 and creating the array of indices
for each triangle.
:parameter record-array the_grid: output from discretize_wd_style
:parameter f... | python | def wd_grid_to_mesh_dict(the_grid, q, F, d):
"""
Transform a wd-style mesh to the format used by PHOEBE. Namely this handles
translating vertices from Nx9 to Nx3x3 and creating the array of indices
for each triangle.
:parameter record-array the_grid: output from discretize_wd_style
:parameter f... | [
"def",
"wd_grid_to_mesh_dict",
"(",
"the_grid",
",",
"q",
",",
"F",
",",
"d",
")",
":",
"triangles_9N",
"=",
"the_grid",
"[",
":",
",",
"4",
":",
"13",
"]",
"new_mesh",
"=",
"{",
"}",
"new_mesh",
"[",
"'compute_at_vertices'",
"]",
"=",
"False",
"new_me... | Transform a wd-style mesh to the format used by PHOEBE. Namely this handles
translating vertices from Nx9 to Nx3x3 and creating the array of indices
for each triangle.
:parameter record-array the_grid: output from discretize_wd_style
:parameter float q: mass-ratio (M_this/M_sibling)
:parameter floa... | [
"Transform",
"a",
"wd",
"-",
"style",
"mesh",
"to",
"the",
"format",
"used",
"by",
"PHOEBE",
".",
"Namely",
"this",
"handles",
"translating",
"vertices",
"from",
"Nx9",
"to",
"Nx3x3",
"and",
"creating",
"the",
"array",
"of",
"indices",
"for",
"each",
"tria... | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L225-L281 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | ComputedColumn.weighted_averages | def weighted_averages(self):
"""
Access to the weighted averages of the values at the vertices for each
triangle based on the weights provided by mesh.weights. This is most
useful for partially visible triangles when using libphoebe's
eclipse detection that returns weights for e... | python | def weighted_averages(self):
"""
Access to the weighted averages of the values at the vertices for each
triangle based on the weights provided by mesh.weights. This is most
useful for partially visible triangles when using libphoebe's
eclipse detection that returns weights for e... | [
"def",
"weighted_averages",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"mesh",
".",
"_compute_at_vertices",
":",
"return",
"None",
"vertices_per_triangle",
"=",
"self",
".",
"vertices_per_triangle",
"if",
"vertices_per_triangle",
".",
"ndim",
"==",
"2",
":... | Access to the weighted averages of the values at the vertices for each
triangle based on the weights provided by mesh.weights. This is most
useful for partially visible triangles when using libphoebe's
eclipse detection that returns weights for each vertex.
Note that weights by default... | [
"Access",
"to",
"the",
"weighted",
"averages",
"of",
"the",
"values",
"at",
"the",
"vertices",
"for",
"each",
"triangle",
"based",
"on",
"the",
"weights",
"provided",
"by",
"mesh",
".",
"weights",
".",
"This",
"is",
"most",
"useful",
"for",
"partially",
"v... | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L409-L435 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | Mesh.from_proto | def from_proto(cls, proto_mesh, scale,
pos, vel, euler, euler_vel,
rotation_vel=(0,0,0),
component_com_x=None):
"""
Turn a ProtoMesh into a Mesh scaled and placed in orbit.
Update all geometry fields from the proto reference fram... | python | def from_proto(cls, proto_mesh, scale,
pos, vel, euler, euler_vel,
rotation_vel=(0,0,0),
component_com_x=None):
"""
Turn a ProtoMesh into a Mesh scaled and placed in orbit.
Update all geometry fields from the proto reference fram... | [
"def",
"from_proto",
"(",
"cls",
",",
"proto_mesh",
",",
"scale",
",",
"pos",
",",
"vel",
",",
"euler",
",",
"euler_vel",
",",
"rotation_vel",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
",",
"component_com_x",
"=",
"None",
")",
":",
"mesh",
"=",
"cls"... | Turn a ProtoMesh into a Mesh scaled and placed in orbit.
Update all geometry fields from the proto reference frame, to the
current system reference frame, given the current position, velocitiy,
euler angles, and rotational velocity of THIS mesh.
:parameter list pos: current position (x... | [
"Turn",
"a",
"ProtoMesh",
"into",
"a",
"Mesh",
"scaled",
"and",
"placed",
"in",
"orbit",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1245-L1268 | train |
phoebe-project/phoebe2 | phoebe/backend/mesh.py | Meshes.update_columns | def update_columns(self, field, value_dict, inds=None, computed_type=None):
"""
update the columns of all meshes
:parameter str field: name of the mesh columnname
:parameter value_dict: dictionary with component as keys and new
data as values. If value_dict is not a dictiona... | python | def update_columns(self, field, value_dict, inds=None, computed_type=None):
"""
update the columns of all meshes
:parameter str field: name of the mesh columnname
:parameter value_dict: dictionary with component as keys and new
data as values. If value_dict is not a dictiona... | [
"def",
"update_columns",
"(",
"self",
",",
"field",
",",
"value_dict",
",",
"inds",
"=",
"None",
",",
"computed_type",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"value_dict",
",",
"dict",
")",
":",
"value_dict",
"=",
"{",
"comp_no",
":",
"... | update the columns of all meshes
:parameter str field: name of the mesh columnname
:parameter value_dict: dictionary with component as keys and new
data as values. If value_dict is not a dictionary,
it will be applied to all components
:type value_dict: dict or value (ar... | [
"update",
"the",
"columns",
"of",
"all",
"meshes"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1507-L1535 | train |
phoebe-project/phoebe2 | phoebe/dynamics/keplerian.py | _true_anomaly | def _true_anomaly(M,ecc,itermax=8):
r"""
Calculation of true and eccentric anomaly in Kepler orbits.
``M`` is the phase of the star, ``ecc`` is the eccentricity
See p.39 of Hilditch, 'An Introduction To Close Binary Stars':
Kepler's equation:
.. math::
E - e\sin E = \frac{2\pi}{P}(t... | python | def _true_anomaly(M,ecc,itermax=8):
r"""
Calculation of true and eccentric anomaly in Kepler orbits.
``M`` is the phase of the star, ``ecc`` is the eccentricity
See p.39 of Hilditch, 'An Introduction To Close Binary Stars':
Kepler's equation:
.. math::
E - e\sin E = \frac{2\pi}{P}(t... | [
"def",
"_true_anomaly",
"(",
"M",
",",
"ecc",
",",
"itermax",
"=",
"8",
")",
":",
"r",
"Fn",
"=",
"M",
"+",
"ecc",
"*",
"sin",
"(",
"M",
")",
"+",
"ecc",
"**",
"2",
"/",
"2.",
"*",
"sin",
"(",
"2",
"*",
"M",
")",
"for",
"i",
"in",
"range"... | r"""
Calculation of true and eccentric anomaly in Kepler orbits.
``M`` is the phase of the star, ``ecc`` is the eccentricity
See p.39 of Hilditch, 'An Introduction To Close Binary Stars':
Kepler's equation:
.. math::
E - e\sin E = \frac{2\pi}{P}(t-T)
with :math:`E` the eccentric an... | [
"r",
"Calculation",
"of",
"true",
"and",
"eccentric",
"anomaly",
"in",
"Kepler",
"orbits",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dynamics/keplerian.py#L394-L445 | train |
phoebe-project/phoebe2 | phoebe/parameters/feature.py | spot | def spot(feature, **kwargs):
"""
Create parameters for a spot
Generally, this will be used as input to the method argument in
:meth:`phoebe.frontend.bundle.Bundle.add_feature`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.... | python | def spot(feature, **kwargs):
"""
Create parameters for a spot
Generally, this will be used as input to the method argument in
:meth:`phoebe.frontend.bundle.Bundle.add_feature`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.... | [
"def",
"spot",
"(",
"feature",
",",
"**",
"kwargs",
")",
":",
"params",
"=",
"[",
"]",
"params",
"+=",
"[",
"FloatParameter",
"(",
"qualifier",
"=",
"\"colat\"",
",",
"value",
"=",
"kwargs",
".",
"get",
"(",
"'colat'",
",",
"0.0",
")",
",",
"default_... | Create parameters for a spot
Generally, this will be used as input to the method argument in
:meth:`phoebe.frontend.bundle.Bundle.add_feature`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.ParameterSet` | [
"Create",
"parameters",
"for",
"a",
"spot"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/feature.py#L17-L40 | train |
phoebe-project/phoebe2 | phoebe/parameters/feature.py | pulsation | def pulsation(feature, **kwargs):
"""
Create parameters for a pulsation feature
Generally, this will be used as input to the method argument in
:meth:`phoebe.frontend.bundle.Bundle.add_feature`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.para... | python | def pulsation(feature, **kwargs):
"""
Create parameters for a pulsation feature
Generally, this will be used as input to the method argument in
:meth:`phoebe.frontend.bundle.Bundle.add_feature`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.para... | [
"def",
"pulsation",
"(",
"feature",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"conf",
".",
"devel",
":",
"raise",
"NotImplementedError",
"(",
"\"'pulsation' feature not officially supported for this release. Enable developer mode to test.\"",
")",
"params",
"=",
"[",
... | Create parameters for a pulsation feature
Generally, this will be used as input to the method argument in
:meth:`phoebe.frontend.bundle.Bundle.add_feature`
:parameter **kwargs: defaults for the values of any of the parameters
:return: a :class:`phoebe.parameters.parameters.ParameterSet` | [
"Create",
"parameters",
"for",
"a",
"pulsation",
"feature"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/feature.py#L42-L67 | train |
phoebe-project/phoebe2 | phoebe/frontend/io.py | load_lc_data | def load_lc_data(filename, indep, dep, indweight=None, mzero=None, dir='./'):
"""
load dictionary with lc data
"""
if '/' in filename:
path, filename = os.path.split(filename)
else:
# TODO: this needs to change to be directory of the .phoebe file
path = dir
load_file = ... | python | def load_lc_data(filename, indep, dep, indweight=None, mzero=None, dir='./'):
"""
load dictionary with lc data
"""
if '/' in filename:
path, filename = os.path.split(filename)
else:
# TODO: this needs to change to be directory of the .phoebe file
path = dir
load_file = ... | [
"def",
"load_lc_data",
"(",
"filename",
",",
"indep",
",",
"dep",
",",
"indweight",
"=",
"None",
",",
"mzero",
"=",
"None",
",",
"dir",
"=",
"'./'",
")",
":",
"if",
"'/'",
"in",
"filename",
":",
"path",
",",
"filename",
"=",
"os",
".",
"path",
".",... | load dictionary with lc data | [
"load",
"dictionary",
"with",
"lc",
"data"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/io.py#L242-L282 | train |
phoebe-project/phoebe2 | phoebe/frontend/io.py | load_rv_data | def load_rv_data(filename, indep, dep, indweight=None, dir='./'):
"""
load dictionary with rv data.
"""
if '/' in filename:
path, filename = os.path.split(filename)
else:
path = dir
load_file = os.path.join(path, filename)
rvdata = np.loadtxt(load_file)
d ={}
d['p... | python | def load_rv_data(filename, indep, dep, indweight=None, dir='./'):
"""
load dictionary with rv data.
"""
if '/' in filename:
path, filename = os.path.split(filename)
else:
path = dir
load_file = os.path.join(path, filename)
rvdata = np.loadtxt(load_file)
d ={}
d['p... | [
"def",
"load_rv_data",
"(",
"filename",
",",
"indep",
",",
"dep",
",",
"indweight",
"=",
"None",
",",
"dir",
"=",
"'./'",
")",
":",
"if",
"'/'",
"in",
"filename",
":",
"path",
",",
"filename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"filename",
... | load dictionary with rv data. | [
"load",
"dictionary",
"with",
"rv",
"data",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/io.py#L284-L317 | train |
phoebe-project/phoebe2 | phoebe/frontend/io.py | det_dataset | def det_dataset(eb, passband, dataid, comp, time):
"""
Since RV datasets can have values related to each component in phoebe2, but are component specific in phoebe1
, it is important to determine which dataset to add parameters to. This function will do that.
eb - bundle
rvpt - relevant phoebe 1 pa... | python | def det_dataset(eb, passband, dataid, comp, time):
"""
Since RV datasets can have values related to each component in phoebe2, but are component specific in phoebe1
, it is important to determine which dataset to add parameters to. This function will do that.
eb - bundle
rvpt - relevant phoebe 1 pa... | [
"def",
"det_dataset",
"(",
"eb",
",",
"passband",
",",
"dataid",
",",
"comp",
",",
"time",
")",
":",
"rvs",
"=",
"eb",
".",
"get_dataset",
"(",
"kind",
"=",
"'rv'",
")",
".",
"datasets",
"if",
"dataid",
"==",
"'Undefined'",
":",
"dataid",
"=",
"None"... | Since RV datasets can have values related to each component in phoebe2, but are component specific in phoebe1
, it is important to determine which dataset to add parameters to. This function will do that.
eb - bundle
rvpt - relevant phoebe 1 parameters | [
"Since",
"RV",
"datasets",
"can",
"have",
"values",
"related",
"to",
"each",
"component",
"in",
"phoebe2",
"but",
"are",
"component",
"specific",
"in",
"phoebe1",
"it",
"is",
"important",
"to",
"determine",
"which",
"dataset",
"to",
"add",
"parameters",
"to",
... | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/io.py#L319-L380 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | rpole_to_pot_aligned | def rpole_to_pot_aligned(rpole, sma, q, F, d, component=1):
"""
Transforms polar radius to surface potential
"""
q = q_for_component(q, component=component)
rpole_ = np.array([0, 0, rpole/sma])
logger.debug("libphoebe.roche_Omega(q={}, F={}, d={}, rpole={})".format(q, F, d, rpole_))
pot = li... | python | def rpole_to_pot_aligned(rpole, sma, q, F, d, component=1):
"""
Transforms polar radius to surface potential
"""
q = q_for_component(q, component=component)
rpole_ = np.array([0, 0, rpole/sma])
logger.debug("libphoebe.roche_Omega(q={}, F={}, d={}, rpole={})".format(q, F, d, rpole_))
pot = li... | [
"def",
"rpole_to_pot_aligned",
"(",
"rpole",
",",
"sma",
",",
"q",
",",
"F",
",",
"d",
",",
"component",
"=",
"1",
")",
":",
"q",
"=",
"q_for_component",
"(",
"q",
",",
"component",
"=",
"component",
")",
"rpole_",
"=",
"np",
".",
"array",
"(",
"["... | Transforms polar radius to surface potential | [
"Transforms",
"polar",
"radius",
"to",
"surface",
"potential"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L81-L89 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | pot_to_rpole_aligned | def pot_to_rpole_aligned(pot, sma, q, F, d, component=1):
"""
Transforms surface potential to polar radius
"""
q = q_for_component(q, component=component)
Phi = pot_for_component(pot, q, component=component)
logger.debug("libphobe.roche_pole(q={}, F={}, d={}, Omega={})".format(q, F, d, pot))
... | python | def pot_to_rpole_aligned(pot, sma, q, F, d, component=1):
"""
Transforms surface potential to polar radius
"""
q = q_for_component(q, component=component)
Phi = pot_for_component(pot, q, component=component)
logger.debug("libphobe.roche_pole(q={}, F={}, d={}, Omega={})".format(q, F, d, pot))
... | [
"def",
"pot_to_rpole_aligned",
"(",
"pot",
",",
"sma",
",",
"q",
",",
"F",
",",
"d",
",",
"component",
"=",
"1",
")",
":",
"q",
"=",
"q_for_component",
"(",
"q",
",",
"component",
"=",
"component",
")",
"Phi",
"=",
"pot_for_component",
"(",
"pot",
",... | Transforms surface potential to polar radius | [
"Transforms",
"surface",
"potential",
"to",
"polar",
"radius"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L91-L98 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | BinaryRoche | def BinaryRoche (r, D, q, F, Omega=0.0):
r"""
Computes a value of the asynchronous, eccentric Roche potential.
If :envvar:`Omega` is passed, it computes the difference.
The asynchronous, eccentric Roche potential is given by [Wilson1979]_
.. math::
\Omega = \frac{1}{\sqrt{x^2 + y^2 + z^2... | python | def BinaryRoche (r, D, q, F, Omega=0.0):
r"""
Computes a value of the asynchronous, eccentric Roche potential.
If :envvar:`Omega` is passed, it computes the difference.
The asynchronous, eccentric Roche potential is given by [Wilson1979]_
.. math::
\Omega = \frac{1}{\sqrt{x^2 + y^2 + z^2... | [
"def",
"BinaryRoche",
"(",
"r",
",",
"D",
",",
"q",
",",
"F",
",",
"Omega",
"=",
"0.0",
")",
":",
"r",
"return",
"1.0",
"/",
"sqrt",
"(",
"r",
"[",
"0",
"]",
"*",
"r",
"[",
"0",
"]",
"+",
"r",
"[",
"1",
"]",
"*",
"r",
"[",
"1",
"]",
"... | r"""
Computes a value of the asynchronous, eccentric Roche potential.
If :envvar:`Omega` is passed, it computes the difference.
The asynchronous, eccentric Roche potential is given by [Wilson1979]_
.. math::
\Omega = \frac{1}{\sqrt{x^2 + y^2 + z^2}} + q\left(\frac{1}{\sqrt{(x-D)^2+y^2+z^2}} ... | [
"r",
"Computes",
"a",
"value",
"of",
"the",
"asynchronous",
"eccentric",
"Roche",
"potential",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L110-L133 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | dBinaryRochedx | def dBinaryRochedx (r, D, q, F):
"""
Computes a derivative of the potential with respect to x.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return -r[0]*(r[0]*r[0]+r[1]*r... | python | def dBinaryRochedx (r, D, q, F):
"""
Computes a derivative of the potential with respect to x.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return -r[0]*(r[0]*r[0]+r[1]*r... | [
"def",
"dBinaryRochedx",
"(",
"r",
",",
"D",
",",
"q",
",",
"F",
")",
":",
"return",
"-",
"r",
"[",
"0",
"]",
"*",
"(",
"r",
"[",
"0",
"]",
"*",
"r",
"[",
"0",
"]",
"+",
"r",
"[",
"1",
"]",
"*",
"r",
"[",
"1",
"]",
"+",
"r",
"[",
"2... | Computes a derivative of the potential with respect to x.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter | [
"Computes",
"a",
"derivative",
"of",
"the",
"potential",
"with",
"respect",
"to",
"x",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L135-L144 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | d2BinaryRochedx2 | def d2BinaryRochedx2(r, D, q, F):
"""
Computes second derivative of the potential with respect to x.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return (2*r[0]*r[0]-r[1]... | python | def d2BinaryRochedx2(r, D, q, F):
"""
Computes second derivative of the potential with respect to x.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return (2*r[0]*r[0]-r[1]... | [
"def",
"d2BinaryRochedx2",
"(",
"r",
",",
"D",
",",
"q",
",",
"F",
")",
":",
"return",
"(",
"2",
"*",
"r",
"[",
"0",
"]",
"*",
"r",
"[",
"0",
"]",
"-",
"r",
"[",
"1",
"]",
"*",
"r",
"[",
"1",
"]",
"-",
"r",
"[",
"2",
"]",
"*",
"r",
... | Computes second derivative of the potential with respect to x.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter | [
"Computes",
"second",
"derivative",
"of",
"the",
"potential",
"with",
"respect",
"to",
"x",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L146-L157 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | dBinaryRochedy | def dBinaryRochedy (r, D, q, F):
"""
Computes a derivative of the potential with respect to y.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return -r[1]*(r[0]*r[0]+r[1]*r... | python | def dBinaryRochedy (r, D, q, F):
"""
Computes a derivative of the potential with respect to y.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return -r[1]*(r[0]*r[0]+r[1]*r... | [
"def",
"dBinaryRochedy",
"(",
"r",
",",
"D",
",",
"q",
",",
"F",
")",
":",
"return",
"-",
"r",
"[",
"1",
"]",
"*",
"(",
"r",
"[",
"0",
"]",
"*",
"r",
"[",
"0",
"]",
"+",
"r",
"[",
"1",
"]",
"*",
"r",
"[",
"1",
"]",
"+",
"r",
"[",
"2... | Computes a derivative of the potential with respect to y.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter | [
"Computes",
"a",
"derivative",
"of",
"the",
"potential",
"with",
"respect",
"to",
"y",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L159-L168 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | dBinaryRochedz | def dBinaryRochedz(r, D, q, F):
"""
Computes a derivative of the potential with respect to z.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return -r[2]*(r[0]*r[0]+r[1]*r... | python | def dBinaryRochedz(r, D, q, F):
"""
Computes a derivative of the potential with respect to z.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
return -r[2]*(r[0]*r[0]+r[1]*r... | [
"def",
"dBinaryRochedz",
"(",
"r",
",",
"D",
",",
"q",
",",
"F",
")",
":",
"return",
"-",
"r",
"[",
"2",
"]",
"*",
"(",
"r",
"[",
"0",
"]",
"*",
"r",
"[",
"0",
"]",
"+",
"r",
"[",
"1",
"]",
"*",
"r",
"[",
"1",
"]",
"+",
"r",
"[",
"2... | Computes a derivative of the potential with respect to z.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter | [
"Computes",
"a",
"derivative",
"of",
"the",
"potential",
"with",
"respect",
"to",
"z",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L170-L179 | train |
phoebe-project/phoebe2 | phoebe/distortions/roche.py | dBinaryRochedr | def dBinaryRochedr (r, D, q, F):
"""
Computes a derivative of the potential with respect to r.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
r2 = (r*r).sum()
r1 = np.... | python | def dBinaryRochedr (r, D, q, F):
"""
Computes a derivative of the potential with respect to r.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter
"""
r2 = (r*r).sum()
r1 = np.... | [
"def",
"dBinaryRochedr",
"(",
"r",
",",
"D",
",",
"q",
",",
"F",
")",
":",
"r2",
"=",
"(",
"r",
"*",
"r",
")",
".",
"sum",
"(",
")",
"r1",
"=",
"np",
".",
"sqrt",
"(",
"r2",
")",
"return",
"-",
"1.",
"/",
"r2",
"-",
"q",
"*",
"(",
"r1",... | Computes a derivative of the potential with respect to r.
@param r: relative radius vector (3 components)
@param D: instantaneous separation
@param q: mass ratio
@param F: synchronicity parameter | [
"Computes",
"a",
"derivative",
"of",
"the",
"potential",
"with",
"respect",
"to",
"r",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L181-L194 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | send_if_client | def send_if_client(fctn):
"""Intercept and send to the server if bundle is in client mode."""
@functools.wraps(fctn)
def _send_if_client(self, *args, **kwargs):
fctn_map = {'set_quantity': 'set_value'}
b = self._bundle
if b is not None and b.is_client:
# TODO: self._filte... | python | def send_if_client(fctn):
"""Intercept and send to the server if bundle is in client mode."""
@functools.wraps(fctn)
def _send_if_client(self, *args, **kwargs):
fctn_map = {'set_quantity': 'set_value'}
b = self._bundle
if b is not None and b.is_client:
# TODO: self._filte... | [
"def",
"send_if_client",
"(",
"fctn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fctn",
")",
"def",
"_send_if_client",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"fctn_map",
"=",
"{",
"'set_quantity'",
":",
"'set_value'",
"}",
"... | Intercept and send to the server if bundle is in client mode. | [
"Intercept",
"and",
"send",
"to",
"the",
"server",
"if",
"bundle",
"is",
"in",
"client",
"mode",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L183-L208 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | update_if_client | def update_if_client(fctn):
"""Intercept and check updates from server if bundle is in client mode."""
@functools.wraps(fctn)
def _update_if_client(self, *args, **kwargs):
b = self._bundle
if b is None or not hasattr(b, 'is_client'):
return fctn(self, *args, **kwargs)
eli... | python | def update_if_client(fctn):
"""Intercept and check updates from server if bundle is in client mode."""
@functools.wraps(fctn)
def _update_if_client(self, *args, **kwargs):
b = self._bundle
if b is None or not hasattr(b, 'is_client'):
return fctn(self, *args, **kwargs)
eli... | [
"def",
"update_if_client",
"(",
"fctn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fctn",
")",
"def",
"_update_if_client",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"b",
"=",
"self",
".",
"_bundle",
"if",
"b",
"is",
"None",
... | Intercept and check updates from server if bundle is in client mode. | [
"Intercept",
"and",
"check",
"updates",
"from",
"server",
"if",
"bundle",
"is",
"in",
"client",
"mode",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L211-L224 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | _uniqueid | def _uniqueid(n=30):
"""Return a unique string with length n.
:parameter int N: number of character in the uniqueid
:return: the uniqueid
:rtype: str
"""
return ''.join(random.SystemRandom().choice(
string.ascii_uppercase + string.ascii_lowercase)
for _ in ... | python | def _uniqueid(n=30):
"""Return a unique string with length n.
:parameter int N: number of character in the uniqueid
:return: the uniqueid
:rtype: str
"""
return ''.join(random.SystemRandom().choice(
string.ascii_uppercase + string.ascii_lowercase)
for _ in ... | [
"def",
"_uniqueid",
"(",
"n",
"=",
"30",
")",
":",
"return",
"''",
".",
"join",
"(",
"random",
".",
"SystemRandom",
"(",
")",
".",
"choice",
"(",
"string",
".",
"ascii_uppercase",
"+",
"string",
".",
"ascii_lowercase",
")",
"for",
"_",
"in",
"range",
... | Return a unique string with length n.
:parameter int N: number of character in the uniqueid
:return: the uniqueid
:rtype: str | [
"Return",
"a",
"unique",
"string",
"with",
"length",
"n",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L227-L236 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | parameter_from_json | def parameter_from_json(dictionary, bundle=None):
"""Load a single parameter from a JSON dictionary.
:parameter dict dictionary: the dictionary containing the parameter
information
:parameter bundle: (optional)
:return: instantiated :class:`Parameter` object
"""
if isinstance(dictionary... | python | def parameter_from_json(dictionary, bundle=None):
"""Load a single parameter from a JSON dictionary.
:parameter dict dictionary: the dictionary containing the parameter
information
:parameter bundle: (optional)
:return: instantiated :class:`Parameter` object
"""
if isinstance(dictionary... | [
"def",
"parameter_from_json",
"(",
"dictionary",
",",
"bundle",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"dictionary",
",",
"str",
")",
":",
"dictionary",
"=",
"json",
".",
"loads",
"(",
"dictionary",
",",
"object_pairs_hook",
"=",
"parse_json",
")",
... | Load a single parameter from a JSON dictionary.
:parameter dict dictionary: the dictionary containing the parameter
information
:parameter bundle: (optional)
:return: instantiated :class:`Parameter` object | [
"Load",
"a",
"single",
"parameter",
"from",
"a",
"JSON",
"dictionary",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L252-L273 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.get_meta | def get_meta(self, ignore=['uniqueid']):
"""Dictionary of all meta-tags, with option to ignore certain tags.
See all the meta-tag properties that are shared by ALL Parameters.
If a given value is 'None', that means that it is not shared
among ALL Parameters. To see the different values... | python | def get_meta(self, ignore=['uniqueid']):
"""Dictionary of all meta-tags, with option to ignore certain tags.
See all the meta-tag properties that are shared by ALL Parameters.
If a given value is 'None', that means that it is not shared
among ALL Parameters. To see the different values... | [
"def",
"get_meta",
"(",
"self",
",",
"ignore",
"=",
"[",
"'uniqueid'",
"]",
")",
":",
"return",
"OrderedDict",
"(",
"[",
"(",
"k",
",",
"getattr",
"(",
"self",
",",
"k",
")",
")",
"for",
"k",
"in",
"_meta_fields_twig",
"if",
"k",
"not",
"in",
"igno... | Dictionary of all meta-tags, with option to ignore certain tags.
See all the meta-tag properties that are shared by ALL Parameters.
If a given value is 'None', that means that it is not shared
among ALL Parameters. To see the different values among the
Parameters, you can access that a... | [
"Dictionary",
"of",
"all",
"meta",
"-",
"tags",
"with",
"option",
"to",
"ignore",
"certain",
"tags",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L382-L396 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.set_meta | def set_meta(self, **kwargs):
"""Set the value of tags for all Parameters in this ParameterSet."""
for param in self.to_list():
for k, v in kwargs.items():
# Here we'll set the attributes (_context, _qualifier, etc)
if getattr(param, '_{}'.format(k)) is None:
... | python | def set_meta(self, **kwargs):
"""Set the value of tags for all Parameters in this ParameterSet."""
for param in self.to_list():
for k, v in kwargs.items():
# Here we'll set the attributes (_context, _qualifier, etc)
if getattr(param, '_{}'.format(k)) is None:
... | [
"def",
"set_meta",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"for",
"param",
"in",
"self",
".",
"to_list",
"(",
")",
":",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"getattr",
"(",
"param",
",",
"'_{}'",
".",
"fo... | Set the value of tags for all Parameters in this ParameterSet. | [
"Set",
"the",
"value",
"of",
"tags",
"for",
"all",
"Parameters",
"in",
"this",
"ParameterSet",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L398-L404 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet.tags | def tags(self):
"""Returns a dictionary that lists all available tags that can be used
for further filtering
"""
ret = {}
for typ in _meta_fields_twig:
if typ in ['uniqueid', 'plugin', 'feedback', 'fitting', 'history', 'twig', 'uniquetwig']:
continue
... | python | def tags(self):
"""Returns a dictionary that lists all available tags that can be used
for further filtering
"""
ret = {}
for typ in _meta_fields_twig:
if typ in ['uniqueid', 'plugin', 'feedback', 'fitting', 'history', 'twig', 'uniquetwig']:
continue
... | [
"def",
"tags",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"typ",
"in",
"_meta_fields_twig",
":",
"if",
"typ",
"in",
"[",
"'uniqueid'",
",",
"'plugin'",
",",
"'feedback'",
",",
"'fitting'",
",",
"'history'",
",",
"'twig'",
",",
"'uniquetwig'",
... | Returns a dictionary that lists all available tags that can be used
for further filtering | [
"Returns",
"a",
"dictionary",
"that",
"lists",
"all",
"available",
"tags",
"that",
"can",
"be",
"used",
"for",
"further",
"filtering"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L407-L419 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet._set_meta | def _set_meta(self):
"""
set the meta fields of the ParameterSet as those that are shared
by ALL parameters in the ParameterSet. For any fields that are
not
"""
# we want to set meta-fields that are shared by ALL params in the PS
for field in _meta_fields_twig:
... | python | def _set_meta(self):
"""
set the meta fields of the ParameterSet as those that are shared
by ALL parameters in the ParameterSet. For any fields that are
not
"""
# we want to set meta-fields that are shared by ALL params in the PS
for field in _meta_fields_twig:
... | [
"def",
"_set_meta",
"(",
"self",
")",
":",
"for",
"field",
"in",
"_meta_fields_twig",
":",
"keys_for_this_field",
"=",
"set",
"(",
"[",
"getattr",
"(",
"p",
",",
"field",
")",
"for",
"p",
"in",
"self",
".",
"to_list",
"(",
")",
"if",
"getattr",
"(",
... | set the meta fields of the ParameterSet as those that are shared
by ALL parameters in the ParameterSet. For any fields that are
not | [
"set",
"the",
"meta",
"fields",
"of",
"the",
"ParameterSet",
"as",
"those",
"that",
"are",
"shared",
"by",
"ALL",
"parameters",
"in",
"the",
"ParameterSet",
".",
"For",
"any",
"fields",
"that",
"are",
"not"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L736-L750 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet._uniquetwig | def _uniquetwig(self, twig, force_levels=['qualifier']):
"""
get the least unique twig for the parameter given by twig that
will return this single result for THIS PS
:parameter str twig: a twig that will return a single Parameter from
THIS PS
:parameter list for... | python | def _uniquetwig(self, twig, force_levels=['qualifier']):
"""
get the least unique twig for the parameter given by twig that
will return this single result for THIS PS
:parameter str twig: a twig that will return a single Parameter from
THIS PS
:parameter list for... | [
"def",
"_uniquetwig",
"(",
"self",
",",
"twig",
",",
"force_levels",
"=",
"[",
"'qualifier'",
"]",
")",
":",
"for_this_param",
"=",
"self",
".",
"filter",
"(",
"twig",
",",
"check_visible",
"=",
"False",
")",
"metawargs",
"=",
"{",
"}",
"if",
"'context'"... | get the least unique twig for the parameter given by twig that
will return this single result for THIS PS
:parameter str twig: a twig that will return a single Parameter from
THIS PS
:parameter list force_levels: (optional) a list of "levels"
(eg. context) that shoul... | [
"get",
"the",
"least",
"unique",
"twig",
"for",
"the",
"parameter",
"given",
"by",
"twig",
"that",
"will",
"return",
"this",
"single",
"result",
"for",
"THIS",
"PS"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L752-L822 | train |
phoebe-project/phoebe2 | phoebe/parameters/parameters.py | ParameterSet._check_copy_for | def _check_copy_for(self):
"""Check the value of copy_for and make appropriate copies."""
if not self._bundle:
return
# read the following at your own risk - I just wrote it and it still
# confuses me and baffles me that it works
for param in self.to_list():
... | python | def _check_copy_for(self):
"""Check the value of copy_for and make appropriate copies."""
if not self._bundle:
return
# read the following at your own risk - I just wrote it and it still
# confuses me and baffles me that it works
for param in self.to_list():
... | [
"def",
"_check_copy_for",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_bundle",
":",
"return",
"for",
"param",
"in",
"self",
".",
"to_list",
"(",
")",
":",
"if",
"param",
".",
"copy_for",
":",
"attrs",
"=",
"[",
"k",
"for",
"k",
",",
"v",
"... | Check the value of copy_for and make appropriate copies. | [
"Check",
"the",
"value",
"of",
"copy_for",
"and",
"make",
"appropriate",
"copies",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L844-L927 | train |
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",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L929-L943 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1004-L1032 | train |
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",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1177-L1225 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1268-L1280 | train |
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",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1283-L1314 | train |
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... | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1316-L1357 | train |
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",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1576-L1584 | train |
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",
")",
":",
"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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L1643-L1652 | train |
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",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2783-L2790 | train |
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",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L2792-L2804 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3053-L3067 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3130-L3138 | train |
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",
"==",
"choice",... | expand the selection to account for wildcards | [
"expand",
"the",
"selection",
"to",
"account",
"for",
"wildcards"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L3882-L3894 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4479-L4485 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4488-L4499 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4511-L4518 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4521-L4532 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4535-L4550 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4756-L4764 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L4948-L4960 | train |
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",
"(",
")",
")",
"return",
"[",
"l",
"[",
"i",
"+",
"1",
"]",
"for",
"i",
",",
"s",
"in",
"enumerate",
"(",
"l",
")",
... | get 'component' of all stars in order primary -> secondary | [
"get",
"component",
"of",
"all",
"stars",
"in",
"order",
"primary",
"-",
">",
"secondary"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5008-L5014 | train |
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",
")",
":",
"orbits",
"=",
"[",
"]",
"for",
"star",
"in",
"self",
".",
"get_stars",
"(",
")",
":",
"parent",
"=",
"self",
".",
"get_parent_of",
"(",
"star",
")",
"if",
"parent",
"not",
"in",
"orbits",
"and",
"parent",
... | get 'component' of all orbits in order primary -> secondary | [
"get",
"component",
"of",
"all",
"orbits",
"in",
"order",
"primary",
"-",
">",
"secondary"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5024-L5036 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5097-L5113 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5116-L5134 | train |
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",
":",
"return",
"'primary'",
"children_of_parent",
"="... | 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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5171-L5191 | train |
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",
")",
":",
"if",
"self",
".",
"_var_params",
"is",
"None",
":",
"self",
".",
"_var_params",
"=",
"ParameterSet",
"(",
"[",
"var",
".",
"get_parameter",
"(",
")",
"for",
"var",
"in",
"self",
".",
"_vars",
"]",
")",
"return",... | return all the variables in a PS | [
"return",
"all",
"the",
"variables",
"in",
"a",
"PS"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5331-L5338 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5404-L5420 | train |
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",
"(",
")",
"kwargs",
"[",
"'twig'",
"]",
"=",
"twig",
"newly_constrained_var",
"=",... | 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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L5719-L5791 | train |
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",
"(",
")",
"bound_fields",
"=",
"[",
"\"data\"",
",",
"\"files\"",
"]",
"for",
"field",
"in",
"bound_fields",
":",
"form_kwargs",
".",
"pop",
"(",
"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"
] | f8354ba0d32b3979d1dc18f50d23fd0096445ab7 | https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/views.py#L216-L227 | train |
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",
"."
] | f8354ba0d32b3979d1dc18f50d23fd0096445ab7 | https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/views.py#L236-L275 | train |
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",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'value'",
")",
":",
"return",
"obj",
".",
"value",
"elif",
"isinstance",
"(",
"obj",
",",
"np",
".",
"ndarray",
")",
":",
"return",
"np",
".",
"array",
"(",
"[",
"o",
".",
... | make sure to get a float | [
"make",
"sure",
"to",
"get",
"a",
"float"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L74-L86 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L88-L93 | train |
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",
".",
"g... | 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",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L464-L544 | train |
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",
",",
"pblum",
... | 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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1655-L1669 | train |
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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1699-L1716 | train |
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",
")",
")",
"lc_cols",
"=",
"self",
".",
"_popula... | 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"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L1718-L1748 | train |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Spot.from_bundle | def from_bundle(cls, b, feature):
"""
Initialize a Spot feature from the bundle.
"""
feature_ps = b.get_feature(feature)
colat = feature_ps.get_value('colat', unit=u.rad)
longitude = feature_ps.get_value('long', unit=u.rad)
if len(b.hierarchy.get_stars())>=2:
... | python | def from_bundle(cls, b, feature):
"""
Initialize a Spot feature from the bundle.
"""
feature_ps = b.get_feature(feature)
colat = feature_ps.get_value('colat', unit=u.rad)
longitude = feature_ps.get_value('long', unit=u.rad)
if len(b.hierarchy.get_stars())>=2:
... | [
"def",
"from_bundle",
"(",
"cls",
",",
"b",
",",
"feature",
")",
":",
"feature_ps",
"=",
"b",
".",
"get_feature",
"(",
"feature",
")",
"colat",
"=",
"feature_ps",
".",
"get_value",
"(",
"'colat'",
",",
"unit",
"=",
"u",
".",
"rad",
")",
"longitude",
... | Initialize a Spot feature from the bundle. | [
"Initialize",
"a",
"Spot",
"feature",
"from",
"the",
"bundle",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L2840-L2866 | train |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Spot.pointing_vector | def pointing_vector(self, s, time):
"""
s is the spin vector in roche coordinates
time is the current time
"""
t = time - self._t0
longitude = self._longitude + self._dlongdt * t
# define the basis vectors in the spin (primed) coordinates in terms of
# th... | python | def pointing_vector(self, s, time):
"""
s is the spin vector in roche coordinates
time is the current time
"""
t = time - self._t0
longitude = self._longitude + self._dlongdt * t
# define the basis vectors in the spin (primed) coordinates in terms of
# th... | [
"def",
"pointing_vector",
"(",
"self",
",",
"s",
",",
"time",
")",
":",
"t",
"=",
"time",
"-",
"self",
".",
"_t0",
"longitude",
"=",
"self",
".",
"_longitude",
"+",
"self",
".",
"_dlongdt",
"*",
"t",
"ex",
"=",
"np",
".",
"array",
"(",
"[",
"1.",... | s is the spin vector in roche coordinates
time is the current time | [
"s",
"is",
"the",
"spin",
"vector",
"in",
"roche",
"coordinates",
"time",
"is",
"the",
"current",
"time"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L2874-L2894 | train |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Spot.process_teffs | def process_teffs(self, teffs, coords, s=np.array([0., 0., 1.]), t=None):
"""
Change the local effective temperatures for any values within the
"cone" defined by the spot. Any teff within the spot will have its
current value multiplied by the "relteff" factor
:parameter array t... | python | def process_teffs(self, teffs, coords, s=np.array([0., 0., 1.]), t=None):
"""
Change the local effective temperatures for any values within the
"cone" defined by the spot. Any teff within the spot will have its
current value multiplied by the "relteff" factor
:parameter array t... | [
"def",
"process_teffs",
"(",
"self",
",",
"teffs",
",",
"coords",
",",
"s",
"=",
"np",
".",
"array",
"(",
"[",
"0.",
",",
"0.",
",",
"1.",
"]",
")",
",",
"t",
"=",
"None",
")",
":",
"if",
"t",
"is",
"None",
":",
"t",
"=",
"self",
".",
"_t0"... | Change the local effective temperatures for any values within the
"cone" defined by the spot. Any teff within the spot will have its
current value multiplied by the "relteff" factor
:parameter array teffs: array of teffs for computations
:parameter array coords: array of coords for com... | [
"Change",
"the",
"local",
"effective",
"temperatures",
"for",
"any",
"values",
"within",
"the",
"cone",
"defined",
"by",
"the",
"spot",
".",
"Any",
"teff",
"within",
"the",
"spot",
"will",
"have",
"its",
"current",
"value",
"multiplied",
"by",
"the",
"reltef... | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L2896-L2919 | train |
phoebe-project/phoebe2 | phoebe/backend/universe.py | Pulsation.from_bundle | def from_bundle(cls, b, feature):
"""
Initialize a Pulsation feature from the bundle.
"""
feature_ps = b.get_feature(feature)
freq = feature_ps.get_value('freq', unit=u.d**-1)
radamp = feature_ps.get_value('radamp', unit=u.dimensionless_unscaled)
l = feature_ps.g... | python | def from_bundle(cls, b, feature):
"""
Initialize a Pulsation feature from the bundle.
"""
feature_ps = b.get_feature(feature)
freq = feature_ps.get_value('freq', unit=u.d**-1)
radamp = feature_ps.get_value('radamp', unit=u.dimensionless_unscaled)
l = feature_ps.g... | [
"def",
"from_bundle",
"(",
"cls",
",",
"b",
",",
"feature",
")",
":",
"feature_ps",
"=",
"b",
".",
"get_feature",
"(",
"feature",
")",
"freq",
"=",
"feature_ps",
".",
"get_value",
"(",
"'freq'",
",",
"unit",
"=",
"u",
".",
"d",
"**",
"-",
"1",
")",... | Initialize a Pulsation feature from the bundle. | [
"Initialize",
"a",
"Pulsation",
"feature",
"from",
"the",
"bundle",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/universe.py#L2932-L2949 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.from_server | def from_server(cls, bundleid, server='http://localhost:5555',
as_client=True):
"""Load a new bundle from a server.
[NOT IMPLEMENTED]
Load a bundle from a phoebe server. This is a constructor so should be
called as:
>>> b = Bundle.from_server('asdf', as_cl... | python | def from_server(cls, bundleid, server='http://localhost:5555',
as_client=True):
"""Load a new bundle from a server.
[NOT IMPLEMENTED]
Load a bundle from a phoebe server. This is a constructor so should be
called as:
>>> b = Bundle.from_server('asdf', as_cl... | [
"def",
"from_server",
"(",
"cls",
",",
"bundleid",
",",
"server",
"=",
"'http://localhost:5555'",
",",
"as_client",
"=",
"True",
")",
":",
"if",
"not",
"conf",
".",
"devel",
":",
"raise",
"NotImplementedError",
"(",
"\"'from_server' not officially supported for this... | Load a new bundle from a server.
[NOT IMPLEMENTED]
Load a bundle from a phoebe server. This is a constructor so should be
called as:
>>> b = Bundle.from_server('asdf', as_client=False)
:parameter str bundleid: the identifier given to the bundle by the
server
... | [
"Load",
"a",
"new",
"bundle",
"from",
"a",
"server",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L320-L358 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.from_legacy | def from_legacy(cls, filename, add_compute_legacy=True, add_compute_phoebe=True):
"""Load a bundle from a PHOEBE 1.0 Legacy file.
This is a constructor so should be called as:
>>> b = Bundle.from_legacy('myfile.phoebe')
:parameter str filename: relative or full path to the file
... | python | def from_legacy(cls, filename, add_compute_legacy=True, add_compute_phoebe=True):
"""Load a bundle from a PHOEBE 1.0 Legacy file.
This is a constructor so should be called as:
>>> b = Bundle.from_legacy('myfile.phoebe')
:parameter str filename: relative or full path to the file
... | [
"def",
"from_legacy",
"(",
"cls",
",",
"filename",
",",
"add_compute_legacy",
"=",
"True",
",",
"add_compute_phoebe",
"=",
"True",
")",
":",
"logger",
".",
"warning",
"(",
"\"importing from legacy is experimental until official 1.0 release\"",
")",
"filename",
"=",
"o... | Load a bundle from a PHOEBE 1.0 Legacy file.
This is a constructor so should be called as:
>>> b = Bundle.from_legacy('myfile.phoebe')
:parameter str filename: relative or full path to the file
:return: instantiated :class:`Bundle` object | [
"Load",
"a",
"bundle",
"from",
"a",
"PHOEBE",
"1",
".",
"0",
"Legacy",
"file",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L382-L394 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.default_triple | def default_triple(cls, inner_as_primary=True, inner_as_overcontact=False,
starA='starA', starB='starB', starC='starC',
inner='inner', outer='outer',
contact_envelope='contact_envelope'):
"""Load a bundle with a default triple system.
... | python | def default_triple(cls, inner_as_primary=True, inner_as_overcontact=False,
starA='starA', starB='starB', starC='starC',
inner='inner', outer='outer',
contact_envelope='contact_envelope'):
"""Load a bundle with a default triple system.
... | [
"def",
"default_triple",
"(",
"cls",
",",
"inner_as_primary",
"=",
"True",
",",
"inner_as_overcontact",
"=",
"False",
",",
"starA",
"=",
"'starA'",
",",
"starB",
"=",
"'starB'",
",",
"starC",
"=",
"'starC'",
",",
"inner",
"=",
"'inner'",
",",
"outer",
"=",... | Load a bundle with a default triple system.
Set inner_as_primary based on what hierarchical configuration you want.
inner_as_primary = True:
starA - starB -- starC
inner_as_primary = False:
starC -- starA - starB
This is a constructor, so should be called as:
... | [
"Load",
"a",
"bundle",
"with",
"a",
"default",
"triple",
"system",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L521-L578 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.save | def save(self, filename, clear_history=True, incl_uniqueid=False,
compact=False):
"""Save the bundle to a JSON-formatted ASCII file.
:parameter str filename: relative or full path to the file
:parameter bool clear_history: whether to clear history log
items before savin... | python | def save(self, filename, clear_history=True, incl_uniqueid=False,
compact=False):
"""Save the bundle to a JSON-formatted ASCII file.
:parameter str filename: relative or full path to the file
:parameter bool clear_history: whether to clear history log
items before savin... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"clear_history",
"=",
"True",
",",
"incl_uniqueid",
"=",
"False",
",",
"compact",
"=",
"False",
")",
":",
"if",
"clear_history",
":",
"self",
".",
"remove_history",
"(",
")",
"return",
"super",
"(",
"Bund... | Save the bundle to a JSON-formatted ASCII file.
:parameter str filename: relative or full path to the file
:parameter bool clear_history: whether to clear history log
items before saving (default: True)
:parameter bool incl_uniqueid: whether to including uniqueids in the
... | [
"Save",
"the",
"bundle",
"to",
"a",
"JSON",
"-",
"formatted",
"ASCII",
"file",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L580-L602 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle._default_label | def _default_label(self, base, context, **kwargs):
"""
Determine a default label given a base label and the passed kwargs
this simply counts the current number of matches on metawargs and
appends that number to the base
:parameter str base: the base string for the label
... | python | def _default_label(self, base, context, **kwargs):
"""
Determine a default label given a base label and the passed kwargs
this simply counts the current number of matches on metawargs and
appends that number to the base
:parameter str base: the base string for the label
... | [
"def",
"_default_label",
"(",
"self",
",",
"base",
",",
"context",
",",
"**",
"kwargs",
")",
":",
"kwargs",
"[",
"'context'",
"]",
"=",
"context",
"params",
"=",
"len",
"(",
"getattr",
"(",
"self",
".",
"filter",
"(",
"check_visible",
"=",
"False",
","... | Determine a default label given a base label and the passed kwargs
this simply counts the current number of matches on metawargs and
appends that number to the base
:parameter str base: the base string for the label
:parameter str context: name of the context (where the label is going)... | [
"Determine",
"a",
"default",
"label",
"given",
"a",
"base",
"label",
"and",
"the",
"passed",
"kwargs"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L764-L781 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.get_setting | def get_setting(self, twig=None, **kwargs):
"""
Filter in the 'setting' context
:parameter str twig: the twig used for filtering
:parameter **kwargs: any other tags to do the filter (except tag or
context)
:return: :class:`phoebe.parameters.parameters.ParameterSet`
... | python | def get_setting(self, twig=None, **kwargs):
"""
Filter in the 'setting' context
:parameter str twig: the twig used for filtering
:parameter **kwargs: any other tags to do the filter (except tag or
context)
:return: :class:`phoebe.parameters.parameters.ParameterSet`
... | [
"def",
"get_setting",
"(",
"self",
",",
"twig",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"twig",
"is",
"not",
"None",
":",
"kwargs",
"[",
"'twig'",
"]",
"=",
"twig",
"kwargs",
"[",
"'context'",
"]",
"=",
"'setting'",
"return",
"self",
".",
... | Filter in the 'setting' context
:parameter str twig: the twig used for filtering
:parameter **kwargs: any other tags to do the filter (except tag or
context)
:return: :class:`phoebe.parameters.parameters.ParameterSet` | [
"Filter",
"in",
"the",
"setting",
"context"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L797-L809 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.get_history | def get_history(self, i=None):
"""
Get a history item by index.
You can toggle whether history is recorded using
* :meth:`enable_history`
* :meth:`disable_history`
:parameter int i: integer for indexing (can be positive or
negative). If i is None or... | python | def get_history(self, i=None):
"""
Get a history item by index.
You can toggle whether history is recorded using
* :meth:`enable_history`
* :meth:`disable_history`
:parameter int i: integer for indexing (can be positive or
negative). If i is None or... | [
"def",
"get_history",
"(",
"self",
",",
"i",
"=",
"None",
")",
":",
"ps",
"=",
"self",
".",
"filter",
"(",
"context",
"=",
"'history'",
")",
"if",
"i",
"is",
"not",
"None",
":",
"return",
"ps",
".",
"to_list",
"(",
")",
"[",
"i",
"]",
"else",
"... | Get a history item by index.
You can toggle whether history is recorded using
* :meth:`enable_history`
* :meth:`disable_history`
:parameter int i: integer for indexing (can be positive or
negative). If i is None or not provided, the entire list
of histo... | [
"Get",
"a",
"history",
"item",
"by",
"index",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L853-L876 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.remove_history | def remove_history(self, i=None):
"""
Remove a history item from the bundle by index.
You can toggle whether history is recorded using
* :meth:`enable_history`
* :meth:`disable_history`
:parameter int i: integer for indexing (can be positive or
nega... | python | def remove_history(self, i=None):
"""
Remove a history item from the bundle by index.
You can toggle whether history is recorded using
* :meth:`enable_history`
* :meth:`disable_history`
:parameter int i: integer for indexing (can be positive or
nega... | [
"def",
"remove_history",
"(",
"self",
",",
"i",
"=",
"None",
")",
":",
"if",
"i",
"is",
"None",
":",
"self",
".",
"remove_parameters_all",
"(",
"context",
"=",
"'history'",
")",
"else",
":",
"param",
"=",
"self",
".",
"get_history",
"(",
"i",
"=",
"i... | Remove a history item from the bundle by index.
You can toggle whether history is recorded using
* :meth:`enable_history`
* :meth:`disable_history`
:parameter int i: integer for indexing (can be positive or
negative). If i is None or not provided, the entire list
... | [
"Remove",
"a",
"history",
"item",
"from",
"the",
"bundle",
"by",
"index",
"."
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L878-L896 | train |
phoebe-project/phoebe2 | phoebe/frontend/bundle.py | Bundle.undo | def undo(self, i=-1):
"""
Undo an item in the history logs
:parameter int i: integer for indexing (can be positive or
negative). Defaults to -1 if not provided (the latest
recorded history item)
:raises ValueError: if no history items have been recorded
... | python | def undo(self, i=-1):
"""
Undo an item in the history logs
:parameter int i: integer for indexing (can be positive or
negative). Defaults to -1 if not provided (the latest
recorded history item)
:raises ValueError: if no history items have been recorded
... | [
"def",
"undo",
"(",
"self",
",",
"i",
"=",
"-",
"1",
")",
":",
"_history_enabled",
"=",
"self",
".",
"history_enabled",
"param",
"=",
"self",
".",
"get_history",
"(",
"i",
")",
"self",
".",
"disable_history",
"(",
")",
"param",
".",
"undo",
"(",
")",... | Undo an item in the history logs
:parameter int i: integer for indexing (can be positive or
negative). Defaults to -1 if not provided (the latest
recorded history item)
:raises ValueError: if no history items have been recorded | [
"Undo",
"an",
"item",
"in",
"the",
"history",
"logs"
] | e64b8be683977064e2d55dd1b3ac400f64c3e379 | https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L936-L953 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.