Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Availability of planet-SSB and planet-obs vectors for ephemeris modeling #903

Closed
Hazboun6 opened this issue Dec 17, 2020 · 3 comments · Fixed by #944
Closed

Availability of planet-SSB and planet-obs vectors for ephemeris modeling #903

Hazboun6 opened this issue Dec 17, 2020 · 3 comments · Fixed by #944

Comments

@Hazboun6
Copy link
Member

In order to use Pint-based pulsars in enterprise along with the BayesEphem ephemeris model we need access to various solar system barycenter position vectors with respect to the Earth and various planets at each of the TOAs. This Issue directly relates to Issue 238 on the enterprise GitHub repo. @paulray has already submitted PR #901 to add the position vectors for Neptune. BayesEphem requires planet-ssb vectors, which can be calculated from the ssb-observatory and obs-planet vectors available in Pint. However we also need the earth-ssb vector for the ephemeris model, which can either be furnished directly or calculated from the obs-earth vector.

@Hazboun6
Copy link
Member Author

There are use cases for other planet-ssb vectors, for instance PR 232 adds in a modeling for perturbations from all planets. The minimal use for getting BayesEphem working for the 15 year data set is now the Earth-obs or Earth-ssb vector.

@luojing1211
Copy link
Member

I think these two functions are what you need.

def objPosVel_wrt_SSB(objname, t, ephem, path=None, link=None):
"""This function computes a solar system object position and velocity respect
to solar system barycenter using astropy coordinates get_body_barycentric()
method.
The coordinate frame is that of the underlying solar system ephemeris, which
has been the ICRF (J2000) since the DE4XX series.
Parameters
----------
objname: str
Solar system object name. Current support solar system bodies are listed in
astropy.coordinates.solar_system_ephemeris.bodies attribution.
t: Astropy.time.Time object
Observation time in Astropy.time.Time object format.
ephem: str
The ephem to for computing solar system object position and velocity
path : str, optional
Local path to the ephemeris file.
link : str, optional
Location of path on the internet.
Returns
-------
PosVel object with 3-vectors for the position and velocity of the object
"""
objname = objname.lower()
load_kernel(ephem, path=path, link=link)
pos, vel = coor.get_body_barycentric_posvel(objname, t)
return PosVel(pos.xyz, vel.xyz.to(u.km / u.second), origin="ssb", obj=objname)
def objPosVel(obj1, obj2, t, ephem, path=None, link=None):
"""Compute the position and velocity for solar system obj2 referenced at obj1.
This function uses astropy solar system Ephemerides module.
Parameters
----------
obj1: str
The name of reference solar system object
obj2: str
The name of target solar system object
tdb: Astropy.time.Time object
TDB time in Astropy.time.Time object format
ephem: str
The ephem to for computing solar system object position and velocity
path : str, optional
Local path to the ephemeris file.
link : str, optional
Location of path on the internet.
Return
------
PosVel object.
solar system obj1's position and velocity with respect to obj2 in the
J2000 cartesian coordinate.
"""
if obj1.lower() == "ssb" and obj2.lower() != "ssb":
obj2pv = objPosVel_wrt_SSB(obj2, t, ephem, path=path, link=link)
return obj2pv
elif obj2.lower() == "ssb" and obj1.lower() != "ssb":
obj1pv = objPosVel_wrt_SSB(obj1, t, ephem, path=path, link=link)
return -obj1pv
elif obj2.lower() != "ssb" and obj1.lower() != "ssb":
obj1pv = objPosVel_wrt_SSB(obj1, t, ephem, path=path, link=link)
obj2pv = objPosVel_wrt_SSB(obj2, t, ephem, path=path, link=link)
return obj2pv - obj1pv
else:
# user asked for velocity between ssb and ssb
return PosVel(
np.zeros((3, len(t))) * u.km, np.zeros((3, len(t))) * u.km / u.second
)

@aarchiba
Copy link
Contributor

I think the request is that TOAs objects have, or be able to have, pre-computed vectors. This is close enough to true for all the non-Earth planets - there is the observatory-planet vector and the SSB-observatory vector - but there isn't a precomputed column that says anything about the geocenter.

aarchiba added a commit to aarchiba/PINT that referenced this issue Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants