pint.scripts.event_optimize.custom_timing

class pint.scripts.event_optimize.custom_timing(parfile)[source]

Bases: Spindown, AstrometryEcliptic

Methods

F_description(n)

Template function for description

F_unit(n)

Template function for unit

add_param(param[, deriv_func, setup])

Add a parameter to the Component.

as_ECL([epoch, ecl])

Return pint.models.astrometry.Astrometry object in PulsarEcliptic frame.

as_ICRS([epoch])

Return pint.models.astrometry.Astrometry object in ICRS frame.

barycentric_radio_freq(toas)

Return radio frequencies (MHz) of the toas corrected for Earth motion

change_pepoch(new_epoch[, toas, delay])

Move PEPOCH to a new time and change the related parameters.

change_posepoch(new_epoch)

Change POSEPOCH to a new value and update the position accordingly.

coords_as_ECL([epoch, ecl])

Return the pulsar's ecliptic coordinates as an astropy coordinate object.

coords_as_GAL([epoch])

Return the pulsar's galactic coordinates as an astropy coordinate object.

coords_as_ICRS([epoch])

Return the pulsar's ICRS coordinates as an astropy coordinate object.

d_delay_astrometry_d_ELAT(toas[, param, ...])

Calculate the derivative wrt DECJ

d_delay_astrometry_d_ELONG(toas[, param, ...])

Calculate the derivative wrt RAJ.

d_delay_astrometry_d_PMELAT(toas[, param, ...])

Calculate the derivative wrt PMDEC

d_delay_astrometry_d_PMELONG(toas[, param, ...])

Calculate the derivative wrt PMRA

d_delay_astrometry_d_POSEPOCH(toas[, param, ...])

Calculate the derivative wrt POSEPOCH

d_delay_astrometry_d_PX(toas[, param, acc_delay])

Calculate the derivative wrt PX

d_phase_d_F(toas, param, delay)

Calculate the derivative wrt to an spin term.

d_spindown_phase_d_delay(toas, delay)

get_d_delay_quantities(toas)

Calculate values needed for many d_delay_d_param functions

get_d_delay_quantities_ecliptical(toas)

Calculate values needed for many d_delay_d_param functions.

get_dt(toas, delay)

Return dt, the time from the phase 0 epoch to each TOA.

get_params_as_ICRS()

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.

get_psr_coords([epoch])

Returns pulsar sky coordinates as an astropy ecliptic coordinate instance.

get_spin_terms()

Return a list of the spin term values in the model: [F0, F1, ..., FN].

is_in_parfile(para_dict)

Check if this subclass included in parfile.

match_param_aliases(alias)

Return the parameter corresponding to this alias.

param_help()

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.

solar_system_geometric_delay(toas[, acc_delay])

Returns geometric delay (in sec) due to position of site in solar system.

spindown_phase(toas, delay)

Spindown phase function.

ssb_to_psb_xyz_ECL([epoch, ecl])

Returns unit vector(s) from SSB to pulsar system barycenter under ECL.

ssb_to_psb_xyz_ICRS([epoch])

Returns unit vector(s) from SSB to pulsar system barycenter under ICRS.

sun_angle(toas[, heliocenter, also_distance])

Compute the pulsar-observatory-Sun angle.

validate()

Validate loaded values.

validate_toas(toas)

Check that this model component has TOAs where needed.

xyz_from_latlong(lon, lat)

Attributes

F_terms

aliases_map

Return all the aliases and map to the PINT parameter name.

category

component_types

free_params_component

Return the free parameters in the component.

param_prefixs

register

F_description(n)

Template function for description

F_unit(n)

Template function for unit

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.

as_ECL(epoch: float | Quantity | Time = None, ecl: str = 'IERS2010') AstrometryEcliptic

Return pint.models.astrometry.Astrometry object in PulsarEcliptic frame.

Parameters:
Return type:

pint.models.astrometry.AstrometryEcliptic

as_ICRS(epoch: float | Quantity | Time = None) AstrometryEquatorial

Return pint.models.astrometry.Astrometry object in ICRS frame.

Parameters:

