-
craftutils.observation.epoch.SkyCoord.radial_velocity_correction(kind=
'barycentric', obstime=None, location=None) Compute the correction required to convert a radial velocity at a given time and place on the Earth’s Surface to a barycentric or heliocentric velocity.
Parameters¶
- kindstr
The kind of velocity correction. Must be ‘barycentric’ or ‘heliocentric’.
- obstime~astropy.time.Time or None, optional
The time at which to compute the correction. If None, the
obstimeframe attribute on the |SkyCoord| will be used.- location~astropy.coordinates.EarthLocation or None, optional
The observer location at which to compute the correction. If None, the
locationframe attribute on the passed-inobstimewill be used, and if that is None, thelocationframe attribute on the |SkyCoord| will be used.
Raises¶
- ValueError
If either
obstimeorlocationare passed in (notNone) when the frame attribute is already set on this |SkyCoord|.- TypeError
If
obstimeorlocationaren’t provided, either as arguments or as frame attributes.
Returns¶
- vcorr~astropy.units.Quantity [‘speed’]
The correction with a positive sign. I.e., add this to an observed radial velocity to get the barycentric (or heliocentric) velocity. If m/s precision or better is needed, see the notes below.
Notes¶
The barycentric correction is calculated to higher precision than the heliocentric correction and includes additional physics (e.g time dilation). Use barycentric corrections if m/s precision is required.
The algorithm here is sufficient to perform corrections at the mm/s level, but care is needed in application. The barycentric correction returned uses the optical approximation v = z * c. Strictly speaking, the barycentric correction is multiplicative and should be applied as:
>>> from astropy.time import Time >>> from astropy.coordinates import SkyCoord, EarthLocation >>> from astropy.constants import c >>> t = Time(56370.5, format='mjd', scale='utc') >>> loc = EarthLocation('149d33m00.5s','-30d18m46.385s',236.87*u.m) >>> sc = SkyCoord(1*u.deg, 2*u.deg) >>> vcorr = sc.radial_velocity_correction(kind='barycentric', obstime=t, location=loc) >>> rv = rv + vcorr + rv * vcorr / cAlso note that this method returns the correction velocity in the so-called optical convention:
>>> vcorr = zb * cwhere
zbis the barycentric correction redshift as defined in section 3 of Wright & Eastman (2014). The application formula given above follows from their equation (11) under assumption that the radial velocityrvhas also been defined using the same optical convention. Note, this can be regarded as a matter of velocity definition and does not by itself imply any loss of accuracy, provided sufficient care has been taken during interpretation of the results. If you need the barycentric correction expressed as the full relativistic velocity (e.g., to provide it as the input to another software which performs the application), the following recipe can be used:>>> zb = vcorr / c >>> zb_plus_one_squared = (zb + 1) ** 2 >>> vcorr_rel = c * (zb_plus_one_squared - 1) / (zb_plus_one_squared + 1)or alternatively using just equivalencies:
>>> vcorr_rel = vcorr.to(u.Hz, u.doppler_optical(1*u.Hz)).to(vcorr.unit, u.doppler_relativistic(1*u.Hz))See also ~astropy.units.equivalencies.doppler_optical, ~astropy.units.equivalencies.doppler_radio, and ~astropy.units.equivalencies.doppler_relativistic for more information on the velocity conventions.
The default is for this method to use the builtin ephemeris for computing the sun and earth location. Other ephemerides can be chosen by setting the ~astropy.coordinates.solar_system_ephemeris variable, either directly or via
withstatement. For example, to use the JPL ephemeris, do:>>> from astropy.coordinates import solar_system_ephemeris >>> sc = SkyCoord(1*u.deg, 2*u.deg) >>> with solar_system_ephemeris.set('jpl'): ... rv += sc.radial_velocity_correction(obstime=t, location=loc)