Parse Jorbit Ephem#
The helper functions for the mpchecker.
- jorbit.mpchecker.parse_jorbit_ephem.apparent_mag(h, g, target_position, observer_position)[source]#
Calculate the apparent magnitude of an asteroid at a certain position from a certain observer.
Implements the same formula as JPL Horizons,
\[\text{Ap. mag} = H + 5*\log_{10}(\Delta) + 5*\log_{10}(r) -2.5*\log_{10}((1-G)*\phi_1 + G*\phi_2)\]where \(\Delta\) is the distance from the observer to the target, \(r\) is the distance from the target to the Sun, and \(\phi_1\) and \(\phi_2\) are phase functions that depend on the phase angle \(\alpha\).
Note a minor inconsistency here: the coordinates are defined in barycentric coordinates, but here we assume they’re heliocentric just to avoid having to query the position of the sun. Shouldn’t matter much.
- Parameters:
h (
float) – The absolute magnitude of the asteroid.g (
float) – The slope parameter of the asteroid.target_position (
Array) – The position of the target in barycentric coordinates.observer_position (
Array) – The position of the observer in barycentric coordinates.
- Returns:
The apparent magnitude of the asteroid.
- Return type:
float
- jorbit.mpchecker.parse_jorbit_ephem.eval_cheby(coefficients, x)[source]#
Evaluate the pair of Chebyshev polynomials describing RA, Dec at a given point.
Similar to eval_cheby in the EphemerisProcessor class, but instead of evaluating three polynomials to give a cartesian position (and their derivatives to get velocity), this evaluates two polynomials to reconstruct the geocentric RA and Dec.
- Parameters:
coefficients (
Array) – The Chebyshev coefficients.x (
Array) – The point at which to evaluate the polynomials.
- Returns:
The RA and Dec at the given point.
- Return type:
tuple[Array,Array]
- jorbit.mpchecker.parse_jorbit_ephem.extra_precision_calcs(asteroid_flags, times, radius, observer, coordinate, relevant_mpcorb, gravity='newtonian solar system', observer_positions=None, de_ephemeris_version='440')[source]#
Helper function for running N-body ephemeris calculations.
- Parameters:
asteroid_flags (
Array) – A boolean array indicating which asteroids to include.times (
Time) – The times of the observation.radius (
Quantity) – The radius of the field of view. Must be a unit of angle.observer (
str) – The observer to use. Must be a valid Horizons observer code.coordinate (
SkyCoord) – The coordinate of the target.relevant_mpcorb (
DataFrame) – The mpcorb file used to generate the latest jorbit ephemeris, trimmed to only include the relevant asteroids.gravity (
str) – The gravity model to use. Must be a valid gravity argument for System. Default is “newtonian solar system”.observer_positions (
Array|None) – The observer positions. If None, they will be retrieved from Horizons.de_ephemeris_version (
str|None) – Which version of the JPL DE ephemeris to use when calculating observer positions. Accepts either “440” or “430”, default is “440”.
- Returns:
The ephemeris, separations, coordinate table, magnitudes, magnitude table, and total magnitudes.
- Return type:
tuple
- jorbit.mpchecker.parse_jorbit_ephem.get_chunk_index(time, t0=np.float64(2458849.5008007395), tf=np.float64(2466154.50080074), chunk_size=30)[source]#
Get the index of given piecewise chunk of Chebyshev coefficients and the offset within that chunk.
- Parameters:
time (
Time) – The time in question.t0 (
float) – The start time of the ephemeris, in JD TDB.tf (
float) – The end time of the ephemeris, in JD TDB.chunk_size (
int) – The size of each chunk, in days.
- Returns:
The index of the chunk and the offset within that chunk.
- Return type:
tuple[Array,Array]
- jorbit.mpchecker.parse_jorbit_ephem.get_relevant_mpcorb(asteroid_flags)[source]#
Filter an MPCORB file to only include relevant asteroids.
Given a boolean array corresponding to the asteroid in the Jorbit ephemeris, filter the MPCORB file to only include those asteroids. Note that not all asteroids in the MPCORB file are in the Jorbit ephemeris since not all had Horizons data available.
- Parameters:
asteroid_flags (
Array) – A boolean array indicating which asteroids to include.- Returns:
The filtered MPCORB file.
- Return type:
DataFrame
- jorbit.mpchecker.parse_jorbit_ephem.individual_state(coefficients, offset, t0, chunk_size)[source]#
Get the state of a single particle at a given time.
- Parameters:
coefficients (
Array) – The Chebyshev coefficients.offset (
float) – The offset within the chunk.t0 (
float) – The start time of the ephemeris, in JD TDB.chunk_size (
int) – The size of each chunk, in days.
- Returns:
The RA and Dec at the given time.
- Return type:
tuple[Array,Array]
- jorbit.mpchecker.parse_jorbit_ephem.load_mpcorb()[source]#
Load the mpcorb file used to generate the latest Jorbit ephemeris.
- Returns:
The mpcorb file.
- Return type:
DataFrame
- jorbit.mpchecker.parse_jorbit_ephem.multiple_states(coefficients, offset, t0, chunk_size)[source]#
Get the state of multiple particles at a given time.
Just a vmapping of individual_state.
- Parameters:
coefficients (
Array) – The Chebyshev coefficients, (nparticles, N_coeffs, 2)offset (
float) – The offset within the chunk.t0 (
float) – The start time of the ephemeris, in JD TDB.chunk_size (
int) – The size of each chunk, in days.
- Returns:
The RAs and Decs of each particle at the given time.
- Return type:
tuple[Array,Array]
- jorbit.mpchecker.parse_jorbit_ephem.nearest_asteroid_helper(coordinate, times, observer=None, de_ephemeris_version='440')[source]#
Pre-compute and load material for the nearest_asteroid function.
- Parameters:
coordinate (
SkyCoord) – The coordinate of the target.times (
Time) – The times of the observation.observer (
str|None) – The observatory observing the target. Optional, defaults to None.de_ephemeris_version (
str|None) – Which version of the JPL DE ephemeris to use when calculating observer positions. Accepts either “440” or “430”, default is “440”.
- Returns:
The coordinate, radius, start time, end time, chunk size, and names, then a merged array of all the relevant Chebyshev coefficients, then the observer positions.
- Return type:
tuple
- jorbit.mpchecker.parse_jorbit_ephem.setup_checks(coordinate, time, radius)[source]#
Check that inputs are valid for the ephemeris, convert to standard forms.
- Parameters:
coordinate (
SkyCoord) – The coordinate of the target.time (
Time) – The time of the observation.radius (
Quantity) – The radius of the field of view. Must be a unit of angle.
- Returns:
The coordinate, radius, start time, end time, chunk size, and names.
- Return type:
tuple