pint.models.model_builder.get_model_and_toas

pint.models.model_builder.get_model_and_toas(parfile, timfile, ephem=None, include_bipm=None, bipm_version=None, include_gps=None, planets=None, usepickle=False, tdb_method='default', include_pn=True, picklefilename=None, allow_name_mixing=False, limits='warn', allow_tcb=False, allow_T2=False, force_binary_model=None, add_tzr_to_model=True, **kwargs)[source]

Load a timing model and a related TOAs, using model commands as needed

Parameters:
  • parfile (str) – The parfile name, or a file-like object to read the parfile contents from

  • timfile (str) – The timfile name, or a file-like object to read the timfile contents from

  • ephem (str, optional) – If not None (default), this ephemeris will be used to create the TOAs object. Default is to use the EPHEM parameter from the timing model.

  • include_bipm (bool or None) – Whether to apply the BIPM clock correction. Defaults to True.

  • bipm_version (string or None) – Which version of the BIPM tables to use for the clock correction. The format must be ‘BIPMXXXX’ where XXXX is a year.

  • include_gps (bool or None) – Whether to include the GPS clock correction. Defaults to True.

  • planets (bool or None) – Whether to apply Shapiro delays based on planet positions. Note that a long-standing TEMPO2 bug in this feature went unnoticed for years. Defaults to False.

  • usepickle (bool) – Whether to try to use pickle-based caching of loaded clock-corrected TOAs objects.

  • tdb_method (str) – Which method to use for the clock correction to TDB. See pint.observatory.Observatory.get_TDBs() for details.

  • include_pn (bool, optional) – Whether or not to read in the ‘pn’ column (pulse_number)

  • picklefilename (str or None) – Filename to use for caching loaded file. Defaults to adding .pickle.gz to the filename of the timfile, if there is one and only one. If no filename is available, or multiple filenames are provided, a specific filename must be provided.

  • allow_name_mixing (bool, optional) – Flag for allowing the input to have mixing aliases names for the same parameter. For example, if this flag is true, one can have T2EFAC and EFAC, both of them maps to PINT parameter EFAC, present in the parfile at the same time.

  • limits ("warn" or "error") – What to do when encountering TOAs for which clock corrections are not available.

  • allow_tcb (True, False, or "raw", optional) – Whether to read TCB par files. Default is False, and will throw an error upon encountering TCB par files. If True, the par file will be converted to TDB upon read. If “raw”, an unconverted malformed TCB TimingModel object will be returned.

  • allow_T2 (bool, optional) – Whether to convert a T2 binary model to an appropriate underlying binary model. Default is False, and will throw an error upon encountering the T2 binary model. If True, the binary model will be converted to the most appropriate PINT-compatible binary model.

  • force_binary_model (str, optional) – When set to some binary model, like force_binary_model=”DD”, this will override the binary model set in the parfile. Defaults to None

  • add_tzr_to_model (bool, optional) – Create a TZR TOA in the timing model using the created TOAs object. Default is True.

  • kwargs (dict) – Any additional parameter/value pairs that will add to or override those in the parfile.

Return type:

A tuple with (model instance, TOAs instance)