Skip to content

Commit

Permalink
sun_angle
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisrkckl committed Sep 25, 2023
1 parent 02af780 commit b506825
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/pint/models/astrometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,17 @@ def sun_angle(self, toas, heliocenter=True, also_distance=False):
"""
tbl = toas.table

if heliocenter:
osv = tbl["obs_sun_pos"].quantity.copy()
else:
osv = -tbl["ssb_obs_pos"].quantity.copy()
osv = (
tbl["obs_sun_pos"].quantity if heliocenter else -tbl["ssb_obs_pos"].quantity
)

psr_vec = self.ssb_to_psb_xyz_ICRS(epoch=tbl["tdbld"])
r = (osv**2).sum(axis=1) ** 0.5
osv /= r[:, None]
cos = (osv * psr_vec).sum(axis=1)
return (np.arccos(cos), r) if also_distance else np.arccos(cos)

osvn = osv / r[:, None]

cos_sa = (osvn * psr_vec).sum(axis=1)
return (np.arccos(cos_sa), r) if also_distance else np.arccos(cos_sa)

def barycentric_radio_freq(self, toas):
raise NotImplementedError
Expand Down

0 comments on commit b506825

Please sign in to comment.