pint.models.timing_model.Component
- class pint.models.timing_model.Component[source]
Bases:
object
Timing model components.
When such a class is defined, it registers itself in
Component.component_types
so that it can be found and used when parsing par files. Note that classes are registered when their modules are imported, so ensure all classes of interest are imported before this list is checked.These objects can be constructed with no particular values, but their .setup() and .validate() methods should be called before using them to compute anything. These should check parameter values for validity, raising an exception if invalid parameter values are chosen.
Methods
add_param
(param[, deriv_func, setup])Add a parameter to the Component.
get_params_of_type
(param_type)Get all the parameters in timing model for one specific type.
get_prefix_mapping_component
(prefix)Get the index mapping for the prefix parameters.
is_in_parfile
(para_dict)Check if this subclass included in parfile.
match_param_aliases
(alias)Return the parameter corresponding to this alias.
Print help lines for all available parameters in model.
print_par
([format])- param format:
Parfile output format. PINT outputs the 'tempo', 'tempo2' and 'pint'
register_deriv_funcs
(func, param)Register the derivative function in to the deriv_func dictionaries.
remove_param
(param)Remove a parameter from the Component.
set_special_params
(spcl_params)setup
()Finalize construction loaded values.
validate
()Validate loaded values.
validate_toas
(toas)Check that this model component has TOAs where needed.
Attributes
Return all the aliases and map to the PINT parameter name.
Category is a feature the class, so delegate.
component_types
Return the free parameters in the component.
param_prefixs
- property category
Category is a feature the class, so delegate.
- property free_params_component
Return the free parameters in the component.
This function collects the non-frozen parameters.
- Return type:
A list of free parameters.
- property aliases_map
Return all the aliases and map to the PINT parameter name.
This property returns a dictionary from the current in timing model parameters’ aliase to the pint defined parameter names. For the aliases of a prefixed parameter, the aliase with an existing prefix index maps to the PINT defined parameter name with the same index. Behind the scenes, the indexed parameter adds the indexed aliase to its aliase list.
- add_param(param, deriv_func=None, setup=False)[source]
Add a parameter to the Component.
The parameter is stored in an attribute on the Component object. Its name is also recorded in a list,
self.params
.- Parameters:
param (pint.models.Parameter) – The parameter to be added.
deriv_func (function) – Derivative function for parameter.
- remove_param(param)[source]
Remove a parameter from the Component.
- Parameters:
param (str or pint.models.Parameter) – The parameter to remove.
- get_params_of_type(param_type)[source]
Get all the parameters in timing model for one specific type.
- match_param_aliases(alias)[source]
Return the parameter corresponding to this alias.
- Parameters:
alias (str) – Alias name.
Note
This function only searches the parameter aliases within the current component. If one wants to search the aliases in the scope of TimingModel, please use
TimingModel.match_param_aliase()
.
- register_deriv_funcs(func, param)[source]
Register the derivative function in to the deriv_func dictionaries.
- Parameters:
func (callable) – Calculates the derivative
param (str) – Name of parameter the derivative is with respect to