hispecdrp.primitives.barycenter_correction.barycenter_corr

Functions

_resolve_location(observatory)

berv_m_s_to_ccf_zb(berv_m_s)

Convert BARYCORR BERV (m/s) to the CCF barycentric factor \(z_b\).

calc_barycenter_corrections(mjd_utc, ...[, ...])

Calculate the barycenter corrections for the input data using barycorrpy.

calc_solar_barycenter_corrections(mjd_utc[, ...])

Calculate the solar system barycenter corrections for the input data using barycorrpy.

get_barycorrpy_star_data(input_model)

Extract the necessary stellar data from the input model for barycorrpy calculations.

read_berv_m_s_from_model(input_model, fiber)

Return BERV (m/s) from BARYCORR_FIB#, or None when unavailable.

read_berv_m_s_uniform_from_model(input_model)

Return exposure BERV (m/s) from the first populated BARYCORR_FIB# table.

resolve_ccf_zb(input_model, *[, ccf_zb])

Resolve the exposure CCF barycentric factor from BARYCORR.

Classes

BarycorrpyStarData(ra, dec[, epoch, pm_ra, ...])

class BarycorrpyStarData(ra: float, dec: float, epoch: float = 2000.0, pm_ra: float = 0.0, pm_dec: float = 0.0, px: float = 0.0, rvsys: float = 0.0)[source]

Bases: object

epoch = 2000.0
pm_dec = 0.0
pm_ra = 0.0
px = 0.0
rvsys = 0.0
_convert_epoch_gaia(ra, dec, epoch=2000.0, pmra=0.0, pmdec=0.0, px=0.0, rvsys=0.0, to_gaia=True, release='DR3')[source]

Convert epoch to Gaia epoch.

Parameters:
  • ra (float) – Right ascension in degrees.

  • dec (float) – Declination in degrees.

  • epoch (float) – Epoch of the input coordinates (e.g., 2000.0).

  • pmra (float, optional) – Proper motion in RA (mas/yr).

  • pmdec (float, optional) – Proper motion in Dec (mas/yr).

  • px (float, optional) – Parallax (mas).

  • rvsys (float, optional) – Systemic Radial velocity (km/s).

  • to_gaia (bool, optional) – If True, convert to Gaia epoch; otherwise, convert from Gaia to the specified epoch.

  • release (str, optional) – The Gaia data release to use (default “DR3”).

Returns:

tuple[float, float] – Converted right ascension and declination.

_resolve_location(observatory)[source]
berv_m_s_to_ccf_zb(berv_m_s)[source]

Convert BARYCORR BERV (m/s) to the CCF barycentric factor \(z_b\).

Matches doppler_shift_from_barycenter() where zb1 = 1 + z_b and trial velocity enters as v / c.

calc_barycenter_corrections(mjd_utc, star_data, observatory, zmeas=0.0)[source]

Calculate the barycenter corrections for the input data using barycorrpy.

Parameters:
  • mjd_utc (float | Sequence[float]) – Modified Julian Date in UTC.

  • star_data (BarycorrpyStarData) – Stellar data required for barycenter correction calculation.

  • observatory (str | EarthLocation) – Observatory name or EarthLocation object for the observation.

  • zmeas (float, optional) – Measured redshift of the target, relevant for relativistic corrections. Default is 0.

Returns:
  • mbjd (float) – Modified Barycentric Julian Date.

  • vel_bc (float) – Barycentric Earth Radial Velocity correction in m/s (barycorrpy convention).

calc_solar_barycenter_corrections(mjd_utc, observatory=None)[source]

Calculate the solar system barycenter corrections for the input data using barycorrpy.

Parameters:

mjd_utc (float) – Modified Julian Date in UTC.

Returns:
  • mbjd (float) – Modified Barycentric Julian Date.

  • vel_bc (float) – Barycentric Earth Radial Velocity correction in m/s (barycorrpy convention).

get_barycorrpy_star_data(input_model)[source]

Extract the necessary stellar data from the input model for barycorrpy calculations.

Parameters:

input_model (datamodels.L2Model) – The input data model containing the necessary metadata.

Returns:

BarycorrpyStarData – A dataclass containing the extracted stellar data.

read_berv_m_s_from_model(input_model, fiber)[source]

Return BERV (m/s) from BARYCORR_FIB#, or None when unavailable.

read_berv_m_s_uniform_from_model(input_model)[source]

Return exposure BERV (m/s) from the first populated BARYCORR_FIB# table.

HISPEC barycentric corrections are not resolved per fiber at the precision relevant for CCF; one value applies to all fibers on the exposure.

resolve_ccf_zb(input_model, *, ccf_zb=0.0)[source]

Resolve the exposure CCF barycentric factor from BARYCORR.

When any BARYCORR_FIB# table is populated, BERV (m/s) is converted to dimensionless \(z_b\) and applied uniformly to all fibers. Otherwise returns ccf_zb.