sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
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...
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
entailment
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...
Transforms polar radius to surface potential
entailment
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)) ...
Transforms surface potential to polar radius
entailment
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...
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}} ...
entailment
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...
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
entailment
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]...
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
entailment
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...
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
entailment
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...
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
entailment
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....
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
entailment
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...
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...
entailment
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...
Intercept and send to the server if bundle is in client mode.
entailment
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...
Intercept and check updates from server if bundle is in client mode.
entailment
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 ...
Return a unique string with length n. :parameter int N: number of character in the uniqueid :return: the uniqueid :rtype: str
entailment
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...
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
entailment
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...
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...
entailment
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: ...
Set the value of tags for all Parameters in this ParameterSet.
entailment
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 ...
Returns a dictionary that lists all available tags that can be used for further filtering
entailment
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...
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
entailment
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: ...
set the meta fields of the ParameterSet as those that are shared by ALL parameters in the ParameterSet. For any fields that are not
entailment
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...
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...
entailment
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...
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)
entailment
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(): ...
Check the value of copy_for and make appropriate copies.
entailment
def _check_label(self, label): """Check to see if the label is allowed.""" if not isinstance(label, str): label = str(label) if label.lower() in _forbidden_labels: raise ValueError("'{}' is forbidden to be used as a label" .format(label)) ...
Check to see if the label is allowed.
entailment
def open(cls, filename): """ Open a ParameterSet from a JSON-formatted file. This is a constructor so should be called as: >>> b = ParameterSet.open('test.json') :parameter str filename: relative or full path to the file :return: instantiated :class:`ParameterSet` obj...
Open a ParameterSet from a JSON-formatted file. This is a constructor so should be called as: >>> b = ParameterSet.open('test.json') :parameter str filename: relative or full path to the file :return: instantiated :class:`ParameterSet` object
entailment
def save(self, filename, incl_uniqueid=False, compact=False): """ Save the ParameterSet to a JSON-formatted ASCII file :parameter str filename: relative or fullpath to the file :parameter bool incl_uniqueid: whether to including uniqueids in the file (only needed if its nece...
Save the ParameterSet to a JSON-formatted ASCII file :parameter str filename: relative or fullpath to the file :parameter bool incl_uniqueid: whether to including uniqueids in the file (only needed if its necessary to maintain the uniqueids when reloading) :parameter boo...
entailment
def ui(self, client='http://localhost:4200', **kwargs): """ [NOT IMPLEMENTED] The bundle must be in client mode in order to open the web-interface. See :meth:`Bundle:as_client` to switch to client mode. :parameter str client: URL of the running client which must be connected ...
[NOT IMPLEMENTED] The bundle must be in client mode in order to open the web-interface. See :meth:`Bundle:as_client` to switch to client mode. :parameter str client: URL of the running client which must be connected to the same server as the bundle :return: URL of the param...
entailment
def to_list(self, **kwargs): """ Convert the :class:`ParameterSet` to a list of :class:`Parameter`s :return: list of class:`Parameter` objects """ if kwargs: return self.filter(**kwargs).to_list() return self._params
Convert the :class:`ParameterSet` to a list of :class:`Parameter`s :return: list of class:`Parameter` objects
entailment
def to_list_of_dicts(self, **kwargs): """ Convert the :class:`ParameterSet` to a list of the dictionary representation of each :class:`Parameter` :return: list of dicts """ if kwargs: return self.filter(**kwargs).to_list_of_dicts() return [param.to_di...
Convert the :class:`ParameterSet` to a list of the dictionary representation of each :class:`Parameter` :return: list of dicts
entailment
def to_flat_dict(self, **kwargs): """ Convert the :class:`ParameterSet` to a flat dictionary, with keys being uniquetwigs to access the parameter and values being the :class:`Parameter` objects themselves. :return: dict of :class:`Parameter`s """ if kwargs: ...
Convert the :class:`ParameterSet` to a flat dictionary, with keys being uniquetwigs to access the parameter and values being the :class:`Parameter` objects themselves. :return: dict of :class:`Parameter`s
entailment
def to_dict(self, field=None, **kwargs): """ Convert the ParameterSet to a structured (nested) dictionary to allow traversing the structure from the bottom up :parameter str field: (optional) build the dictionary with keys at a given level/field. Can be any of the keys in ...
Convert the ParameterSet to a structured (nested) dictionary to allow traversing the structure from the bottom up :parameter str field: (optional) build the dictionary with keys at a given level/field. Can be any of the keys in :func:`meta`. If None, the keys will be the lowes...
entailment
def set(self, key, value, **kwargs): """ Set the value of a Parameter in the ParameterSet. If :func:`get` would retrieve a Parameter, this will set the value of that parameter. Or you can provide 'value@...' or 'default_unit@...', etc to specify what attribute to set. ...
Set the value of a Parameter in the ParameterSet. If :func:`get` would retrieve a Parameter, this will set the value of that parameter. Or you can provide 'value@...' or 'default_unit@...', etc to specify what attribute to set. :parameter str key: the twig (called key here to ...
entailment
def to_json(self, incl_uniqueid=False): """ Convert the ParameterSet to a json-compatible dictionary :return: list of dictionaries """ lst = [] for context in _contexts: lst += [v.to_json(incl_uniqueid=incl_uniqueid) for v in self.filter(c...
Convert the ParameterSet to a json-compatible dictionary :return: list of dictionaries
entailment
def filter(self, twig=None, check_visible=True, check_default=True, **kwargs): """ Filter the ParameterSet based on the meta-tags of the Parameters and return another ParameterSet. Because another ParameterSet is returned, these filter calls are chainable. >>> b.filter(...
Filter the ParameterSet based on the meta-tags of the Parameters and return another ParameterSet. Because another ParameterSet is returned, these filter calls are chainable. >>> b.filter(context='component').filter(component='starA') :parameter str twig: (optional) the search ...
entailment
def get(self, twig=None, check_visible=True, check_default=True, **kwargs): """ Get a single parameter from this ParameterSet. This works exactly the same as filter except there must be only a single result, and the Parameter itself is returned instead of a ParameterSet. Also s...
Get a single parameter from this ParameterSet. This works exactly the same as filter except there must be only a single result, and the Parameter itself is returned instead of a ParameterSet. Also see :meth:`get_parameter` (which is simply an alias of this method) :parameter str twig:...
entailment
def exclude(self, twig=None, check_visible=True, **kwargs): """ Exclude the results from this filter from the current ParameterSet. See :meth:`filter` for options. """ return self - self.filter(twig=twig, check_visible=check_visible, ...
Exclude the results from this filter from the current ParameterSet. See :meth:`filter` for options.
entailment
def get_or_create(self, qualifier, new_parameter, **kwargs): """ Get a :class:`Parameter` from the ParameterSet, if it does not exist, create and attach it. Note: running this on a ParameterSet that is NOT a :class:`phoebe.frontend.bundle.Bundle`, will NOT add the Parame...
Get a :class:`Parameter` from the ParameterSet, if it does not exist, create and attach it. Note: running this on a ParameterSet that is NOT a :class:`phoebe.frontend.bundle.Bundle`, will NOT add the Parameter to the bundle, but only the temporary ParameterSet :paramete...
entailment
def _remove_parameter(self, param): """ Remove a Parameter from the ParameterSet :parameter param: the :class:`Parameter` object to be removed :type param: :class:`Parameter` """ # TODO: check to see if protected (required by a current constraint or # by a backen...
Remove a Parameter from the ParameterSet :parameter param: the :class:`Parameter` object to be removed :type param: :class:`Parameter`
entailment
def remove_parameter(self, twig=None, **kwargs): """ Remove a :class:`Parameter` from the ParameterSet Note: removing Parameters from a ParameterSet will not remove them from any parent ParameterSets (including the :class:`phoebe.frontend.bundle.Bundle`) :parameter str ...
Remove a :class:`Parameter` from the ParameterSet Note: removing Parameters from a ParameterSet will not remove them from any parent ParameterSets (including the :class:`phoebe.frontend.bundle.Bundle`) :parameter str twig: the twig to search for the parameter :parameter **kwarg...
entailment
def remove_parameters_all(self, twig=None, **kwargs): """ Remove all :class:`Parameter`s that match the search from the ParameterSet. Any Parameter that would be included in the resulting ParameterSet from a :func:`filter` call with the same arguments will be removed fro...
Remove all :class:`Parameter`s that match the search from the ParameterSet. Any Parameter that would be included in the resulting ParameterSet from a :func:`filter` call with the same arguments will be removed from this ParameterSet. Note: removing Parameters from a ParameterSe...
entailment
def get_quantity(self, twig=None, unit=None, default=None, t=None, **kwargs): """ TODO: add documentation """ # TODO: for time derivatives will need to use t instead of time (time # gets passed to twig filtering) if default is not None is not None: ...
TODO: add documentation
entailment
def set_quantity(self, twig=None, value=None, **kwargs): """ TODO: add documentation """ # TODO: handle twig having parameter key (value@, default_unit@, adjust@, etc) # TODO: does this return anything (update the docstring)? return self.get_parameter(twig=twig, **kwargs)...
TODO: add documentation
entailment
def get_value(self, twig=None, unit=None, default=None, t=None, **kwargs): """ Get the value of a :class:`Parameter` in this ParameterSet :parameter str twig: the twig to search for the parameter :parameter unit: units for the returned result (if applicable). If None or not...
Get the value of a :class:`Parameter` in this ParameterSet :parameter str twig: the twig to search for the parameter :parameter unit: units for the returned result (if applicable). If None or not provided, the value will be returned in that Parameter's default_unit (if ...
entailment
def set_value(self, twig=None, value=None, **kwargs): """ Set the value of a :class:`Parameter` in this ParameterSet Note: setting the value of a Parameter in a ParameterSet WILL change that Parameter across any parent ParameterSets (including the :class:`phoebe.frontend.bundle....
Set the value of a :class:`Parameter` in this ParameterSet Note: setting the value of a Parameter in a ParameterSet WILL change that Parameter across any parent ParameterSets (including the :class:`phoebe.frontend.bundle.Bundle`) :parameter set twig: the twig to search for the paramete...
entailment
def set_value_all(self, twig=None, value=None, check_default=False, **kwargs): """ Set the value of all returned :class:`Parameter`s in this ParameterSet. Any :class:`Parameter` that would be included in the resulting ParameterSet from a :func:`filter` call with the same arguments will ...
Set the value of all returned :class:`Parameter`s in this ParameterSet. Any :class:`Parameter` that would be included in the resulting ParameterSet from a :func:`filter` call with the same arguments will have their value set. Note: setting the value of a Parameter in a ParameterSet WIL...
entailment
def get_default_unit(self, twig=None, **kwargs): """ TODO: add documentation """ return self.get_parameter(twig=twig, **kwargs).get_default_unit()
TODO: add documentation
entailment
def set_default_unit(self, twig=None, unit=None, **kwargs): """ TODO: add documentation """ if twig is not None and unit is None: # then try to support value as the first argument if no matches with twigs if isinstance(unit, u.Unit) or not isinstance(twig, str): ...
TODO: add documentation
entailment
def set_default_unit_all(self, twig=None, unit=None, **kwargs): """ TODO: add documentation """ if twig is not None and unit is None: # then try to support value as the first argument if no matches with twigs if isinstance(unit, u.Unit) or not isinstance(twig, str...
TODO: add documentation
entailment
def get_description(self, twig=None, **kwargs): """ TODO: add documentation """ return self.get_parameter(twig=twig, **kwargs).get_description()
TODO: add documentation
entailment
def plot(self, twig=None, **kwargs): """ High-level wrapper around matplotlib (by default, but also has some support for other plotting backends). This function smartly makes one or multiple calls to the plotting backend based on the type of data. Individual lines are each give...
High-level wrapper around matplotlib (by default, but also has some support for other plotting backends). This function smartly makes one or multiple calls to the plotting backend based on the type of data. Individual lines are each given a label (automatic if not provided), to see the...
entailment
def _show_or_save(self, save, show, animate, draw_sidebars=True, draw_title=True, tight_layout=False, subplot_grid=None, **kwargs): """ Draw/animate and show and/or save a autofig plot "...
Draw/animate and show and/or save a autofig plot
entailment
def show(self, **kwargs): """ Draw and show the plot. """ kwargs.setdefault('show', True) kwargs.setdefault('save', False) kwargs.setdefault('animate', False) return self._show_or_save(**kwargs)
Draw and show the plot.
entailment
def savefig(self, filename, **kwargs): """ Draw and save the plot. :parameter str filename: filename to save to. Be careful of extensions here... matplotlib accepts many different image formats while other backends will only export to html. """ f...
Draw and save the plot. :parameter str filename: filename to save to. Be careful of extensions here... matplotlib accepts many different image formats while other backends will only export to html.
entailment
def copy(self): """ Deepcopy the parameter (with a new uniqueid). All other tags will remain the same... so some other tag should be changed before attaching back to a ParameterSet or Bundle. :return: the copied :class:`Parameter` object """ s = self.to_json() ...
Deepcopy the parameter (with a new uniqueid). All other tags will remain the same... so some other tag should be changed before attaching back to a ParameterSet or Bundle. :return: the copied :class:`Parameter` object
entailment
def to_string_short(self): """ see also :meth:`to_string` :return: a shorter abreviated string reprentation of the parameter """ if hasattr(self, 'constrained_by') and len(self.constrained_by) > 0: return "* {:>30}: {}".format(self.uniquetwig_trunc, self.get_quantity...
see also :meth:`to_string` :return: a shorter abreviated string reprentation of the parameter
entailment
def save(self, filename, incl_uniqueid=False): """ Save the Parameter to a JSON-formatted ASCII file :parameter str filename: relative or fullpath to the file :return: filename :rtype: str """ filename = os.path.expanduser(filename) f = open(filename, 'w'...
Save the Parameter to a JSON-formatted ASCII file :parameter str filename: relative or fullpath to the file :return: filename :rtype: str
entailment
def to_json(self, incl_uniqueid=False): """ :return: a JSON-ready dictionary holding all information for this parameter """ def _parse(k, v): """ """ if k=='value': if isinstance(self._value, nparray.ndarray): ...
:return: a JSON-ready dictionary holding all information for this parameter
entailment
def get_meta(self, ignore=['uniqueid']): """ See all the meta-tag properties for this Parameter :parameter list ignore: list of keys to exclude from the returned dictionary :return: an ordered dictionary of tag properties """ return OrderedDict([(k, getattr(s...
See all the meta-tag properties for this Parameter :parameter list ignore: list of keys to exclude from the returned dictionary :return: an ordered dictionary of tag properties
entailment
def uniquetwig(self, ps=None): """ see also :meth:`twig` Determine the shortest (more-or-less) twig which will point to this single Parameter in a given parent :class:`ParameterSet` :parameter ps: :class:`ParameterSet` in which the returned uniquetwig will point to ...
see also :meth:`twig` Determine the shortest (more-or-less) twig which will point to this single Parameter in a given parent :class:`ParameterSet` :parameter ps: :class:`ParameterSet` in which the returned uniquetwig will point to this Parameter. If not provided or Non...
entailment
def twig(self): """ The twig of a Parameter is a single string with the individual :meth:`meta` tags separated by '@' symbols. This twig gives a single string which can point back to this Parameter. see also :meth:`uniquetwig` :return: twig (full) of this Parameter ...
The twig of a Parameter is a single string with the individual :meth:`meta` tags separated by '@' symbols. This twig gives a single string which can point back to this Parameter. see also :meth:`uniquetwig` :return: twig (full) of this Parameter
entailment
def is_visible(self): """ see also :meth:`visible_if` :return: whether this parameter is currently visible (and therefore shown in ParameterSets and visible to :meth:`ParameterSet.filter`) :rtype: bool """ def is_visible_single(visible_if): # visi...
see also :meth:`visible_if` :return: whether this parameter is currently visible (and therefore shown in ParameterSets and visible to :meth:`ParameterSet.filter`) :rtype: bool
entailment
def get_parent_ps(self): """ Return a :class:`ParameterSet` of all Parameters in the same :class:`phoebe.frontend.bundle.Bundle` which share the same meta-tags (except qualifier, twig, uniquetwig) :return: the parent :class:`ParameterSet` """ if self._bundle is N...
Return a :class:`ParameterSet` of all Parameters in the same :class:`phoebe.frontend.bundle.Bundle` which share the same meta-tags (except qualifier, twig, uniquetwig) :return: the parent :class:`ParameterSet`
entailment
def get_value(self, *args, **kwargs): """ This method should be overriden by any subclass of Parameter, and should be decorated with the @update_if_client decorator. Please see the individual classes documentation: * :meth:`FloatParameter.get_value` * :meth:`Arra...
This method should be overriden by any subclass of Parameter, and should be decorated with the @update_if_client decorator. Please see the individual classes documentation: * :meth:`FloatParameter.get_value` * :meth:`ArrayParameter.get_value` * :meth:`HierarchyParame...
entailment
def expand_value(self, **kwargs): """ expand the selection to account for wildcards """ selection = [] for v in self.get_value(**kwargs): for choice in self.choices: if v==choice and choice not in selection: selection.append(choice)...
expand the selection to account for wildcards
entailment
def remove_not_valid_selections(self): """ update the value to remove any that are (no longer) valid """ value = [v for v in self.get_value() if self.valid_selection(v)] self.set_value(value)
update the value to remove any that are (no longer) valid
entailment
def within_limits(self, value): """ check whether a value falls within the set limits :parameter value: float or Quantity to test. If value is a float, it is assumed that it has the same units as default_units """ return (self.limits[0] is None or value >= self.lim...
check whether a value falls within the set limits :parameter value: float or Quantity to test. If value is a float, it is assumed that it has the same units as default_units
entailment
def within_limits(self, value): """ check whether a value falls within the set limits :parameter value: float or Quantity to test. If value is a float, it is assumed that it has the same units as default_units """ if isinstance(value, int) or isinstance(value, floa...
check whether a value falls within the set limits :parameter value: float or Quantity to test. If value is a float, it is assumed that it has the same units as default_units
entailment
def is_constraint(self): """ returns the expression of the constraint that constrains this parameter """ if self._is_constraint is None: return None return self._bundle.get_parameter(context='constraint', uniqueid=self._is_constraint)
returns the expression of the constraint that constrains this parameter
entailment
def constrained_by(self): """ returns a list of parameters that constrain this parameter """ if self._is_constraint is None: return [] params = [] for var in self.is_constraint._vars: param = var.get_parameter() if param.uniqueid != sel...
returns a list of parameters that constrain this parameter
entailment
def in_constraints(self): """ returns a list of the expressions in which this parameter constrains another """ expressions = [] for uniqueid in self._in_constraints: expressions.append(self._bundle.get_parameter(context='constraint', uniqueid=uniqueid)) return...
returns a list of the expressions in which this parameter constrains another
entailment
def constrains(self): """ returns a list of parameters that are constrained by this parameter """ params = [] for constraint in self.in_constraints: for var in constraint._vars: param = var.get_parameter() if param.component == constrai...
returns a list of parameters that are constrained by this parameter
entailment
def related_to(self): """ returns a list of all parameters that are either constrained by or constrain this parameter """ params = [] constraints = self.in_constraints if self.is_constraint is not None: constraints.append(self.is_constraint) for const...
returns a list of all parameters that are either constrained by or constrain this parameter
entailment
def to_string_short(self): """ see also :meth:`to_string` :return: a shorter abreviated string reprentation of the parameter """ opt = np.get_printoptions() np.set_printoptions(threshold=8, edgeitems=3, linewidth=opt['linewidth']-len(self.uniquetwig)-2) str_ = su...
see also :meth:`to_string` :return: a shorter abreviated string reprentation of the parameter
entailment
def interp_value(self, **kwargs): """ Interpolate to find the value in THIS array given a value from ANOTHER array in the SAME parent :class:`ParameterSet` This currently only supports simple 1d linear interpolation (via numpy.interp) and does no checks to make sure you're inter...
Interpolate to find the value in THIS array given a value from ANOTHER array in the SAME parent :class:`ParameterSet` This currently only supports simple 1d linear interpolation (via numpy.interp) and does no checks to make sure you're interpolating with respect to an independent parame...
entailment
def set_property(self, **kwargs): """ set any property of the underlying nparray object """ if not isinstance(self._value, nparray.ndarray): raise ValueError("value is not a nparray object") for property, value in kwargs.items(): setattr(self._value, prop...
set any property of the underlying nparray object
entailment
def _parse_repr(self): """ turn something like "orbit:outer(orbit:inner(star:starA, star:starB), star:starC)" into ['orbit:outer', ['orbit:inner', ['star:starA', 'star:starB'], 'star:starC']] """ repr_ = self.get_value() repr_str = '["{}"]'.format(repr_.replace(', ...
turn something like "orbit:outer(orbit:inner(star:starA, star:starB), star:starC)" into ['orbit:outer', ['orbit:inner', ['star:starA', 'star:starB'], 'star:starC']]
entailment
def _recurse_find_trace(self, structure, item, trace=[]): """ given a nested structure from _parse_repr and find the trace route to get to item """ try: i = structure.index(item) except ValueError: for j,substructure in enumerate(structure): ...
given a nested structure from _parse_repr and find the trace route to get to item
entailment
def _get_by_trace(self, structure, trace): """ retrieve an item from the nested structure from _parse_repr given a trace (probably modified from _recurse_find_trace) """ for i in trace: structure = structure[i] return structure
retrieve an item from the nested structure from _parse_repr given a trace (probably modified from _recurse_find_trace)
entailment
def get_stars(self): """ get 'component' of all stars in order primary -> secondary """ l = re.findall(r"[\w']+", self.get_value()) # now search for indices of star and take the next entry from this flat list return [l[i+1] for i,s in enumerate(l) if s=='star']
get 'component' of all stars in order primary -> secondary
entailment
def get_orbits(self): """ get 'component' of all orbits in order primary -> secondary """ #~ l = re.findall(r"[\w']+", self.get_value()) # now search for indices of orbit and take the next entry from this flat list #~ return [l[i+1] for i,s in enumerate(l) if s=='orbit'] ...
get 'component' of all orbits in order primary -> secondary
entailment
def get_stars_of_sibling_of(self, component): """ same as get_sibling_of except if the sibling is an orbit, this will recursively follow the tree to return a list of all stars under that orbit """ sibling = self.get_sibling_of(component) if sibling in self.get_stars(): ...
same as get_sibling_of except if the sibling is an orbit, this will recursively follow the tree to return a list of all stars under that orbit
entailment
def get_children_of(self, component, kind=None): """ get to component labels of the children of a given component """ structure, trace, item = self._get_structure_and_trace(component) item_kind, item_label = item.split(':') if isinstance(kind, str): kind = [...
get to component labels of the children of a given component
entailment
def get_stars_of_children_of(self, component): """ same as get_children_of except if any of the children are orbits, this will recursively follow the tree to return a list of all children (grandchildren, etc) stars under that orbit """ stars = self.get_stars() orbits = s...
same as get_children_of except if any of the children are orbits, this will recursively follow the tree to return a list of all children (grandchildren, etc) stars under that orbit
entailment
def get_child_of(self, component, ind, kind=None): """ get a child (by index) of a given component """ children = self.get_children_of(component, kind=kind) if children is None: return None else: return children[ind]
get a child (by index) of a given component
entailment
def get_primary_or_secondary(self, component, return_ind=False): """ return whether a given component is the 'primary' or 'secondary' component in its parent orbit """ parent = self.get_parent_of(component) if parent is None: # then this is a single component,...
return whether a given component is the 'primary' or 'secondary' component in its parent orbit
entailment
def get_meshables(self): """ return a list of components that are meshable (generally stars, but handles the envelope for an contact_binary) """ l = re.findall(r"[\w']+", self.get_value()) # now search for indices of star and take the next entry from this flat list ...
return a list of components that are meshable (generally stars, but handles the envelope for an contact_binary)
entailment
def is_contact_binary(self, component): """ especially useful for constraints tells whether any component (star, envelope) is part of a contact_binary by checking its siblings for an envelope """ if component not in self._is_contact_binary.keys(): self._updat...
especially useful for constraints tells whether any component (star, envelope) is part of a contact_binary by checking its siblings for an envelope
entailment
def is_binary(self, component): """ especially useful for constraints tells whether any component (star, envelope) is part of a binary by checking its parent """ if component not in self._is_binary.keys(): self._update_cache() return self._is_binary....
especially useful for constraints tells whether any component (star, envelope) is part of a binary by checking its parent
entailment
def vars(self): """ return all the variables in a PS """ # cache _var_params if self._var_params is None: self._var_params = ParameterSet([var.get_parameter() for var in self._vars]) return self._var_params
return all the variables in a PS
entailment
def get_parameter(self, twig=None, **kwargs): """ get a parameter from those that are variables """ kwargs['twig'] = twig kwargs['check_default'] = False kwargs['check_visible'] = False ps = self.vars.filter(**kwargs) if len(ps)==1: return ps.g...
get a parameter from those that are variables
entailment
def flip_for(self, twig=None, expression=None, **kwargs): """ flip the constraint to solve for for any of the parameters in the expression expression (optional if sympy available, required if not) """ _orig_expression = self.get_value() # try to get the parameter from ...
flip the constraint to solve for for any of the parameters in the expression expression (optional if sympy available, required if not)
entailment
def get_status(self): """ [NOT IMPLEMENTED] """ if self._value == 'loaded': status = 'loaded' elif not _is_server and self._bundle is not None and self._server_status is not None: if not _can_requests: raise ImportError("requests module re...
[NOT IMPLEMENTED]
entailment
def get_unbound_form(self): """ Overrides behavior of FormView.get_form_kwargs when method is POST or PUT """ form_kwargs = self.get_form_kwargs() # @@@ remove fields that would cause the form to be bound # when instantiated bound_fields = ["data", "files"...
Overrides behavior of FormView.get_form_kwargs when method is POST or PUT
entailment
def get_form_success_data(self, form): """ Allows customization of the JSON data returned when a valid form submission occurs. """ data = { "html": render_to_string( "pinax/teams/_invite_form.html", { "invite_form": self.get...
Allows customization of the JSON data returned when a valid form submission occurs.
entailment
def _value(obj): """ make sure to get a float """ # TODO: this is ugly and makes everything ugly # can we handle this with a clean decorator or just requiring that only floats be passed?? if hasattr(obj, 'value'): return obj.value elif isinstance(obj, np.ndarray): return np.a...
make sure to get a float
entailment
def _estimate_delta(ntriangles, area): """ estimate the value for delta to send to marching based on the number of requested triangles and the expected surface area of mesh """ return np.sqrt(4./np.sqrt(3) * float(area) / float(ntriangles))
estimate the value for delta to send to marching based on the number of requested triangles and the expected surface area of mesh
entailment
def from_bundle(cls, b, compute=None, datasets=[], **kwargs): """ Build a system from the :class:`phoebe.frontend.bundle.Bundle` and its hierarchy. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str compute: name of the computeoptions in the bundle :...
Build a system from the :class:`phoebe.frontend.bundle.Bundle` and its hierarchy. :parameter b: the :class:`phoebe.frontend.bundle.Bundle` :parameter str compute: name of the computeoptions in the bundle :parameter list datasets: list of names of datasets :parameter **kwargs: te...
entailment
def get_body(self, component): """ TODO: add documentation """ if component in self._bodies.keys(): return self._bodies[component] else: # then hopefully we're a child star of an contact_binary envelope parent_component = self._parent_envelope_...
TODO: add documentation
entailment
def update_positions(self, time, xs, ys, zs, vxs, vys, vzs, ethetas, elongans, eincls, ds=None, Fs=None, ignore_effects=False): """ TODO: add documentation all arrays should be for the current time, but iterable over all bodies """ ...
TODO: add documentation all arrays should be for the current time, but iterable over all bodies
entailment
def populate_observables(self, time, kinds, datasets, ignore_effects=False): """ TODO: add documentation ignore_effects: whether to ignore reflection and features (useful for computing luminosities) """ if self.irrad_method is not 'none' and not ignore_effects: # T...
TODO: add documentation ignore_effects: whether to ignore reflection and features (useful for computing luminosities)
entailment
def handle_eclipses(self, expose_horizon=False, **kwargs): """ Detect the triangles at the horizon and the eclipsed triangles, handling any necessary subdivision. :parameter str eclipse_method: name of the algorithm to use to detect the horizon or eclipses (defaults to the v...
Detect the triangles at the horizon and the eclipsed triangles, handling any necessary subdivision. :parameter str eclipse_method: name of the algorithm to use to detect the horizon or eclipses (defaults to the value set by computeoptions) :parameter str subdiv_alg: name of the algo...
entailment