astra.utils.time#
Julian Day conversions and astronomical time-frame calculations.
Functions
|
Calculate light travel times to heliocentric and barycentric frames. |
|
Interpolate multiple pandas DataFrames onto a common index. |
|
Convert time to various astronomical reference frames. |
|
Convert datetime object to Julian Day using standard algorithm. |
- astra.utils.time.interpolate_dfs(index: ndarray, *data: DataFrame) DataFrame[source]#
Interpolate multiple pandas DataFrames onto a common index.
Merges and interpolates multiple DataFrames using a specified index array, commonly used for wavelength-dependent data processing in spectroscopy.
- Parameters:
index (np.ndarray) – 1D array to interpolate data onto (e.g., wavelength grid).
*data (pd.DataFrame) – Variable number of DataFrames to interpolate.
- Returns:
pd.DataFrame – Combined DataFrame with all data interpolated onto the common index.
- astra.utils.time.to_jd(dt: datetime, fmt: str = 'jd') float[source]#
Convert datetime object to Julian Day using standard algorithm.
Converts Python datetime to Julian Day format using the algorithm from Wikipedia. Supports conversion to various Julian Day formats.
- Parameters:
dt (datetime) – Datetime object to convert.
fmt (str) – Output format (‘jd’, ‘mjd’, ‘rjd’). Defaults to ‘jd’.
- Returns:
float – Julian Day value in specified format.
- astra.utils.time.getLightTravelTimes(target: SkyCoord, time_to_correct: Time) Tuple[Time, Time][source]#
Calculate light travel times to heliocentric and barycentric frames.
Computes corrections for light travel time from Earth to the solar system barycenter and heliocenter, essential for precise timing in astronomy.
- Parameters:
target (SkyCoord) – Target celestial coordinates.
time_to_correct (Time) – Observation time requiring correction. Must be initialized with an EarthLocation.
- Returns:
Tuple[Time, Time] – Light travel times as (barycentric, heliocentric).
- astra.utils.time.time_conversion(jd: float, location: Any, target: SkyCoord) Tuple[float, float, float, str][source]#
Convert time to various astronomical reference frames.
Transforms Julian Day to heliocentric and barycentric systems, calculates local sidereal time and hour angle for astronomical observations.
- Parameters:
jd (float) – Julian Day to convert.
location (EarthLocation) – Observer’s geographic location.
target (SkyCoord) – Target celestial coordinates.
- Returns:
Tuple[float, float, float, str] –
- Converted times as
(hjd, bjd, lst_seconds, hour_angle_string).