epoch (float or astropy.time.Time or astropy.units.Quantity, optional) – If float or Quantity, MJD(TDB) is assumed. New epoch for position.

Return type:

pint.models.astrometry.AstrometryEquatorial

barycentric_radio_freq(toas: TOAs) Quantity

Return radio frequencies (MHz) of the toas corrected for Earth motion

change_pepoch(new_epoch, toas=None, delay=None)

Move PEPOCH to a new time and change the related parameters.

Parameters:
  • new_epoch (float or astropy.Time object) – The new PEPOCH value.

  • toas (toa object, optional.) – If current PEPOCH is not provided, the first pulsar frame toa will be treated as PEPOCH.

  • delay (numpy.array object) – If current PEPOCH is not provided, it is required for computing the first pulsar frame toa.

change_posepoch(new_epoch: float | Quantity | Time)

Change POSEPOCH to a new value and update the position accordingly.

Parameters:

new_epoch (float or astropy.Time or astropy.units.Quantity object) – The new POSEPOCH value.

coords_as_ECL(epoch: float | Quantity | Time = None, ecl: str = None) SkyCoord

Return the pulsar’s ecliptic coordinates as an astropy coordinate object.

The value used for the obliquity of the ecliptic can be controlled with the ecl keyword, which should be one of the codes listed in ecliptic.dat. If ecl is left unspecified, the model’s ECL parameter will be used.

Parameters:
Return type:

astropy.coordinates.SkyCoord

coords_as_GAL(epoch: float | Quantity | Time = None) SkyCoord

Return the pulsar’s galactic coordinates as an astropy coordinate object.

Parameters:

epoch (float or astropy.time.Time or astropy.units.Quantity, optional) – If float or Quantity, MJD(TDB) is assumed

Return type:

astropy.coordinates.SkyCoord

coords_as_ICRS(epoch: float | Quantity | Time = None) SkyCoord

Return the pulsar’s ICRS coordinates as an astropy coordinate object.

Parameters:

epoch (float or astropy.time.Time or astropy.units.Quantity, optional) – If float or Quantity, MJD(TDB) is assumed.

Return type:

astropy.coordinates.SkyCoord

d_delay_astrometry_d_ELAT(toas: TOAs, param='', acc_delay=None) Quantity

Calculate the derivative wrt DECJ

Definitions as in d_delay_d_RAJ

d_delay_astrometry_d_ELONG(toas: TOAs, param='', acc_delay=None) Quantity

Calculate the derivative wrt RAJ.

For the RAJ and DEC derivatives, use the following approximate model for the pulse delay. (Inner-product between two Cartesian vectors)

de = Earth declination (wrt SSB) ae = Earth right ascension dp = pulsar declination aa = pulsar right ascension r = distance from SSB to Earth c = speed of light

delay = r*[cos(de)*cos(dp)*cos(ae-aa)+sin(de)*sin(dp)]/c

elate = Earth elat (wrt SSB) elonge = Earth elong elatp = pulsar elat elongp = pulsar elong r = distance from SSB to Earth c = speed of light

delay = r*[cos(elate)*cos(elatp)*cos(elonge-elongp)+sin(elate)*sin(elatp)]/c

d_delay_astrometry_d_PMELAT(toas: TOAs, param='', acc_delay=None) Quantity

Calculate the derivative wrt PMDEC

Definitions as in d_delay_d_RAJ. Now we have a derivative in mas/yr for the pulsar DEC

d_delay_astrometry_d_PMELONG(toas: TOAs, param='', acc_delay=None) Quantity

Calculate the derivative wrt PMRA

Definitions as in d_delay_d_RAJ. Now we have a derivative in mas/yr for the pulsar RA

d_delay_astrometry_d_POSEPOCH(toas, param='', acc_delay=None)

Calculate the derivative wrt POSEPOCH

d_delay_astrometry_d_PX(toas: TOAs, param='', acc_delay=None) Quantity

Calculate the derivative wrt PX

Roughly following Smart, 1977, chapter 9.

px_r: Extra distance to Earth, wrt SSB, from pulsar r_e: Position of earth (vector) wrt SSB u_p: Unit vector from SSB pointing to pulsar t_d: Parallax delay c: Speed of light delta: Parallax

