layup.unpack

Attributes

logger

ORBIT_FIT_COLS

INPUT_READERS

Functions

_get_result_dtypes(primary_id_column_name, state, ...)

Creates a structured numpy dtype for the output data based on the provided parameters.

unpack(res, name, orbit_para, _RESULT_DTYPES, ...)

Unpacks a file containing a covariance matrix into associated uncertainties.

unpack_cli(input, file_format, output_file_stem[, ...])

unpacks an input files covarience into uncertainties

Module Contents

logger[source]
ORBIT_FIT_COLS = [('csq', 'f8'), ('ndof', 'i4'), ('niter', 'i4'), ('method', 'O'), ('flag', 'i4')][source]
INPUT_READERS[source]
_get_result_dtypes(primary_id_column_name: str, state: list, sigma: list, orbit_col_flag)[source]

Creates a structured numpy dtype for the output data based on the provided parameters.

Parameters:
  • primary_id_column_name (str) – The name of the primary ID column (e.g., object identifier).

  • state (list) – A list of parameter names corresponding to the state vector elements (e.g., position or orbital parameters).

  • sigma (list) – A list of parameter names corresponding to the uncertainties (sigma) of the state vector elements.

  • orbit_col_flag (bool) – A flag indicating whether orbit fitting columns (e.g., chi-square, degrees of freedom) should be included.

Returns:

A structured numpy dtype defining the format of the output array.

Return type:

np.dtype

unpack(res, name, orbit_para, _RESULT_DTYPES, orbit_cols_flag, format)[source]

Unpacks a file containing a covariance matrix into associated uncertainties.

Parameters:
  • res (FitResult) – The parsed fit result.

  • name (str) – name of the object

  • orbit_para (list) – A list of parameter names corresponding to the state vector elements

  • _RESULT_DTYPES (np,dtype) – A structured numpy dtype defining the format of the output array.

Returns:

  • output (numpy array) – the numpy array containing the unpacked data.

  • orbit_cols_flag (bool) – flag if input file has orbit fit columns

  • format (str) – orbital format of data

unpack_cli(input, file_format, output_file_stem, chunk_size: int = 10000, cli_args: dict = None)[source]

unpacks an input files covarience into uncertainties

Note that the output file will be written in the caller’s current working directory.

Parameters:
  • input (str) – The path to the input file.

  • output_file_stem (str) – The stem of the output file.

  • file_format (str, optional (default="csv")) – The format of the output file. Must be one of: “csv”, “hdf5”

  • chunk_size (int, optional (default=10_000)) – The number of rows to read in at a time.

  • cli_args (argparse, optional (default=None)) – The argparse object that was created when running from the CLI.