pint.observatory package¶
Submodules¶
pint.observatory.clock_file module¶
-
class
pint.observatory.clock_file.ClockFile[source]¶ Bases:
objectThe ClockFile class provides a way to read various formats of clock files. It will provide the clock information from the file as arrays of times and clock correction values via the ClockFile.time and ClockFile.clock properties. The file should be initially read using the ClockFile.read() method, for example:
>>> cf = ClockFile.read(os.getenv('TEMPO')+'/clock/time_gbt.dat') >>> print cf.time [ 51909.5 51910.5 51911.5 ..., 57475.5 57476.5 57477.5] >>> print cf.clock [-3.14 -3.139 -3.152 ..., 0.179 0.185 0.188] us
Or:
>>> cf = ClockFile.read(os.getenv('TEMPO2')+'/clock/gbt2gps.clk', format='tempo2') >>> print cf.time [ 51909.5 51910.5 51911.5 ..., 57411.5 57412.5 57413.5] >>> print cf.clock [ -3.14000000e-06 -3.13900000e-06 -3.15200000e-06 ..., 1.80000000e-08 2.10000000e-08 2.30000000e-08] s
-
evaluate(t, limits='warn')[source]¶ Evaluate the clock corrections at the times t (given as an array-valued Time object). By default, values are linearly interpolated but this could be overridden by derived classes if needed. The first/last values will be applied to times outside the data range. If limits==’warn’ this will also issue a warning. If limits==’error’ an exception will be raised.
-
clock¶
-
time¶
-
-
class
pint.observatory.clock_file.ClockFileMeta(name, bases, members)[source]¶ Bases:
typeMetaclass that provides a registry for different clock file formats. ClockFile implementations should define a ‘format’ class member giving the name of the format.
-
class
pint.observatory.clock_file.Tempo2ClockFile(filename, **kwargs)[source]¶ Bases:
pint.observatory.clock_file.ClockFile-
static
load_tempo2_clock_file(filename)[source]¶ Reads a tempo2-format clock file. Returns three values: (mjd, clk, hdrline). The first two are float arrays of MJD and clock corrections (seconds). hdrline is the first line of the file that specifies the two clock scales connected by the file.
-
format= 'tempo2'¶
-
static
-
class
pint.observatory.clock_file.TempoClockFile(filename, obscode=None, **kwargs)[source]¶ Bases:
pint.observatory.clock_file.ClockFile-
static
load_tempo1_clock_file(filename, site=None)[source]¶ Given the specified full path to the tempo1-format clock file, will return two numpy arrays containing the MJDs and the clock corrections (us). All computations here are done as in tempo, with the exception of the ‘F’ flag (to disable interpolation), which is currently not implemented.
INCLUDE statments are processed.
If the ‘site’ argument is set to an appropriate one-character tempo site code, only values for that site will be returned, otherwise all values found in the file will be returned.
-
format= 'tempo'¶
-
static
pint.observatory.nicer_obs module¶
-
class
pint.observatory.nicer_obs.NICERObs(name, FPorbname)[source]¶ Bases:
pint.observatory.special_locations.SpecialLocationObservatory-derived class for the NICER photon data.
Note that this must be instantiated once to be put into the Observatory registry.
-
posvel(t, ephem)[source]¶ Return position and velocity vectors of NICER.
t is an astropy.Time or array of astropy.Times
-
earth_location¶
-
tempo_code¶
-
timescale¶
-
pint.observatory.observatories module¶
pint.observatory.observatory module¶
-
class
pint.observatory.observatory.Observatory(name, aliases=None)[source]¶ Bases:
objectThe Observatory class defines observatory locations and related site-dependent properties (eg, TOA time scales, clock corrections). Any new Observtory that is declared will be automatically added to a registry that is keyed on observatory name. Aside from their initial declaration (for examples, see pint/observatory/observatories.py), Observatory instances should generally be accessed only via the Observatory.get() function. This will query the registry based on observatory name (and any defined aliases). A list of all registered names can be returned via Observatory.names().
-
clock_corrections(t)[source]¶ Given an array-valued Time, return the clock corrections as a numpy array, with units. These values are to be added to the raw TOAs in order to refer them to the timescale specified by self.timescale.
-
classmethod
get(name)[source]¶ Returns the Observatory instance for the specified name/alias. If the name has not been defined, an error will be raised. Aside from the initial observatory definitions, this is in general the only way Observatory objects should be accessed. Name-matching is case-insensitive.
-
posvel(t, ephem)[source]¶ Returns observatory position and velocity relative to solar system barycenter for the given times (astropy array-valued Time objects).
-
aliases¶
-
earth_location¶ Returns observatory geocentric position as an astropy EarthLocation object. For observatories where this is not relevant, None can be returned.
-
name¶
-
timescale¶ Returns the timescale that TOAs from this observatory will be in, once any clock corrections have been applied. This should be a string suitable to be passed directly to the scale argument of astropy.time.Time().
-
-
pint.observatory.observatory.get_observatory(name, include_gps=True, include_bipm=True)[source]¶ Conviencience function to get observatory object with options.
This function will simply call the
Observatory.getmethod but will manually set options after the method is called.Required arguments:
name = The name of the observatoryOptional Arguments
- include_gps = Set False to disable UTC(GPS)->UTC clock
- correction.
- include_bipm = Set False to disable TAI TT(BIPM) clock
- correction.
Note
This function can and should be expanded if more clock file switches/options are added at a public API level.
pint.observatory.special_locations module¶
-
class
pint.observatory.special_locations.BarycenterObs(name, aliases=None)[source]¶ Bases:
pint.observatory.special_locations.SpecialLocationObservatory-derived class for the solar system barycenter. Time scale is assumed to be tdb.
-
tempo2_code¶
-
tempo_code¶
-
timescale¶
-
-
class
pint.observatory.special_locations.GeocenterObs(name, aliases=None)[source]¶ Bases:
pint.observatory.special_locations.SpecialLocationObservatory-derived class for the Earth geocenter.
-
earth_location¶
-
tempo2_code¶
-
tempo_code¶
-
timescale¶
-
-
class
pint.observatory.special_locations.SpecialLocation(name, aliases=None)[source]¶ Bases:
pint.observatory.observatory.ObservatoryObservatory-derived class for special sites that are not really observatories but sometimes are used as TOA locations (eg, solar system barycenter). Currently the only feature of this class is that clock corrections are zero.
pint.observatory.topo_obs module¶
-
class
pint.observatory.topo_obs.TopoObs(name, tempo_code=None, itoa_code=None, aliases=None, itrf_xyz=None, clock_file='time.dat', clock_dir='PINT', clock_fmt='tempo', include_gps=True, include_bipm=True)[source]¶ Bases:
pint.observatory.observatory.ObservatoryClass for representing observatories that are at a fixed location on the surface of the Earth. This behaves very similarly to “standard” site definitions in tempo/tempo2. Clock correction files are read and computed, observatory coordinates are specified in ITRF XYZ, etc.
Required arguments:
name = The name of the observatory itrf_xyz = IRTF site coordinates (len-3 array). Can include
astropy units. If no units are given, meters are assumed.Optional arguments:
- tempo_code = 1-character tempo code for the site. Will be
- automatically added to aliases. Note, this is REQUIRED only if using TEMPO time.dat clock file.
itoa_code = 2-character ITOA code. Will be added to aliases. aliases = List of other aliases for the observatory name. clock_file = Name of the clock correction file.
Default=’time.dat’- clock_dir = Location of the clock file. Special values
- ‘TEMPO’, ‘TEMPO2’, or ‘PINT’ mean to use the standard directory for the package. Otherwise can be set to a full path to the directory containing the clock_file. Default=’TEMPO’
- clock_fmt = Format of clock file (see ClockFile class for allowed
- values). Default=’tempo’
- include_gps = Set False to disable UTC(GPS)->UTC clock
- correction.
- include_bipm = Set False to disable TAI TT(BIPM) clock
- correction.
-
bipm_fullpath¶ Returns full path to the TAI TT(BIPM) clock file. Will first try PINT data dirs, then fall back on $TEMPO2/clock.
-
clock_fullpath¶ Returns the full path to the clock file.
-
earth_location¶
-
gps_fullpath¶ Returns full path to the GPS-UTC clock file. Will first try PINT data dirs, then fall back on $TEMPO2/clock.
-
timescale¶