pint.models.parameter.prefixParameter
- class pint.models.parameter.prefixParameter(parameter_type='float', name=None, value=None, units=None, unit_template=None, description=None, description_template=None, uncertainty=None, frozen=True, continuous=True, prefix_aliases=None, long_double=False, unit_scale=False, scale_factor=None, scale_threshold=None, time_scale='utc', **kwargs)[source]
Bases:
object
Families of parameters identified by a prefix like
DMX_0123
.Creating a
prefixParameter
is like creating a normal parameter, except that the name should be in the format of prefix and index. For example,DMX_0001
orF22
. Appropriate units will be inferred.To create a prefix parameter with the same prefix but different index, just use the
pint.models.parameter.prefixParameter.new_param()
method. It will return a newprefixParameter
with the same setup but a new index. Some units and descriptions will be changed once the index has been changed. The new parameter will not inherit thefrozen
status of its parent by default. In order to get the right units and description,.unit_template
and.description_template
should be provided. If not the new prefix parameter will use the same units and description with the old one. A typical description and units template is like:>>> description_template = lambda x: 'This is the description of parameter %d'%x >>> unit_template = lambda x: 'second^%d'%x
Although it is best to avoid using lambda functions
- Parameters:
parameter_type (str, optional) – Example parameter class template for quantity and value setter
name (str optional) – The name of the parameter. It has to be in the format of prefix + index.
value – Initial parameter value
units (str, optional) – Units that the value is expressed in
unit_template (callable) – The unit template for prefixed parameter
description (str, optional) – Description for the parameter
description_template (callable) – Description template for prefixed parameters
prefix_aliases (list of str, optional) – Alias for the prefix
frozen (bool, optional) – A flag specifying whether “fitters” should adjust the value of this parameter or leave it fixed.
continuous (bool) – Whether derivatives with respect to this parameter make sense.
parameter_type – Example parameter class template for quantity and value setter
long_double (bool, optional) – Set float type quantity and value in numpy long doubles.
time_scale (str, optional) – Time scale for MJDParameter class.
Methods
as_latex
()as_parfile_line
([format])as_ufloat
([units])Return the parameter as a
uncertainties.ufloat
from_parfile_line
(line)help_line
()name_matches
(name)new_param
(index[, inheritfrozen])Get one prefix parameter with the same type.
prefix_matches
(prefix)prior_pdf
([value, logpdf])str_quantity
(quan)Attributes
aliases
continuous
description
frozen
prior
quantity
repeatable
special_arg
uncertainty
uncertainty_value
units
use_alias
value
- as_ufloat(units=None)[source]
Return the parameter as a
uncertainties.ufloat
Will cast to the specified units, or the default If the uncertainty is not set will be returned as 0
- Parameters:
units (astropy.units.core.Unit, optional) – Units to cast the value
- Return type:
uncertainties.ufloat