File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ from astropy .time import Time
2+ from astropy .coordinates import SkyCoord , EarthLocation
3+ import astropy .units as u
4+
5+ import sys
6+
7+
8+ def jd2hjd (jd : float , ra : float , dec : float ) -> float :
9+ # 1. Define input time, location (, and target
10+ jd_time = Time (jd , format = 'jd' , scale = 'utc' )
11+ # Klemzig (how much difference does location make for our purposes?)
12+ location = EarthLocation (lat = 34.88 * u .deg , lon = 138.64 * u .deg , height = 60 * u .m )
13+ target = SkyCoord (ra = ra * u .deg , dec = dec * u .deg )
14+
15+ # 2. Calculate light travel time to heliocenter (or barycenter)
16+ ltt_hjd = jd_time .light_travel_time (target , 'heliocentric' , location = location )
17+
18+ # 3. Apply correction
19+ hjd_time = jd_time + ltt_hjd
20+
21+ return hjd_time
22+
23+
24+ if __name__ == "__main__" :
25+ if len (sys .argv ) == 4 :
26+ jd = float (sys .argv [1 ])
27+ ra = float (sys .argv [2 ])
28+ dec = float (sys .argv [3 ])
29+ hjd = jd2hjd (jd , ra , dec )
30+ print (f"{ jd } => { hjd } " )
You can’t perform that action at this time.
0 commit comments