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', convert_tcb2tdb=True, tcb2tdb_scale_factor=None, **kwargs)[source]
Bases:
objectFamilies of parameters identified by a prefix like
DMX_0123.Creating a
prefixParameteris like creating a normal parameter, except that the name should be in the format of prefix and index. For example,DMX_0001orF22. 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 newprefixParameterwith 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 thefrozenstatus of its parent by default. In order to get the right units and description,.unit_templateand.description_templateshould 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.
convert_tcb2tdb (bool) – Whether to convert this parameter during TCB <-> TDB conversion.
tcb2tdb_scale_factor (astropy.units.Quantity or function) – The scaling factor to be applied while computing the effective dimensionality. If this is a function, it should take the prefix as argument and return the scaling factor. The default is 1.
Methods
as_latex()as_parfile_line([format])as_ufloat([units])Return the parameter as a
uncertainties.ufloatfrom_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
aliasescontinuousconvert_tcb2tdbdescriptionCompute the effective dimensionality for TCB <-> TDB conversion.
frozenpriorquantityrepeatablespecial_argtcb2tdb_scale_factoruncertaintyuncertainty_valueunitsuse_aliasvalue- as_ufloat(units=None)[source]
Return the parameter as a
uncertainties.ufloatWill 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