layup.predict

Attributes

logger

AU_M

AU_KM

SPEED_OF_LIGHT

REQUIRED_INPUT_COLUMN_NAMES

Functions

layup_get_residual_vectors(v1)

Decomposes n vectors into two unit vectors to facilitate computation of on-sky angles

layup_calculate_rates_and_geometry(pointing, ...)

Calculate rates and geometry for objects within the field of view, with vectorisation capabilities

_get_on_sky_data(predictions, orbits_df, obs_pos_vel, ...)

Calculates the on-sky rates and geometry for a set of orbits at certain pointings.

_get_result_dtypes(primary_id_column_name)

Helper function to create the result dtype with the correct primary ID column name.

_convert_to_sg(data)

This function appends two columns of the RA and Dec in sexagesimal to the input array.

_predict(data, obs_pos_vel, times, cache_dir, ...)

This function is called by the parallelization function to call the C++ code.

predict(data, obscode, times[, ...])

The function to all that predict functionality interactively, i.e from a notebook or a script.

predict_cli(cli_args, input_file, start_date, ...)

The function for calling predict through the command line interface.

Module Contents

logger[source]
AU_M = 149597870700[source]
AU_KM = 149597870.7[source]
SPEED_OF_LIGHT = 173.1446326742403[source]
REQUIRED_INPUT_COLUMN_NAMES = ['epochMJD_TDB', 'FORMAT'][source]
layup_get_residual_vectors(v1)[source]

Decomposes n vectors into two unit vectors to facilitate computation of on-sky angles The decomposition is such that A = (-sin (RA), cos(RA), 0) is in the direction of increasing RA, and D = (-sin(dec)cos (RA), -sin(dec) sin(RA), cos(dec)) is in the direction of increasing Dec The triplet (A,D,v1) forms an orthonormal basis of the 3D vector space. Has vectorisation capabilities.

Parameters:

v1 (array, shape = (3, n))) – The vectors to be decomposed

Returns:

  • A (array, shape = (3, n))) – A vectors

  • D (array, shape = (3, n))) – D vectors

layup_calculate_rates_and_geometry(pointing: pandas.DataFrame, ephem_geom_params: sorcha.ephemeris.simulation_driver.EphemerisGeometryParameters)[source]

Calculate rates and geometry for objects within the field of view, with vectorisation capabilities

Parameters:
  • pointing (pandas dataframe) – The dataframe containing the pointing database.

  • ephem_geom_params (EphemerisGeometryParameters) – Various parameters necessary to calculate the ephemeris

Returns:

Tuple containing the ephemeris parameters needed for Sorcha post processing.

Return type:

tuple

_get_on_sky_data(predictions, orbits_df, obs_pos_vel, primary_id_column_name, args, configs)[source]

Calculates the on-sky rates and geometry for a set of orbits at certain pointings.

Parameters:
  • predictions (numpy recarray) – Numpy recarray containing the pre-calculated predictions of the objects.

  • orbits_df (pandas dataframe) – The dataframe containing the orbits being predicted.

  • obs_pos_vel (numpy recarray) – Numpy recarray containing the position and velocity of the observatory at the times requested for predictions.

  • primary_id_column_name (str) – The name of the primary ID column.

  • args (argparse) – The argparse object that was created when running from the CLI.

  • aux (AuxiliaryConfigs object) – The LayUp auxiliary arguments.

Returns:

  • rates (numpy recarray) – Numpy recarray containing the on-sky rates.

  • ”””

_get_result_dtypes(primary_id_column_name: str)[source]

Helper function to create the result dtype with the correct primary ID column name.

_convert_to_sg(data)[source]

This function appends two columns of the RA and Dec in sexagesimal to the input array.

Parameters:

data (numpy structured array) – The data to be processed.

Return type:

input array with ra and dec in sexagesimal appended, called ra_str_hms and dec_str_dms respectively.

_predict(data, obs_pos_vel, times, cache_dir, primary_id_column_name)[source]

This function is called by the parallelization function to call the C++ code.

Parameters:
  • data (nump structured array) – The data to be processed.

  • obs_pos_vel (numpy structured array) – The observer position and velocity.

  • times (list) – The times for the predictions, in jd_tdb.

  • cache_dir (str) – The directory to the cached kernels.

  • primary_id_column_name (str) – The name of the primary ID column.

Return type:

numpy structured array with the flattened results

predict(data, obscode, times, primary_id_column_name='provID', num_workers=-1, cache_dir=None, args=None, configs=None)[source]

The function to all that predict functionality interactively, i.e from a notebook or a script.

Parameters:
  • data (numpy structured array) – The data to be processed.

  • obscode (str) – The observer code.

  • times (list) – The times for the predictions, in jd_tdb.

  • primary_id_column_name (str) – The name of the primary ID column.

  • num_workers (int) – The number of workers to use for parallelization. If -1, use all available cores.

  • cache_dir (str or None) – The directory to the cached kernels. If None, use the default cache directory.

  • args (argparse) – The argparse object that was created when running from the CLI.

  • aux (AuxiliaryConfigs object) – The LayUp auxiliary arguments. Needed if on-sky rates are requested.

Return type:

numpy structured array with the flattened results

predict_cli(cli_args: argparse.Namespace, input_file: str, start_date: float, end_date: float, timestep_day: float, output_file: str, cache_dir: pathlib.Path, configs: None)[source]

The function for calling predict through the command line interface.

Parameters:
  • cli_args (Namespace) – The command line arguments.

  • input_file (str) – The input file to read the data from.

  • start_date (float) – The start date for the predictions, in jd_tdb.

  • end_date (float) – The end date for the predictions, in jd_tdb.

  • timestep_day (float) – The time step for the predictions, in days.

  • output_file (str) – The output file to write the predictions to.

  • cache_dir (Path) – The directory to the cached kernels.

  • aux (AuxiliaryConfigs object) – The LayUp auxiliary arguments