pint.models.binary_bt.BinaryBTPiecewise
- class pint.models.binary_bt.BinaryBTPiecewise[source]
Bases:
PulsarBinary
Model implementing the BT model with piecewise orbital parameters A1X and T0X. This model lets the user specify time ranges and fit for a different piecewise orbital parameter in each time range, This is a PINT pulsar binary BTPiecewise model class, a subclass of PulsarBinary. It is a wrapper for stand alone BTPiecewise class defined in ./stand_alone_psr_binary/BT_piecewise.py The aim for this class is to connect the stand alone binary model with the PINT platform. BTpiecewise special parameters, where xxxx denotes the 4-digit index of the piece: T0X_xxxx Piecewise T0 values for piece A1X_xxxx Piecewise A1 values for piece XR1_xxxx Lower time boundary of piece XR2_xxxx Upper time boundary of piece
Methods
FBX_description
(n)FBX_unit
(n)add_group_range
(group_start_mjd, group_end_mjd)Add an orbital piecewise parameter group range.
add_param
(param[, deriv_func, setup])Add a parameter to the Component.
add_piecewise_param
(piece_index, **kwargs)Add an orbital piecewise parameter.
Apply units to parameter value.
binarymodel_delay
(toas[, acc_delay])Return the binary model independent delay call.
change_binary_epoch
(new_epoch)Change the epoch for this binary model.
check_required_params
(required_params)d_binary_delay_d_xxxx
(toas, param, acc_delay)Return the binary model delay derivatives.
Get the number of piecewise parameters
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.
paramx_per_toa
(param_name, toas)Find the piecewise parameter value each toa will reference during calculations :param param_name: which piecewise parameter to show: 'A1'/'T0'.
pb
([t])Return binary period and uncertainty (optionally evaluated at different times) regardless of binary 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.
remove_range
(index)Removes all orbital piecewise parameters associated with a given index/list of indices.
set_special_params
(spcl_params)setup
()- raises ValueError:
if there are values that have been added without name/ranges associated (should only be raised if add_piecewise_param has been side-stepped with an alternate method)
update_binary_object
(toas[, acc_delay])Update stand alone binary's parameters and toas from PINT-facing object.
validate
()Include catches for overlapping groups.
validate_toas
(toas)Check that this model component has TOAs where needed.
Find the group a toa belongs to based on the boundaries of groups passed to BT_piecewise
Attributes
Return all the aliases and map to the PINT parameter name.
category
component_types
Return the free parameters in the component.
param_prefixs
register
- add_group_range(group_start_mjd, group_end_mjd, piece_index=None)[source]
Add an orbital piecewise parameter group range. If piece_index is not provided a new piece will be added with index equal to the number of pieces plus one. Pieces cannot have the duplicate pieces and cannot have the same index. A pair of consisting of a piecewise A1 and T0 may share an index and will act over the same piece range. :param group_start_mjd: MJD for the piece lower boundary :type group_start_mjd: float or astropy.quantity.Quantity or astropy.time.Time :param group_end_mjd: MJD for the piece upper boundary :type group_end_mjd: float or astropy.quantity.Quantity or astropy.time.Time :param piece_index: Number to label the piece being added. :type piece_index: int
- remove_range(index)[source]
Removes all orbital piecewise parameters associated with a given index/list of indices. :param index: Number or list/array of numbers corresponding to T0X/A1X indices to be removed from model. :type index: float, int, list, np.ndarray
- add_piecewise_param(piece_index, **kwargs)[source]
Add an orbital piecewise parameter. :param piece_index: Number to label the piece being added. Expected to match a set of piece boundaries. :type piece_index: int :param param: Piecewise parameter label e.g. “T0” or “A1”. :type param: str :param paramx: Piecewise parameter value. :type paramx: np.float128 or astropy.quantity.Quantity
- setup()[source]
- Raises:
ValueError – if there are values that have been added without name/ranges associated (should only be raised if add_piecewise_param has been side-stepped with an alternate method)
- validate()[source]
Include catches for overlapping groups. etc :raises ValueError: if there are pieces with no associated boundaries (T0X_0000 does not have a corresponding XR1_0000/XR2_0000) :raises ValueError: if any boundaries overlap (as it makes TOA assignment to a single group ambiguous). i.e. XR1_0000<XR2_0000 and XR2_0000>XR1_0001 :raises ValueError: if the number of lower and upper bounds don’t match (should only be raised if XR1 is defined without XR2 and validate is run or vice versa)
- paramx_per_toa(param_name, toas)[source]
Find the piecewise parameter value each toa will reference during calculations :param param_name: which piecewise parameter to show: ‘A1’/’T0’. TODO this should raise an error if not present) :type param_name: string :param toa: :type toa: pint.toa.TOA
- Returns:
length(toa) elements are T0X or A1X values to reference for each toa during binary calculations.
- Return type:
u.quantity.Quantity
- add_param(param, deriv_func=None, setup=False)
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.
- 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.
- apply_units()
Apply units to parameter value.
- binarymodel_delay(toas, acc_delay=None)
Return the binary model independent delay call.
- change_binary_epoch(new_epoch)
Change the epoch for this binary model.
T0 will be changed to the periapsis time closest to the supplied epoch, and the argument of periapsis (OM), eccentricity (ECC), and projected semi-major axis (A1 or X) will be updated according to the specified OMDOT, EDOT, and A1DOT or XDOT, if present.
Note that derivatives of binary orbital frequency higher than the first (FB2, FB3, etc.) are ignored in computing the new T0, even if present in the model. If high-precision results are necessary, especially for models containing higher derivatives of orbital frequency, consider re-fitting the model to a set of TOAs. The use of
pint.simulation.make_fake_toas()
and thepint.fitter.Fitter
optiontrack_mode="use_pulse_number"
can make this extremely simple.- Parameters:
new_epoch (float MJD (in TDB) or astropy.Time object) – The new epoch value.
- d_binary_delay_d_xxxx(toas, param, acc_delay)
Return the binary model delay derivatives.
- 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.
- 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.
- Parameters:
para_dict (dictionary) – A dictionary contain all the parameters with values in string from one parfile
- Returns:
Whether the subclass is included in the parfile.
- Return type:
- match_param_aliases(alias)
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()
.
- param_help()
Print help lines for all available parameters in model.
- pb(t=None)
Return binary period and uncertainty (optionally evaluated at different times) regardless of binary model
- Parameters:
t (astropy.time.Time, astropy.units.Quantity, numpy.ndarray, float, int, str, optional) – Time(s) to evaluate period
- Returns:
astropy.units.Quantity – Binary period
astropy.units.Quantity – Binary period uncertainty
- print_par(format='pint')
- Parameters:
format (str, optional) – Parfile output format. PINT outputs the ‘tempo’, ‘tempo2’ and ‘pint’ format. The defaul format is pint. Actual formatting done elsewhere.
- Returns:
str
- Return type:
formatted line for par file
- register_deriv_funcs(func, param)
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
- remove_param(param)
Remove a parameter from the Component.
- Parameters:
param (str or pint.models.Parameter) – The parameter to remove.
- update_binary_object(toas, acc_delay=None)
Update stand alone binary’s parameters and toas from PINT-facing object.
This function passes the PINT-facing object’s parameter values and TOAs to the stand-alone binary object. If the TOAs are not provided, it only updates the parameters not the TOAs.
- Parameters:
toas (pint.toa.TOAs) – The TOAs that need to pass to the stand alone model.Default value is None. If toas is None, this function only updates the parameter value. If ‘acc_delay’ is not provided, the stand alone binary receives the standard barycentered TOAs.
acc_delay (numpy.ndarray) – If provided, TOAs will be corrected by provided acc_delay instead of the standard barycentering. The stand alone binary receives the input TOAs - acc_delay.
Notes
The values for
obs_pos
(the observatory position wrt the Solar System Barycenter) andpsr_pos
(the pulsar position wrt the Solar System Barycenter) are both computed in the same reference frame, ICRS or ECL depending on the model.- Warns:
If passing ‘None’ to ‘toa’ argument, the stand alone binary model will use
the TOAs were passed to it from last iteration (i.e. last barycentered
TOAs) or no TOAs for stand alone binary model at all. This behavior will
cause incorrect answers. Allowing the passing None to ‘toa’ argument is
for some lower level functions and tests. We do not recommend PINT
user to use it.
- validate_toas(toas)
Check that this model component has TOAs where needed.