repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
zabuldon/teslajsonpy
teslajsonpy/lock.py
Lock.unlock
def unlock(self): """Unlock the doors and extend handles where applicable.""" if self.__lock_state: data = self._controller.command(self._id, 'door_unlock', wake_if_asleep=True) if data['response']['result']: self.__lock...
python
def unlock(self): """Unlock the doors and extend handles where applicable.""" if self.__lock_state: data = self._controller.command(self._id, 'door_unlock', wake_if_asleep=True) if data['response']['result']: self.__lock...
[ "def", "unlock", "(", "self", ")", ":", "if", "self", ".", "__lock_state", ":", "data", "=", "self", ".", "_controller", ".", "command", "(", "self", ".", "_id", ",", "'door_unlock'", ",", "wake_if_asleep", "=", "True", ")", "if", "data", "[", "'respon...
Unlock the doors and extend handles where applicable.
[ "Unlock", "the", "doors", "and", "extend", "handles", "where", "applicable", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/lock.py#L66-L73
zabuldon/teslajsonpy
teslajsonpy/lock.py
ChargerLock.lock
def lock(self): """Close the charger door.""" if not self.__lock_state: data = self._controller.command(self._id, 'charge_port_door_close', wake_if_asleep=True) if data['response']['result']: self.__lock_state = True ...
python
def lock(self): """Close the charger door.""" if not self.__lock_state: data = self._controller.command(self._id, 'charge_port_door_close', wake_if_asleep=True) if data['response']['result']: self.__lock_state = True ...
[ "def", "lock", "(", "self", ")", ":", "if", "not", "self", ".", "__lock_state", ":", "data", "=", "self", ".", "_controller", ".", "command", "(", "self", ".", "_id", ",", "'charge_port_door_close'", ",", "wake_if_asleep", "=", "True", ")", "if", "data",...
Close the charger door.
[ "Close", "the", "charger", "door", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/lock.py#L128-L135
zabuldon/teslajsonpy
teslajsonpy/controller.py
Controller.wake_up
def wake_up(func): # pylint: disable=no-self-argument # issue is use of wraps on classmethods which should be replaced: # https://hynek.me/articles/decorators/ """Wrap a API f so it will attempt to wake the vehicle if asleep. The command f is run once if the vehicle_id was la...
python
def wake_up(func): # pylint: disable=no-self-argument # issue is use of wraps on classmethods which should be replaced: # https://hynek.me/articles/decorators/ """Wrap a API f so it will attempt to wake the vehicle if asleep. The command f is run once if the vehicle_id was la...
[ "def", "wake_up", "(", "func", ")", ":", "# pylint: disable=no-self-argument", "# issue is use of wraps on classmethods which should be replaced:", "# https://hynek.me/articles/decorators/", "@", "wraps", "(", "func", ")", "def", "wrapped", "(", "*", "args", ",", "*", "*...
Wrap a API f so it will attempt to wake the vehicle if asleep. The command f is run once if the vehicle_id was last reported online. Assuming f returns None and wake_if_asleep is True, 5 attempts will be made to wake the vehicle to reissue the command. In addition, if there is a `could_...
[ "Wrap", "a", "API", "f", "so", "it", "will", "attempt", "to", "wake", "the", "vehicle", "if", "asleep", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/controller.py#L95-L209
zabuldon/teslajsonpy
teslajsonpy/controller.py
Controller.post
def post(self, vehicle_id, command, data=None, wake_if_asleep=True): # pylint: disable=unused-argument """Send post command to the vehicle_id. This is a wrapped function by wake_up. Parameters ---------- vehicle_id : string Identifier for the car on the own...
python
def post(self, vehicle_id, command, data=None, wake_if_asleep=True): # pylint: disable=unused-argument """Send post command to the vehicle_id. This is a wrapped function by wake_up. Parameters ---------- vehicle_id : string Identifier for the car on the own...
[ "def", "post", "(", "self", ",", "vehicle_id", ",", "command", ",", "data", "=", "None", ",", "wake_if_asleep", "=", "True", ")", ":", "# pylint: disable=unused-argument", "data", "=", "data", "or", "{", "}", "return", "self", ".", "__connection", ".", "p...
Send post command to the vehicle_id. This is a wrapped function by wake_up. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the car across differen...
[ "Send", "post", "command", "to", "the", "vehicle_id", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/controller.py#L216-L245
zabuldon/teslajsonpy
teslajsonpy/controller.py
Controller.get
def get(self, vehicle_id, command, wake_if_asleep=False): # pylint: disable=unused-argument """Send get command to the vehicle_id. This is a wrapped function by wake_up. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpo...
python
def get(self, vehicle_id, command, wake_if_asleep=False): # pylint: disable=unused-argument """Send get command to the vehicle_id. This is a wrapped function by wake_up. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpo...
[ "def", "get", "(", "self", ",", "vehicle_id", ",", "command", ",", "wake_if_asleep", "=", "False", ")", ":", "# pylint: disable=unused-argument", "return", "self", ".", "__connection", ".", "get", "(", "'vehicles/%i/%s'", "%", "(", "vehicle_id", ",", "command",...
Send get command to the vehicle_id. This is a wrapped function by wake_up. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the car across different...
[ "Send", "get", "command", "to", "the", "vehicle_id", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/controller.py#L248-L273
zabuldon/teslajsonpy
teslajsonpy/controller.py
Controller.data_request
def data_request(self, vehicle_id, name, wake_if_asleep=False): """Get requested data from vehicle_id. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the car a...
python
def data_request(self, vehicle_id, name, wake_if_asleep=False): """Get requested data from vehicle_id. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the car a...
[ "def", "data_request", "(", "self", ",", "vehicle_id", ",", "name", ",", "wake_if_asleep", "=", "False", ")", ":", "return", "self", ".", "get", "(", "vehicle_id", ",", "'vehicle_data/%s'", "%", "name", ",", "wake_if_asleep", "=", "wake_if_asleep", ")", "[",...
Get requested data from vehicle_id. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the car across different endpoints. https://tesla-api.timdor...
[ "Get", "requested", "data", "from", "vehicle_id", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/controller.py#L275-L300
zabuldon/teslajsonpy
teslajsonpy/controller.py
Controller.command
def command(self, vehicle_id, name, data=None, wake_if_asleep=True): """Post name command to the vehicle_id. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the...
python
def command(self, vehicle_id, name, data=None, wake_if_asleep=True): """Post name command to the vehicle_id. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the...
[ "def", "command", "(", "self", ",", "vehicle_id", ",", "name", ",", "data", "=", "None", ",", "wake_if_asleep", "=", "True", ")", ":", "data", "=", "data", "or", "{", "}", "return", "self", ".", "post", "(", "vehicle_id", ",", "'command/%s'", "%", "n...
Post name command to the vehicle_id. Parameters ---------- vehicle_id : string Identifier for the car on the owner-api endpoint. Confusingly it is not the vehicle_id field for identifying the car across different endpoints. https://tesla-api.timdo...
[ "Post", "name", "command", "to", "the", "vehicle_id", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/controller.py#L302-L328
zabuldon/teslajsonpy
teslajsonpy/controller.py
Controller.update
def update(self, car_id=None, wake_if_asleep=False, force=False): """Update all vehicle attributes in the cache. This command will connect to the Tesla API and first update the list of online vehicles assuming no attempt for at least the [update_interval]. It will then update all the ca...
python
def update(self, car_id=None, wake_if_asleep=False, force=False): """Update all vehicle attributes in the cache. This command will connect to the Tesla API and first update the list of online vehicles assuming no attempt for at least the [update_interval]. It will then update all the ca...
[ "def", "update", "(", "self", ",", "car_id", "=", "None", ",", "wake_if_asleep", "=", "False", ",", "force", "=", "False", ")", ":", "cur_time", "=", "time", ".", "time", "(", ")", "with", "self", ".", "__lock", ":", "# Update the online cars using get_ve...
Update all vehicle attributes in the cache. This command will connect to the Tesla API and first update the list of online vehicles assuming no attempt for at least the [update_interval]. It will then update all the cached values for cars that are awake assuming no update has occurred f...
[ "Update", "all", "vehicle", "attributes", "in", "the", "cache", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/controller.py#L351-L413
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", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/battery_sensor.py#L44-L50
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", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/battery_sensor.py#L94-L108
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", ")", ":", "# pylint: disable=protected-access", "return", "(", "not", "self", ".", "_controller", ".", "car_online", "[", "self", ".", "id", "(", ")", "]", "and", "(", "self", ".", "_controller", ".", "_last_update_time", ...
Return whether the data is from an online vehicle.
[ "Return", "whether", "the", "data", "is", "from", "an", "online", "vehicle", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/vehicle.py#L59-L65
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", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/gps.py#L53-L64
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", "." ]
train
https://github.com/zabuldon/teslajsonpy/blob/673ecdb5c9483160fb1b97e30e62f2c863761c39/teslajsonpy/gps.py#L102-L114
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", "(", ")", "#obs_pa...
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L58-L82
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", "=", "[", "]", "#obs_params += [FloatParameter(qualifier='statweight', value = kwargs.get('statweight', 1.0), default_unit=u.dimensionless_unscaled, description='Statistical weight in overall fitting')]", "syn_params", ",", ...
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L121-L140
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", "=", "[", "]", "#obs_params += [FloatParameter(qualifier='statweight', value = kwargs.get('statweight', 1.0), default_unit=u.dimensionless_unscaled, description='Statistical weight in overall fitting')]", "syn_params", ",", ...
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L170-L189
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L233-L253
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", "=", "[", "]", "#~ obs_params += [FloatArrayParameter(qualifier='exptime', value=kwargs.get('exptime', []), default_unit=u.s, description='Signal exposure time')]", "#~ obs_params += [FloatArrayParameter(qualifier='flag', value...
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L291-L316
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...
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/dataset.py#L345-L367
phoebe-project/phoebe2
phoebe/parameters/compute.py
phoebe
def phoebe(**kwargs): """ Compute options for using the PHOEBE 2.0 backend. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.phoebe` for a list of sources to cite when using this backend...
python
def phoebe(**kwargs): """ Compute options for using the PHOEBE 2.0 backend. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.phoebe` for a list of sources to cite when using this backend...
[ "def", "phoebe", "(", "*", "*", "kwargs", ")", ":", "params", "=", "[", "]", "params", "+=", "[", "BoolParameter", "(", "qualifier", "=", "'enabled'", ",", "copy_for", "=", "{", "'context'", ":", "'dataset'", ",", "'dataset'", ":", "'*'", "}", ",", "...
Compute options for using the PHOEBE 2.0 backend. Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.phoebe` for a list of sources to cite when using this backend. :parameter **kwargs: defaul...
[ "Compute", "options", "for", "using", "the", "PHOEBE", "2", ".", "0", "backend", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/compute.py#L16-L113
phoebe-project/phoebe2
phoebe/parameters/compute.py
legacy
def legacy(**kwargs): """ Compute options for using the PHOEBE 1.0 legacy backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.legacy` for a list of sources to ...
python
def legacy(**kwargs): """ Compute options for using the PHOEBE 1.0 legacy backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.legacy` for a list of sources to ...
[ "def", "legacy", "(", "*", "*", "kwargs", ")", ":", "params", "=", "[", "]", "params", "+=", "[", "BoolParameter", "(", "qualifier", "=", "'enabled'", ",", "copy_for", "=", "{", "'context'", ":", "'dataset'", ",", "'kind'", ":", "[", "'lc'", ",", "'r...
Compute options for using the PHOEBE 1.0 legacy backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.legacy` for a list of sources to cite when using this backend. ...
[ "Compute", "options", "for", "using", "the", "PHOEBE", "1", ".", "0", "legacy", "backend", "(", "must", "be", "installed", ")", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/compute.py#L116-L160
phoebe-project/phoebe2
phoebe/parameters/compute.py
photodynam
def photodynam(**kwargs): """ Compute options for using Josh Carter's 'photodynam' code as a backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.photodynam` for...
python
def photodynam(**kwargs): """ Compute options for using Josh Carter's 'photodynam' code as a backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.photodynam` for...
[ "def", "photodynam", "(", "*", "*", "kwargs", ")", ":", "if", "not", "conf", ".", "devel", ":", "raise", "NotImplementedError", "(", "\"'photodynam' backend not officially supported for this release. Enable developer mode to test.\"", ")", "params", "=", "[", "]", "par...
Compute options for using Josh Carter's 'photodynam' code as a backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.photodynam` for a list of sources to cite when us...
[ "Compute", "options", "for", "using", "Josh", "Carter", "s", "photodynam", "code", "as", "a", "backend", "(", "must", "be", "installed", ")", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/compute.py#L162-L190
phoebe-project/phoebe2
phoebe/parameters/compute.py
jktebop
def jktebop(**kwargs): """ Compute options for using John Southworth's 'jktebop' code as a backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.jktebop` for a li...
python
def jktebop(**kwargs): """ Compute options for using John Southworth's 'jktebop' code as a backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.jktebop` for a li...
[ "def", "jktebop", "(", "*", "*", "kwargs", ")", ":", "if", "not", "conf", ".", "devel", ":", "raise", "NotImplementedError", "(", "\"'jktebop' backend not officially supported for this release. Enable developer mode to test.\"", ")", "params", "=", "[", "]", "params", ...
Compute options for using John Southworth's 'jktebop' code as a backend (must be installed). Generally, this will be used as an input to the kind argument in :meth:`phoebe.frontend.bundle.Bundle.add_compute` Please see :func:`phoebe.backend.backends.jktebop` for a list of sources to cite when usin...
[ "Compute", "options", "for", "using", "John", "Southworth", "s", "jktebop", "code", "as", "a", "backend", "(", "must", "be", "installed", ")", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/compute.py#L192-L216
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" ]
train
https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/decorators.py#L14-L29
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", "." ]
train
https://github.com/pinax/pinax-teams/blob/f8354ba0d32b3979d1dc18f50d23fd0096445ab7/pinax/teams/decorators.py#L32-L49
phoebe-project/phoebe2
phoebe/frontend/tabcomplete.py
Completer.complete
def complete(self, text, state): """Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. """ if self.use_main_ns: self.namespace = __main__.__dict__ ...
python
def complete(self, text, state): """Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. """ if self.use_main_ns: self.namespace = __main__.__dict__ ...
[ "def", "complete", "(", "self", ",", "text", ",", "state", ")", ":", "if", "self", ".", "use_main_ns", ":", "self", ".", "namespace", "=", "__main__", ".", "__dict__", "if", "state", "==", "0", ":", "self", ".", "matches", "=", "self", ".", "attr_mat...
Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'.
[ "Return", "the", "next", "possible", "completion", "for", "text", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/tabcomplete.py#L32-L46
phoebe-project/phoebe2
phoebe/frontend/tabcomplete.py
Completer.attr_matches
def attr_matches(self, text): """Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class insta...
python
def attr_matches(self, text): """Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class insta...
[ "def", "attr_matches", "(", "self", ",", "text", ")", ":", "def", "_method_or_attr", "(", "thisobject", ",", "item", ")", ":", "# decide whether to append a '(' to the end of the attr based", "# on whether its callable", "if", "hasattr", "(", "getattr", "(", "thisobject...
Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are also considered.)...
[ "Compute", "matches", "when", "text", "contains", "a", "dot", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/tabcomplete.py#L48-L147
phoebe-project/phoebe2
phoebe/backend/backends.py
_extract_from_bundle
def _extract_from_bundle(b, compute, times=None, allow_oversample=False, by_time=True, **kwargs): """ Extract a list of sorted times and the datasets that need to be computed at each of those times. Any backend can then loop through these times and see what quantities are neede...
python
def _extract_from_bundle(b, compute, times=None, allow_oversample=False, by_time=True, **kwargs): """ Extract a list of sorted times and the datasets that need to be computed at each of those times. Any backend can then loop through these times and see what quantities are neede...
[ "def", "_extract_from_bundle", "(", "b", ",", "compute", ",", "times", "=", "None", ",", "allow_oversample", "=", "False", ",", "by_time", "=", "True", ",", "*", "*", "kwargs", ")", ":", "provided_times", "=", "times", "times", "=", "[", "]", "infolists"...
Extract a list of sorted times and the datasets that need to be computed at each of those times. Any backend can then loop through these times and see what quantities are needed for that time step. Empty copies of synthetics for each applicable dataset are then created and returned so that they can be...
[ "Extract", "a", "list", "of", "sorted", "times", "and", "the", "datasets", "that", "need", "to", "be", "computed", "at", "each", "of", "those", "times", ".", "Any", "backend", "can", "then", "loop", "through", "these", "times", "and", "see", "what", "qua...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L98-L251
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", ")", ":", "# needs_mesh = {info['dataset']: info['kind'] for info in needed_syns if info['needs_mesh']}", "params", "=", "[", "]", "for", "needed_syn", "in", "needed_syns", ":", "# print \"*** _create_syns needed_syn\", needed_...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L253-L303
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'", "]", ")", ",", "'componen...
where kwargs overrides info
[ "where", "kwargs", "overrides", "info" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L305-L317
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", ...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L323-L335
phoebe-project/phoebe2
phoebe/backend/backends.py
BaseBackend.get_packet_and_syns
def get_packet_and_syns(self, b, compute, times=[], **kwargs): """ get_packet is called by the master and must get all information necessary to send to all workers. The returned packet will be passed on as _run_chunk(**packet) with the following exceptions: * b: the bundle will...
python
def get_packet_and_syns(self, b, compute, times=[], **kwargs): """ get_packet is called by the master and must get all information necessary to send to all workers. The returned packet will be passed on as _run_chunk(**packet) with the following exceptions: * b: the bundle will...
[ "def", "get_packet_and_syns", "(", "self", ",", "b", ",", "compute", ",", "times", "=", "[", "]", ",", "*", "*", "kwargs", ")", ":", "packet", ",", "new_syns", "=", "self", ".", "_get_packet_and_syns", "(", "b", ",", "compute", ",", "times", ",", "*"...
get_packet is called by the master and must get all information necessary to send to all workers. The returned packet will be passed on as _run_chunk(**packet) with the following exceptions: * b: the bundle will be included in the packet serialized * compute: the label of the compute o...
[ "get_packet", "is", "called", "by", "the", "master", "and", "must", "get", "all", "information", "necessary", "to", "send", "to", "all", "workers", ".", "The", "returned", "packet", "will", "be", "passed", "on", "as", "_run_chunk", "(", "**", "packet", ")"...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L349-L368
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", ")", ":", "# TODO: move to BaseBackendByDataset or BaseBackend?", "logger", ".", "debug", "(", "\"rank:{}/{} {}._fill_syns\"", ".", "format", "(", "mpi", ".", "myrank", ",", "mpi", ".",...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L378-L393
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", "(", ...
if within mpirun, workers should call _run_worker instead of run
[ "if", "within", "mpirun", "workers", "should", "call", "_run_worker", "instead", "of", "run" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/backends.py#L404-L427
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", ")", ":", "# the volume of a slanted triangular cone is A_triangle * (r_vec dot norm_vec) / 3.", "# TODO: implement normalizing normals into meshing routines (or at least have them supply normal_mags to the mesh)", "# TOD...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L13-L30
phoebe-project/phoebe2
phoebe/backend/mesh.py
euler_trans_matrix
def euler_trans_matrix(etheta, elongan, eincl): """ Get the transformation matrix R to translate/rotate a mesh according to euler angles. The matrix is R(long,incl,theta) = Rz(pi).Rz(long).Rx(incl).Rz(theta) Rz(long).Rx(-incl).Rz(theta).Rz(pi) where Rx(u) = 1, 0, ...
python
def euler_trans_matrix(etheta, elongan, eincl): """ Get the transformation matrix R to translate/rotate a mesh according to euler angles. The matrix is R(long,incl,theta) = Rz(pi).Rz(long).Rx(incl).Rz(theta) Rz(long).Rx(-incl).Rz(theta).Rz(pi) where Rx(u) = 1, 0, ...
[ "def", "euler_trans_matrix", "(", "etheta", ",", "elongan", ",", "eincl", ")", ":", "s1", "=", "sin", "(", "eincl", ")", "c1", "=", "cos", "(", "eincl", ")", "s2", "=", "sin", "(", "elongan", ")", "c2", "=", "cos", "(", "elongan", ")", "s3", "=",...
Get the transformation matrix R to translate/rotate a mesh according to euler angles. The matrix is R(long,incl,theta) = Rz(pi).Rz(long).Rx(incl).Rz(theta) Rz(long).Rx(-incl).Rz(theta).Rz(pi) where Rx(u) = 1, 0, 0 0, cos(u), -sin(u) 0, ...
[ "Get", "the", "transformation", "matrix", "R", "to", "translate", "/", "rotate", "a", "mesh", "according", "to", "euler", "angles", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L33-L85
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", ")", ":", "#print \"*** spin_in_system\", incl, long_an, np.dot(Rz(long_an), np.dot(Rx(-incl), np.array([0,0,1])))", "# Rz(long_an) Rx(incl) [0, 0, 1]", "return", "np", ".", "dot", "(", "Rz", "(", "long_an", ")", ",", "np"...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L103-L115
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 = Rz(long).Rx(-incl).Rz(theta).Rz(pi)", "m", "=", "euler_trans_matrix", "(", "etheta", ",", "elongan", ",", "eincl", ")", "return", "np", ".", "dot", "(", "m", "."...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L117-L131
phoebe-project/phoebe2
phoebe/backend/mesh.py
general_rotation_matrix
def general_rotation_matrix(theta, phi, alpha): """ Rotation around vector u = (sin(theta) cos(phi), sin(theta) sin(phi), cos(theta)) by an angle alpha Ref: http://ksuweb.kennesaw.edu/~plaval//math4490/rotgen.pdf :parameter float theta: :parameter float phi: :parameter float alpha: rotation a...
python
def general_rotation_matrix(theta, phi, alpha): """ Rotation around vector u = (sin(theta) cos(phi), sin(theta) sin(phi), cos(theta)) by an angle alpha Ref: http://ksuweb.kennesaw.edu/~plaval//math4490/rotgen.pdf :parameter float theta: :parameter float phi: :parameter float alpha: rotation a...
[ "def", "general_rotation_matrix", "(", "theta", ",", "phi", ",", "alpha", ")", ":", "C", "=", "cos", "(", "alpha", ")", "S", "=", "sin", "(", "alpha", ")", "t", "=", "1", "-", "C", "ux", "=", "sin", "(", "theta", ")", "*", "cos", "(", "phi", ...
Rotation around vector u = (sin(theta) cos(phi), sin(theta) sin(phi), cos(theta)) by an angle alpha Ref: http://ksuweb.kennesaw.edu/~plaval//math4490/rotgen.pdf :parameter float theta: :parameter float phi: :parameter float alpha: rotation angle :return: 3x3 matrix of floats
[ "Rotation", "around", "vector", "u", "=", "(", "sin", "(", "theta", ")", "cos", "(", "phi", ")", "sin", "(", "theta", ")", "sin", "(", "phi", ")", "cos", "(", "theta", "))", "by", "an", "angle", "alpha", "Ref", ":", "http", ":", "//", "ksuweb", ...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L134-L162
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L165-L192
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", ")", "# v_{rot,i} = omega x r_i ...
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L194-L222
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", ")", ":", "# WD returns a list of triangles with 9 coordinates (v1x, v1y, v1z, v2x, ...)", "triangles_9N", "=", "the_grid", "[", ":", ",", "4", ":", "13", "]", "new_mesh", "=", "{", "}",...
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...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L225-L281
phoebe-project/phoebe2
phoebe/backend/mesh.py
ComputedColumn.averages
def averages(self): """ Access to the average of the values at the vertices for each triangle. If the quantities are defined at centers instead of vertices, this will return None. Also see :method:`centers`. :return: numpy array or None """ if not self.mesh._com...
python
def averages(self): """ Access to the average of the values at the vertices for each triangle. If the quantities are defined at centers instead of vertices, this will return None. Also see :method:`centers`. :return: numpy array or None """ if not self.mesh._com...
[ "def", "averages", "(", "self", ")", ":", "if", "not", "self", ".", "mesh", ".", "_compute_at_vertices", ":", "return", "None", "return", "np", ".", "mean", "(", "self", ".", "vertices_per_triangle", ",", "axis", "=", "1", ")" ]
Access to the average of the values at the vertices for each triangle. If the quantities are defined at centers instead of vertices, this will return None. Also see :method:`centers`. :return: numpy array or None
[ "Access", "to", "the", "average", "of", "the", "values", "at", "the", "vertices", "for", "each", "triangle", ".", "If", "the", "quantities", "are", "defined", "at", "centers", "instead", "of", "vertices", "this", "will", "return", "None", ".", "Also", "see...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L395-L406
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...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L409-L435
phoebe-project/phoebe2
phoebe/backend/mesh.py
ComputedColumn.set_for_computations
def set_for_computations(self, value): """ Set the quantities, either at the vertices or centers depending on the settings of the mesh (mesh._compute_at_vertices) """ if self.mesh._compute_at_vertices: self._vertices = value else: self._centers = v...
python
def set_for_computations(self, value): """ Set the quantities, either at the vertices or centers depending on the settings of the mesh (mesh._compute_at_vertices) """ if self.mesh._compute_at_vertices: self._vertices = value else: self._centers = v...
[ "def", "set_for_computations", "(", "self", ",", "value", ")", ":", "if", "self", ".", "mesh", ".", "_compute_at_vertices", ":", "self", ".", "_vertices", "=", "value", "else", ":", "self", ".", "_centers", "=", "value" ]
Set the quantities, either at the vertices or centers depending on the settings of the mesh (mesh._compute_at_vertices)
[ "Set", "the", "quantities", "either", "at", "the", "vertices", "or", "centers", "depending", "on", "the", "settings", "of", "the", "mesh", "(", "mesh", ".", "_compute_at_vertices", ")" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L454-L462
phoebe-project/phoebe2
phoebe/backend/mesh.py
ProtoMesh.update_columns_dict
def update_columns_dict(self, kwargs): """ Update the value of a column or multiple columns by passing as a dict. For observable columns, provide the label of the observable itself and it will be found (so long as it does not conflict with an existing non-observable column). ...
python
def update_columns_dict(self, kwargs): """ Update the value of a column or multiple columns by passing as a dict. For observable columns, provide the label of the observable itself and it will be found (so long as it does not conflict with an existing non-observable column). ...
[ "def", "update_columns_dict", "(", "self", ",", "kwargs", ")", ":", "# make sure to do the geometric things that are needed for some of the", "# ComputedColumns first", "for", "key", "in", "(", "'triangles'", ",", "'vertices'", ",", "'centers'", ",", "'vnormals'", ",", "'...
Update the value of a column or multiple columns by passing as a dict. For observable columns, provide the label of the observable itself and it will be found (so long as it does not conflict with an existing non-observable column).
[ "Update", "the", "value", "of", "a", "column", "or", "multiple", "columns", "by", "passing", "as", "a", "dict", ".", "For", "observable", "columns", "provide", "the", "label", "of", "the", "observable", "itself", "and", "it", "will", "be", "found", "(", ...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L684-L716
phoebe-project/phoebe2
phoebe/backend/mesh.py
ProtoMesh.coords_for_observations
def coords_for_observations(self): """ Return the coordinates from the center of the star for each element (either centers or vertices depending on the setting in the mesh) after perturbations (either by features or by offsetting to get the correct volume). NOTE: this is NOT nec...
python
def coords_for_observations(self): """ Return the coordinates from the center of the star for each element (either centers or vertices depending on the setting in the mesh) after perturbations (either by features or by offsetting to get the correct volume). NOTE: this is NOT nec...
[ "def", "coords_for_observations", "(", "self", ")", ":", "if", "self", ".", "_compute_at_vertices", ":", "return", "self", ".", "vertices", "-", "self", ".", "_pos_center", "else", ":", "return", "self", ".", "centers", "-", "self", ".", "_pos_center" ]
Return the coordinates from the center of the star for each element (either centers or vertices depending on the setting in the mesh) after perturbations (either by features or by offsetting to get the correct volume). NOTE: this is NOT necessarily where the physical parameters were com...
[ "Return", "the", "coordinates", "from", "the", "center", "of", "the", "star", "for", "each", "element", "(", "either", "centers", "or", "vertices", "depending", "on", "the", "setting", "in", "the", "mesh", ")", "after", "perturbations", "(", "either", "by", ...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L820-L832
phoebe-project/phoebe2
phoebe/backend/mesh.py
ProtoMesh.coords_for_computations
def coords_for_computations(self): """ Return the coordinates from the center of the star for each element (either centers or vertices depending on the setting in the mesh). """ # TODO: need to subtract the position offset if a Mesh (in orbit) if self._compute_at_vertice...
python
def coords_for_computations(self): """ Return the coordinates from the center of the star for each element (either centers or vertices depending on the setting in the mesh). """ # TODO: need to subtract the position offset if a Mesh (in orbit) if self._compute_at_vertice...
[ "def", "coords_for_computations", "(", "self", ")", ":", "# TODO: need to subtract the position offset if a Mesh (in orbit)", "if", "self", ".", "_compute_at_vertices", ":", "if", "self", ".", "pvertices", "is", "not", "None", ":", "return", "self", ".", "pvertices", ...
Return the coordinates from the center of the star for each element (either centers or vertices depending on the setting in the mesh).
[ "Return", "the", "coordinates", "from", "the", "center", "of", "the", "star", "for", "each", "element", "(", "either", "centers", "or", "vertices", "depending", "on", "the", "setting", "in", "the", "mesh", ")", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L835-L848
phoebe-project/phoebe2
phoebe/backend/mesh.py
ProtoMesh.rs
def rs(self): """ Return the radius of each element (either vertices or centers depending on the setting in the mesh) with respect to the center of the star. NOTE: unscaled (ComputedColumn) """ rs = np.linalg.norm(self.coords_for_computations, axis=1) ...
python
def rs(self): """ Return the radius of each element (either vertices or centers depending on the setting in the mesh) with respect to the center of the star. NOTE: unscaled (ComputedColumn) """ rs = np.linalg.norm(self.coords_for_computations, axis=1) ...
[ "def", "rs", "(", "self", ")", ":", "rs", "=", "np", ".", "linalg", ".", "norm", "(", "self", ".", "coords_for_computations", ",", "axis", "=", "1", ")", "return", "ComputedColumn", "(", "self", ",", "rs", ")" ]
Return the radius of each element (either vertices or centers depending on the setting in the mesh) with respect to the center of the star. NOTE: unscaled (ComputedColumn)
[ "Return", "the", "radius", "of", "each", "element", "(", "either", "vertices", "or", "centers", "depending", "on", "the", "setting", "in", "the", "mesh", ")", "with", "respect", "to", "the", "center", "of", "the", "star", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L862-L873
phoebe-project/phoebe2
phoebe/backend/mesh.py
ProtoMesh.rprojs
def rprojs(self): """ Return the projected (in xy/uv plane) radius of each element (either vertices or centers depending on the setting in the mesh) with respect to the center of the star. NOTE: unscaled (ComputedColumn) """ # TODO: should this be moved ...
python
def rprojs(self): """ Return the projected (in xy/uv plane) radius of each element (either vertices or centers depending on the setting in the mesh) with respect to the center of the star. NOTE: unscaled (ComputedColumn) """ # TODO: should this be moved ...
[ "def", "rprojs", "(", "self", ")", ":", "# TODO: should this be moved to Mesh? Even though its surely possible", "# to compute without being placed in orbit, projecting in x,y doesn't", "# make much sense without LOS orientation.", "rprojs", "=", "np", ".", "linalg", ".", "norm", "(...
Return the projected (in xy/uv plane) radius of each element (either vertices or centers depending on the setting in the mesh) with respect to the center of the star. NOTE: unscaled (ComputedColumn)
[ "Return", "the", "projected", "(", "in", "xy", "/", "uv", "plane", ")", "radius", "of", "each", "element", "(", "either", "vertices", "or", "centers", "depending", "on", "the", "setting", "in", "the", "mesh", ")", "with", "respect", "to", "the", "center"...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L876-L890
phoebe-project/phoebe2
phoebe/backend/mesh.py
ProtoMesh.cosbetas
def cosbetas(self): """ TODO: add documentation (ComputedColumn) """ coords = self.coords_for_computations norms = self.normals_for_computations # TODO: ditch the list comprehension... I know I figured out how to do # this (ie along an axis) with np.dot ...
python
def cosbetas(self): """ TODO: add documentation (ComputedColumn) """ coords = self.coords_for_computations norms = self.normals_for_computations # TODO: ditch the list comprehension... I know I figured out how to do # this (ie along an axis) with np.dot ...
[ "def", "cosbetas", "(", "self", ")", ":", "coords", "=", "self", ".", "coords_for_computations", "norms", "=", "self", ".", "normals_for_computations", "# TODO: ditch the list comprehension... I know I figured out how to do", "# this (ie along an axis) with np.dot somewhere else", ...
TODO: add documentation (ComputedColumn)
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L893-L911
phoebe-project/phoebe2
phoebe/backend/mesh.py
ProtoMesh.areas_si
def areas_si(self): """ TODO: add documentation """ if self._areas is not None: return (self.areas*u.solRad**2).to(u.m**2).value else: return None
python
def areas_si(self): """ TODO: add documentation """ if self._areas is not None: return (self.areas*u.solRad**2).to(u.m**2).value else: return None
[ "def", "areas_si", "(", "self", ")", ":", "if", "self", ".", "_areas", "is", "not", "None", ":", "return", "(", "self", ".", "areas", "*", "u", ".", "solRad", "**", "2", ")", ".", "to", "(", "u", ".", "m", "**", "2", ")", ".", "value", "else"...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L936-L943
phoebe-project/phoebe2
phoebe/backend/mesh.py
ScaledProtoMesh.from_proto
def from_proto(cls, proto_mesh, scale): """ TODO: add documentation """ mesh = cls(**proto_mesh.items()) mesh._copy_roche_values() mesh._scale_mesh(scale=scale) return mesh
python
def from_proto(cls, proto_mesh, scale): """ TODO: add documentation """ mesh = cls(**proto_mesh.items()) mesh._copy_roche_values() mesh._scale_mesh(scale=scale) return mesh
[ "def", "from_proto", "(", "cls", ",", "proto_mesh", ",", "scale", ")", ":", "mesh", "=", "cls", "(", "*", "*", "proto_mesh", ".", "items", "(", ")", ")", "mesh", ".", "_copy_roche_values", "(", ")", "mesh", ".", "_scale_mesh", "(", "scale", "=", "sca...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1125-L1134
phoebe-project/phoebe2
phoebe/backend/mesh.py
ScaledProtoMesh._scale_mesh
def _scale_mesh(self, scale): """ TODO: add documentation """ pos_ks = ['vertices', 'centers'] # TODO: scale velocities??? # handle scale self.update_columns_dict({k: self[k]*scale for k in pos_ks}) self.update_columns(areas=self.areas*(scale**2)) ...
python
def _scale_mesh(self, scale): """ TODO: add documentation """ pos_ks = ['vertices', 'centers'] # TODO: scale velocities??? # handle scale self.update_columns_dict({k: self[k]*scale for k in pos_ks}) self.update_columns(areas=self.areas*(scale**2)) ...
[ "def", "_scale_mesh", "(", "self", ",", "scale", ")", ":", "pos_ks", "=", "[", "'vertices'", ",", "'centers'", "]", "# TODO: scale velocities???", "# handle scale", "self", ".", "update_columns_dict", "(", "{", "k", ":", "self", "[", "k", "]", "*", "scale", ...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1144-L1159
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1245-L1268
phoebe-project/phoebe2
phoebe/backend/mesh.py
Mesh.from_scaledproto
def from_scaledproto(cls, scaledproto_mesh, pos, vel, euler, euler_vel, rotation_vel=(0,0,0), component_com_x=None): """ TODO: add documentation """ mesh = cls(**scaledproto_mesh.items()) # roche coordin...
python
def from_scaledproto(cls, scaledproto_mesh, pos, vel, euler, euler_vel, rotation_vel=(0,0,0), component_com_x=None): """ TODO: add documentation """ mesh = cls(**scaledproto_mesh.items()) # roche coordin...
[ "def", "from_scaledproto", "(", "cls", ",", "scaledproto_mesh", ",", "pos", ",", "vel", ",", "euler", ",", "euler_vel", ",", "rotation_vel", "=", "(", "0", ",", "0", ",", "0", ")", ",", "component_com_x", "=", "None", ")", ":", "mesh", "=", "cls", "(...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1271-L1285
phoebe-project/phoebe2
phoebe/backend/mesh.py
Mesh._place_in_orbit
def _place_in_orbit(self, pos, vel, euler, euler_vel, rotation_vel=(0,0,0), component_com_x=None): """ TODO: add documentation """ # TODO: store pos, vel, euler so that INCREMENTAL changes are allowed # if passing new values (and then make this a public method). See note ...
python
def _place_in_orbit(self, pos, vel, euler, euler_vel, rotation_vel=(0,0,0), component_com_x=None): """ TODO: add documentation """ # TODO: store pos, vel, euler so that INCREMENTAL changes are allowed # if passing new values (and then make this a public method). See note ...
[ "def", "_place_in_orbit", "(", "self", ",", "pos", ",", "vel", ",", "euler", ",", "euler_vel", ",", "rotation_vel", "=", "(", "0", ",", "0", ",", "0", ")", ",", "component_com_x", "=", "None", ")", ":", "# TODO: store pos, vel, euler so that INCREMENTAL change...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1287-L1323
phoebe-project/phoebe2
phoebe/backend/mesh.py
Mesh.visibilities
def visibilities(self): """ Return the array of visibilities, where each item is a scalar/float between 0 (completely hidden/invisible) and 1 (completely visible). (Nx1) """ if self._visibilities is not None: return self._visibilities else: ...
python
def visibilities(self): """ Return the array of visibilities, where each item is a scalar/float between 0 (completely hidden/invisible) and 1 (completely visible). (Nx1) """ if self._visibilities is not None: return self._visibilities else: ...
[ "def", "visibilities", "(", "self", ")", ":", "if", "self", ".", "_visibilities", "is", "not", "None", ":", "return", "self", ".", "_visibilities", "else", ":", "return", "np", ".", "ones", "(", "self", ".", "Ntriangles", ")" ]
Return the array of visibilities, where each item is a scalar/float between 0 (completely hidden/invisible) and 1 (completely visible). (Nx1)
[ "Return", "the", "array", "of", "visibilities", "where", "each", "item", "is", "a", "scalar", "/", "float", "between", "0", "(", "completely", "hidden", "/", "invisible", ")", "and", "1", "(", "completely", "visible", ")", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1353-L1363
phoebe-project/phoebe2
phoebe/backend/mesh.py
Mesh.weights
def weights(self): """ TODO: add documentation (Nx3) """ if self._weights is not None and len(self._weights): return self._weights else: return np.full((self.Ntriangles, 3), 1./3)
python
def weights(self): """ TODO: add documentation (Nx3) """ if self._weights is not None and len(self._weights): return self._weights else: return np.full((self.Ntriangles, 3), 1./3)
[ "def", "weights", "(", "self", ")", ":", "if", "self", ".", "_weights", "is", "not", "None", "and", "len", "(", "self", ".", "_weights", ")", ":", "return", "self", ".", "_weights", "else", ":", "return", "np", ".", "full", "(", "(", "self", ".", ...
TODO: add documentation (Nx3)
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1366-L1375
phoebe-project/phoebe2
phoebe/backend/mesh.py
Mesh.update_columns_dict
def update_columns_dict(self, kwargs): """ TODO: add documentation """ super(Mesh, self).update_columns_dict(kwargs) # if kwargs.get('vnormals', None) is not None or kwargs.get('tnormals', None) is not None: # self._compute_mus() if kwargs.get('triangles', No...
python
def update_columns_dict(self, kwargs): """ TODO: add documentation """ super(Mesh, self).update_columns_dict(kwargs) # if kwargs.get('vnormals', None) is not None or kwargs.get('tnormals', None) is not None: # self._compute_mus() if kwargs.get('triangles', No...
[ "def", "update_columns_dict", "(", "self", ",", "kwargs", ")", ":", "super", "(", "Mesh", ",", "self", ")", ".", "update_columns_dict", "(", "kwargs", ")", "# if kwargs.get('vnormals', None) is not None or kwargs.get('tnormals', None) is not None:", "# self._compute_mus()", ...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1403-L1414
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1507-L1535
phoebe-project/phoebe2
phoebe/backend/mesh.py
Meshes.get_column
def get_column(self, field, components=None, computed_type='for_observations'): """ TODO: add documentation return a dictionary for a single column, with component as keys and the column array as values :parameter str field: name of the mesh columnname :parameter compon...
python
def get_column(self, field, components=None, computed_type='for_observations'): """ TODO: add documentation return a dictionary for a single column, with component as keys and the column array as values :parameter str field: name of the mesh columnname :parameter compon...
[ "def", "get_column", "(", "self", ",", "field", ",", "components", "=", "None", ",", "computed_type", "=", "'for_observations'", ")", ":", "def", "get_field", "(", "c", ",", "field", ",", "computed_type", ")", ":", "if", "c", "not", "in", "self", ".", ...
TODO: add documentation return a dictionary for a single column, with component as keys and the column array as values :parameter str field: name of the mesh columnname :parameter components:
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1537-L1574
phoebe-project/phoebe2
phoebe/backend/mesh.py
Meshes.get_column_flat
def get_column_flat(self, field, components=None, computed_type='for_observations'): """ TODO: add documentation return a single merged value (hstacked) from all meshes :parameter str field: name of the mesh columnname :parameter components: """ return self.pack...
python
def get_column_flat(self, field, components=None, computed_type='for_observations'): """ TODO: add documentation return a single merged value (hstacked) from all meshes :parameter str field: name of the mesh columnname :parameter components: """ return self.pack...
[ "def", "get_column_flat", "(", "self", ",", "field", ",", "components", "=", "None", ",", "computed_type", "=", "'for_observations'", ")", ":", "return", "self", ".", "pack_column_flat", "(", "self", ".", "get_column", "(", "field", ",", "components", ",", "...
TODO: add documentation return a single merged value (hstacked) from all meshes :parameter str field: name of the mesh columnname :parameter components:
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1576-L1587
phoebe-project/phoebe2
phoebe/backend/mesh.py
Meshes.pack_column_flat
def pack_column_flat(self, value, components=None, offset=False): """ TODO: add documentation """ if components: if isinstance(components, str): components = [components] elif isinstance(components, list): components = components ...
python
def pack_column_flat(self, value, components=None, offset=False): """ TODO: add documentation """ if components: if isinstance(components, str): components = [components] elif isinstance(components, list): components = components ...
[ "def", "pack_column_flat", "(", "self", ",", "value", ",", "components", "=", "None", ",", "offset", "=", "False", ")", ":", "if", "components", ":", "if", "isinstance", "(", "components", ",", "str", ")", ":", "components", "=", "[", "components", "]", ...
TODO: add documentation
[ "TODO", ":", "add", "documentation" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1589-L1619
phoebe-project/phoebe2
phoebe/backend/mesh.py
Meshes.unpack_column_flat
def unpack_column_flat(self, value, components=None, offset=False, computed_type=None): """ TODO: add documentation TODO: needs testing """ if components: if isinstance(components, str): components = [components] else: components = ...
python
def unpack_column_flat(self, value, components=None, offset=False, computed_type=None): """ TODO: add documentation TODO: needs testing """ if components: if isinstance(components, str): components = [components] else: components = ...
[ "def", "unpack_column_flat", "(", "self", ",", "value", ",", "components", "=", "None", ",", "offset", "=", "False", ",", "computed_type", "=", "None", ")", ":", "if", "components", ":", "if", "isinstance", "(", "components", ",", "str", ")", ":", "compo...
TODO: add documentation TODO: needs testing
[ "TODO", ":", "add", "documentation", "TODO", ":", "needs", "testing" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1621-L1658
phoebe-project/phoebe2
phoebe/backend/mesh.py
Meshes.set_column_flat
def set_column_flat(self, field, value, components=None, computed_type=None): """ TODO: add documentation TODO: needs testing """ value_dict = self.unpack_column_flat(value, components, computed_type=computed_type) self.update_columns(field, value_dict, computed_type=comp...
python
def set_column_flat(self, field, value, components=None, computed_type=None): """ TODO: add documentation TODO: needs testing """ value_dict = self.unpack_column_flat(value, components, computed_type=computed_type) self.update_columns(field, value_dict, computed_type=comp...
[ "def", "set_column_flat", "(", "self", ",", "field", ",", "value", ",", "components", "=", "None", ",", "computed_type", "=", "None", ")", ":", "value_dict", "=", "self", ".", "unpack_column_flat", "(", "value", ",", "components", ",", "computed_type", "=", ...
TODO: add documentation TODO: needs testing
[ "TODO", ":", "add", "documentation", "TODO", ":", "needs", "testing" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1660-L1666
phoebe-project/phoebe2
phoebe/backend/mesh.py
Meshes.replace_elements
def replace_elements(self, inds, new_submesh, component): """ TODO: add documentation TODO: remove this method??? """ self._dict[component] = np.hstack([self._dict[component][~inds], new_submesh])
python
def replace_elements(self, inds, new_submesh, component): """ TODO: add documentation TODO: remove this method??? """ self._dict[component] = np.hstack([self._dict[component][~inds], new_submesh])
[ "def", "replace_elements", "(", "self", ",", "inds", ",", "new_submesh", ",", "component", ")", ":", "self", ".", "_dict", "[", "component", "]", "=", "np", ".", "hstack", "(", "[", "self", ".", "_dict", "[", "component", "]", "[", "~", "inds", "]", ...
TODO: add documentation TODO: remove this method???
[ "TODO", ":", "add", "documentation", "TODO", ":", "remove", "this", "method???" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/backend/mesh.py#L1668-L1673
phoebe-project/phoebe2
phoebe/dynamics/keplerian.py
dynamics_from_bundle
def dynamics_from_bundle(b, times, compute=None, return_euler=False, **kwargs): """ Parse parameters in the bundle and call :func:`dynamics`. See :func:`dynamics` for more detailed information. NOTE: you must either provide compute (the label) OR all relevant options as kwargs (ltte) Args: ...
python
def dynamics_from_bundle(b, times, compute=None, return_euler=False, **kwargs): """ Parse parameters in the bundle and call :func:`dynamics`. See :func:`dynamics` for more detailed information. NOTE: you must either provide compute (the label) OR all relevant options as kwargs (ltte) Args: ...
[ "def", "dynamics_from_bundle", "(", "b", ",", "times", ",", "compute", "=", "None", ",", "return_euler", "=", "False", ",", "*", "*", "kwargs", ")", ":", "b", ".", "run_delayed_constraints", "(", ")", "computeps", "=", "b", ".", "get_compute", "(", "comp...
Parse parameters in the bundle and call :func:`dynamics`. See :func:`dynamics` for more detailed information. NOTE: you must either provide compute (the label) OR all relevant options as kwargs (ltte) Args: b: (Bundle) the bundle with a set hierarchy times: (list or array) times at wh...
[ "Parse", "parameters", "in", "the", "bundle", "and", "call", ":", "func", ":", "dynamics", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dynamics/keplerian.py#L14-L117
phoebe-project/phoebe2
phoebe/dynamics/keplerian.py
dynamics
def dynamics(times, periods, eccs, smas, t0_perpasses, per0s, long_ans, incls, dpdts, deccdts, dperdts, components, t0=0.0, vgamma=0.0, mass_conservation=True, ltte=False, return_euler=False): """ Compute the positions and velocites of each star in their nested Keplerian orbits at a ...
python
def dynamics(times, periods, eccs, smas, t0_perpasses, per0s, long_ans, incls, dpdts, deccdts, dperdts, components, t0=0.0, vgamma=0.0, mass_conservation=True, ltte=False, return_euler=False): """ Compute the positions and velocites of each star in their nested Keplerian orbits at a ...
[ "def", "dynamics", "(", "times", ",", "periods", ",", "eccs", ",", "smas", ",", "t0_perpasses", ",", "per0s", ",", "long_ans", ",", "incls", ",", "dpdts", ",", "deccdts", ",", "dperdts", ",", "components", ",", "t0", "=", "0.0", ",", "vgamma", "=", "...
Compute the positions and velocites of each star in their nested Keplerian orbits at a given list of times. See :func:`dynamics_from_bundle` for a wrapper around this function which automatically handles passing everything in the correct order and in the correct units. Args: times: (iterab...
[ "Compute", "the", "positions", "and", "velocites", "of", "each", "star", "in", "their", "nested", "Keplerian", "orbits", "at", "a", "given", "list", "of", "times", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dynamics/keplerian.py#L122-L389
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", ")", ":", "# Initial value", "Fn", "=", "M", "+", "ecc", "*", "sin", "(", "M", ")", "+", "ecc", "**", "2", "/", "2.", "*", "sin", "(", "2", "*", "M", ")", "# Iterative solv...
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dynamics/keplerian.py#L394-L445
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", ")", ",", "de...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/feature.py#L17-L40
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/feature.py#L42-L67
phoebe-project/phoebe2
phoebe/dependencies/autofig/mpl_animate.py
anim_to_html
def anim_to_html(anim): """ adapted from: http://jakevdp.github.io/blog/2013/05/12/embedding-matplotlib-animations/ This function converts and animation object from matplotlib into HTML which can then be embedded in an IPython notebook. This requires ffmpeg to be installed in order to build the in...
python
def anim_to_html(anim): """ adapted from: http://jakevdp.github.io/blog/2013/05/12/embedding-matplotlib-animations/ This function converts and animation object from matplotlib into HTML which can then be embedded in an IPython notebook. This requires ffmpeg to be installed in order to build the in...
[ "def", "anim_to_html", "(", "anim", ")", ":", "if", "not", "hasattr", "(", "anim", ",", "'_encoded_video'", ")", ":", "with", "NamedTemporaryFile", "(", "suffix", "=", "'.mp4'", ")", "as", "f", ":", "anim", ".", "save", "(", "f", ".", "name", ",", "f...
adapted from: http://jakevdp.github.io/blog/2013/05/12/embedding-matplotlib-animations/ This function converts and animation object from matplotlib into HTML which can then be embedded in an IPython notebook. This requires ffmpeg to be installed in order to build the intermediate mp4 file To get thes...
[ "adapted", "from", ":", "http", ":", "//", "jakevdp", ".", "github", ".", "io", "/", "blog", "/", "2013", "/", "05", "/", "12", "/", "embedding", "-", "matplotlib", "-", "animations", "/" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/dependencies/autofig/mpl_animate.py#L14-L32
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/io.py#L242-L282
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/io.py#L284-L317
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", "#first check to see if there are currently in RV datasets", "if", "datai...
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", ...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/io.py#L319-L380
phoebe-project/phoebe2
phoebe/frontend/io.py
N_to_Ntriangles
def N_to_Ntriangles(N): """ @N: WD style gridsize Converts WD style grid size @N to the number of triangles on the surface. Returns: number of triangles. """ theta = np.array([np.pi/2*(k-0.5)/N for k in range(1, N+1)]) phi = np.array([[np.pi*(l-0.5)/Mk for l in range(1, Mk+1)] for Mk ...
python
def N_to_Ntriangles(N): """ @N: WD style gridsize Converts WD style grid size @N to the number of triangles on the surface. Returns: number of triangles. """ theta = np.array([np.pi/2*(k-0.5)/N for k in range(1, N+1)]) phi = np.array([[np.pi*(l-0.5)/Mk for l in range(1, Mk+1)] for Mk ...
[ "def", "N_to_Ntriangles", "(", "N", ")", ":", "theta", "=", "np", ".", "array", "(", "[", "np", ".", "pi", "/", "2", "*", "(", "k", "-", "0.5", ")", "/", "N", "for", "k", "in", "range", "(", "1", ",", "N", "+", "1", ")", "]", ")", "phi", ...
@N: WD style gridsize Converts WD style grid size @N to the number of triangles on the surface. Returns: number of triangles.
[ "@N", ":", "WD", "style", "gridsize" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/io.py#L1962-L1976
phoebe-project/phoebe2
phoebe/distortions/roche.py
pot_for_component
def pot_for_component(pot, q, component=1, reverse=False): """ q for secondaries should already be flipped (via q_for_component) """ # currently only used by legacy wrapper: consider moving/removing if component==1: return pot elif component==2: if reverse: return pot...
python
def pot_for_component(pot, q, component=1, reverse=False): """ q for secondaries should already be flipped (via q_for_component) """ # currently only used by legacy wrapper: consider moving/removing if component==1: return pot elif component==2: if reverse: return pot...
[ "def", "pot_for_component", "(", "pot", ",", "q", ",", "component", "=", "1", ",", "reverse", "=", "False", ")", ":", "# currently only used by legacy wrapper: consider moving/removing", "if", "component", "==", "1", ":", "return", "pot", "elif", "component", "=="...
q for secondaries should already be flipped (via q_for_component)
[ "q", "for", "secondaries", "should", "already", "be", "flipped", "(", "via", "q_for_component", ")" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L24-L37
phoebe-project/phoebe2
phoebe/distortions/roche.py
roche_misaligned_critical_requiv
def roche_misaligned_critical_requiv(q, F, d, s, scale=1.0): """ NOTE: output is in units of scale (so constraints will use SI) NOTE: q should already be flipped (i.e. the output of q_for_component) if necessary NOTE: s should be in roche coordinates at the applicable time/true anomaly """ volum...
python
def roche_misaligned_critical_requiv(q, F, d, s, scale=1.0): """ NOTE: output is in units of scale (so constraints will use SI) NOTE: q should already be flipped (i.e. the output of q_for_component) if necessary NOTE: s should be in roche coordinates at the applicable time/true anomaly """ volum...
[ "def", "roche_misaligned_critical_requiv", "(", "q", ",", "F", ",", "d", ",", "s", ",", "scale", "=", "1.0", ")", ":", "volume_critical", "=", "libphoebe", ".", "roche_misaligned_critical_volume", "(", "q", ",", "F", ",", "d", ",", "s", ")", "logger", "....
NOTE: output is in units of scale (so constraints will use SI) NOTE: q should already be flipped (i.e. the output of q_for_component) if necessary NOTE: s should be in roche coordinates at the applicable time/true anomaly
[ "NOTE", ":", "output", "is", "in", "units", "of", "scale", "(", "so", "constraints", "will", "use", "SI", ")", "NOTE", ":", "q", "should", "already", "be", "flipped", "(", "i", ".", "e", ".", "the", "output", "of", "q_for_component", ")", "if", "nece...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L39-L51
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L81-L89
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L91-L98
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", ")", ":", "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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L110-L133
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L135-L144
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L146-L157
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L159-L168
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L170-L179
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/distortions/roche.py#L181-L194
phoebe-project/phoebe2
phoebe/parameters/setting.py
settings
def settings(**kwargs): """ Generally, this will automatically be added to a newly initialized :class:`phoebe.frontend.bundle.Bundle` :parameter **kwargs: defaults for the values of any of the parameters :return: a :class:`phoebe.parameters.parameters.ParameterSet` of all newly created :cla...
python
def settings(**kwargs): """ Generally, this will automatically be added to a newly initialized :class:`phoebe.frontend.bundle.Bundle` :parameter **kwargs: defaults for the values of any of the parameters :return: a :class:`phoebe.parameters.parameters.ParameterSet` of all newly created :cla...
[ "def", "settings", "(", "*", "*", "kwargs", ")", ":", "params", "=", "[", "]", "params", "+=", "[", "StringParameter", "(", "qualifier", "=", "'phoebe_version'", ",", "value", "=", "kwargs", ".", "get", "(", "'phoebe_version'", ",", "__version__", ")", "...
Generally, this will automatically be added to a newly initialized :class:`phoebe.frontend.bundle.Bundle` :parameter **kwargs: defaults for the values of any of the parameters :return: a :class:`phoebe.parameters.parameters.ParameterSet` of all newly created :class:`phoebe.parameters.parameters.Par...
[ "Generally", "this", "will", "automatically", "be", "added", "to", "a", "newly", "initialized", ":", "class", ":", "phoebe", ".", "frontend", ".", "bundle", ".", "Bundle" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/setting.py#L7-L32
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L183-L208
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", "No...
Intercept and check updates from server if bundle is in client mode.
[ "Intercept", "and", "check", "updates", "from", "server", "if", "bundle", "is", "in", "client", "mode", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L211-L224
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L227-L236
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L252-L273
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", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L382-L396
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", "(", ")", ":", "# Here we'll set the attributes (_context, _qualifier, etc)"...
Set the value of tags for all Parameters in this ParameterSet.
[ "Set", "the", "value", "of", "tags", "for", "all", "Parameters", "in", "this", "ParameterSet", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L398-L404
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L407-L419
phoebe-project/phoebe2
phoebe/parameters/parameters.py
ParameterSet.common_twig
def common_twig(self): """ The twig that is common between all items in this ParameterSet. This twig gives a single string which can point back to this ParameterSet (but may include other entries as well) see also :meth:`uniquetwig` :return: twig (full) of this Paramete...
python
def common_twig(self): """ The twig that is common between all items in this ParameterSet. This twig gives a single string which can point back to this ParameterSet (but may include other entries as well) see also :meth:`uniquetwig` :return: twig (full) of this Paramete...
[ "def", "common_twig", "(", "self", ")", ":", "return", "\"@\"", ".", "join", "(", "[", "getattr", "(", "self", ",", "k", ")", "for", "k", "in", "_meta_fields_twig", "if", "self", ".", "meta", ".", "get", "(", "k", ")", "is", "not", "None", "]", "...
The twig that is common between all items in this ParameterSet. This twig gives a single string which can point back to this ParameterSet (but may include other entries as well) see also :meth:`uniquetwig` :return: twig (full) of this Parameter
[ "The", "twig", "that", "is", "common", "between", "all", "items", "in", "this", "ParameterSet", ".", "This", "twig", "gives", "a", "single", "string", "which", "can", "point", "back", "to", "this", "ParameterSet", "(", "but", "may", "include", "other", "en...
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L440-L450
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", ")", ":", "# we want to set meta-fields that are shared by ALL params in the PS", "for", "field", "in", "_meta_fields_twig", ":", "keys_for_this_field", "=", "set", "(", "[", "getattr", "(", "p", ",", "field", ")", "for", "p", "in", ...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L736-L750
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", "=", "{", "}", "# NOTE: self.conte...
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" ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L752-L822
phoebe-project/phoebe2
phoebe/parameters/parameters.py
ParameterSet._attach_params
def _attach_params(self, params, **kwargs): """Attach a list of parameters (or ParameterSet) to this ParameterSet. :parameter list params: list of parameters, or ParameterSet :parameter **kwargs: attributes to set for each parameter (ie tags) """ lst = params.to_list() if isinst...
python
def _attach_params(self, params, **kwargs): """Attach a list of parameters (or ParameterSet) to this ParameterSet. :parameter list params: list of parameters, or ParameterSet :parameter **kwargs: attributes to set for each parameter (ie tags) """ lst = params.to_list() if isinst...
[ "def", "_attach_params", "(", "self", ",", "params", ",", "*", "*", "kwargs", ")", ":", "lst", "=", "params", ".", "to_list", "(", ")", "if", "isinstance", "(", "params", ",", "ParameterSet", ")", "else", "params", "for", "param", "in", "lst", ":", "...
Attach a list of parameters (or ParameterSet) to this ParameterSet. :parameter list params: list of parameters, or ParameterSet :parameter **kwargs: attributes to set for each parameter (ie tags)
[ "Attach", "a", "list", "of", "parameters", "(", "or", "ParameterSet", ")", "to", "this", "ParameterSet", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L824-L842
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", "# 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", "(", ")...
Check the value of copy_for and make appropriate copies.
[ "Check", "the", "value", "of", "copy_for", "and", "make", "appropriate", "copies", "." ]
train
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/parameters/parameters.py#L844-L927