diff --git a/enterprise/pulsar.py b/enterprise/pulsar.py index b8f23cd5..18a25cd0 100644 --- a/enterprise/pulsar.py +++ b/enterprise/pulsar.py @@ -11,6 +11,7 @@ import astropy.units as u import numpy as np from ephem import Ecliptic, Equatorial +from astropy.time import Time import enterprise from enterprise.signals import utils @@ -108,7 +109,11 @@ def _get_radec_from_ecliptic(self, elong, elat): def _get_pos(self): return np.array( - [np.cos(self._raj) * np.cos(self._decj), np.sin(self._raj) * np.cos(self._decj), np.sin(self._decj)] + [ + np.cos(self._raj) * np.cos(self._decj), + np.sin(self._raj) * np.cos(self._decj), + np.sin(self._decj), + ] ) def sort_data(self): @@ -311,7 +316,6 @@ def telescope(self): class PintPulsar(BasePulsar): def __init__(self, toas, model, sort=True, drop_pintpsr=True, planets=True): - self._sort = sort self.planets = planets self.name = model.PSR.value @@ -367,7 +371,11 @@ def __init__(self, toas, model, sort=True, drop_pintpsr=True, planets=True): "AstrometryEquatorial" if "AstrometryEquatorial" in model.components else "AstrometryEcliptic" ) - self._pos_t = model.components[which_astrometry].ssb_to_psb_xyz_ICRS(model.get_barycentric_toas(toas)).value + self._pos_t = ( + model.components[which_astrometry] + .ssb_to_psb_xyz_ICRS(Time(model.get_barycentric_toas(toas), format="mjd")) + .value + ) self.sort_data() @@ -448,7 +456,6 @@ def _get_sunssb(self, toas, model): class Tempo2Pulsar(BasePulsar): def __init__(self, t2pulsar, sort=True, drop_t2pulsar=True, planets=True): - self._sort = sort self.t2pulsar = t2pulsar self.planets = planets @@ -649,13 +656,16 @@ def Pulsar(*args, **kwargs): if (clk is not None) and (bipm_version is None): bipm_version = clk.split("(")[1][:-1] model, toas = get_model_and_toas( - relparfile, reltimfile, ephem=ephem, bipm_version=bipm_version, planets=planets + relparfile, + reltimfile, + ephem=ephem, + bipm_version=bipm_version, + planets=planets, ) os.chdir(cwd) return PintPulsar(toas, model, sort=sort, drop_pintpsr=drop_pintpsr, planets=planets) elif timing_package.lower() == "tempo2": - # hack to set maxobs maxobs = get_maxobs(reltimfile) + 100 t2pulsar = t2.tempopulsar(relparfile, reltimfile, maxobs=maxobs, ephem=ephem, clk=clk)