The parallax delay is due to a distance orthogonal to the line of sight to the pulsar from the SSB:

px_r = sqrt( r_e**2 - (r_e.u_p)**2 ),

with delay

t_d = 0.5 * px_r * delta’/ c, and delta = delta’ * px_r / (1 AU)

d_phase_d_F(toas, param, delay)

Calculate the derivative wrt to an spin term.

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_d_delay_quantities(toas: TOAs) dict

Calculate values needed for many d_delay_d_param functions

get_d_delay_quantities_ecliptical(toas: TOAs) Quantity

Calculate values needed for many d_delay_d_param functions.

get_dt(toas, delay)

Return dt, the time from the phase 0 epoch to each TOA. The phase 0 epoch is assumed to be PEPOCH. If PEPOCH is not set, the first TOA in the table is used instead.

Note, the phase 0 epoch as used here is only intended for computation internal to the Spindown class. The “traditional” tempo-style TZRMJD and related parameters for specifying absolute pulse phase will be handled at a higher level in the code.

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.

Parameters:

prefix (str) – Name of prefix.

Returns:

A dictionary with prefix parameter real index as key and parameter name as value.

Return type:

dict

get_psr_coords(epoch: float | Quantity | Time = None) SkyCoord

Returns pulsar sky coordinates as an astropy ecliptic coordinate instance.

Parameters:

epoch (astropy.time.Time or float or astropy.units.Quantity, optional) – new epoch for position. If float or Quantity, MJD(TDB) is assumed

Returns:

  • position – PulsarEcliptic SkyCoord object optionally with proper motion applied

  • If epoch (MJD) is specified, proper motion is included to return

  • the position at the given epoch.

get_spin_terms()

Return a list of the spin term values in the model: [F0, F1, …, FN].

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:

bool

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.

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.

setup()

Finalize construction loaded values.

solar_system_geometric_delay(toas: TOAs, acc_delay=None) Quantity

Returns geometric delay (in sec) due to position of site in solar system. This includes Roemer delay and parallax.

NOTE: currently assumes XYZ location of TOA relative to SSB is available as 3-vector toa.xyz, in units of light-seconds.

spindown_phase(toas, delay)

Spindown phase function.

delay is the time delay from the TOA to time of pulse emission

at the pulsar, in seconds.

This routine should implement Eq 120 of the Tempo2 Paper II (2006, MNRAS 372, 1549)

returns an array of phases in long double

ssb_to_psb_xyz_ECL(epoch: float | Quantity | Time = None, ecl: str = None) Quantity

Returns unit vector(s) from SSB to pulsar system barycenter under ECL.

If epochs (MJD) are given, proper motion is included in the calculation.

Parameters:
Returns:

(len(epoch), 3) array of unit vectors

Return type:

np.ndarray

ssb_to_psb_xyz_ICRS(epoch: float | Quantity | Time = None) Quantity

Returns unit vector(s) from SSB to pulsar system barycenter under ICRS.

If epochs (MJD) are given, proper motion is included in the calculation.

Parameters:

epoch (float or astropy.time.Time or astropy.units.Quantity, optional) – If float or Quantity, MJD(TDB) is assumed

Returns:

(len(epoch), 3) array of unit vectors

Return type:

np.ndarray

sun_angle(toas: TOAs, heliocenter: bool = True, also_distance: bool = False) ndarray

Compute the pulsar-observatory-Sun angle.

This is the angle between the center of the Sun and the direction to the pulsar, as seen from the observatory (for each TOA).

This angle takes into account the motion of the Sun around the solar system barycenter.

Parameters:
  • toas (pint.toa.TOAs) – The pulse arrival times at which to evaluate the sun angle.

  • heliocenter (bool) – Whether to use the Sun’s actual position (the heliocenter) or the solar system barycenter. The latter may be useful for comparison with other software.

  • also_distance (bool) – If True, also return the observatory-Sun distance as a Quantity

Returns:

The angle in radians

Return type:

array

validate()

Validate loaded values.

validate_toas(toas)

Check that this model component has TOAs where needed.