from astropy.coordinates import SkyCoord from astropy.time import Time # create an instance of SkyCoord with initial coordinates initial_coords = SkyCoord(ra=15.0, dec=20.0, unit='deg', frame='icrs', obstime='2010-01-01T00:00:00.12345') # create an instance of Time to represent a time after epoch in the past t = Time('2021-01-01T00:00:00.12345', format='isot', scale='utc') # apply space motion to get the current position of the celestial object current_coords = initial_coords.apply_space_motion(obstime=t) print(current_coords.ra, current_coords.dec)
from astropy.coordinates import SkyCoord, ICRS, CartesianDifferential # create an instance of SkyCoord with initial coordinates in the ICRS frame and a cartesian differential initial_coords = SkyCoord(ra=15.0, dec=20.0, unit='deg', frame=ICRS(), pm_ra_cosdec=1.0, pm_dec=2.0, obstime='2010-01-01T00:00:00.12345', radial_velocity=10.0, differential_class=CartesianDifferential) # apply space motion to get the current position of the celestial object current_coords = initial_coords.apply_space_motion() print(current_coords.ra, current_coords.dec, current_coords.radial_velocity)In this example, we create an instance of SkyCoord with initial coordinates in the ICRS frame and a Cartesian differential, specifying the proper motion, radial velocity, and epoch. Then, we apply the space motion with the default current time to get the current coordinates of the celestial object, including the radial velocity. Package library: astropy.coordinates