layup.orbitfit
Attributes
Functions
|
Helper function to create the result dtype with the correct primary ID column name. |
|
Check if a given data point is an occultation measurement. |
|
Use occulting star's astrometry to replace the ra and dec values. |
|
Split an input list into a list of sublists, with break |
|
Find the separation in time between two set of indices |
|
Given an index chunk (target) and the set of all the index |
|
Given a sequence of index chunks and a collection of other index |
|
Given a sequence of index chunks and a collection of other index |
|
Given a set of julian dates, in the order of the observations, |
|
Create an empty return object |
|
Calculate an initial orbit estimate using Gauss's method. |
|
Carry out an orbit fit to the observations in a |
|
This is a place holder function for future IOD implememtations that require |
|
This function will contain all of the calls to the c++ code that will |
|
This is the function that you would call interactively. i.e. from a notebook |
|
This is the function that is called from the command line |
|
Check if the input data contains all valid values. |
|
Module Contents
- _get_result_dtypes(primary_id_column_name: str)[source]
Helper function to create the result dtype with the correct primary ID column name.
- _is_occultation(data)[source]
Check if a given data point is an occultation measurement. An occultation measurement is indicated by the lack of ra and dec values.
- Parameters:
data (numpy structured array) – The object data to check for occultation measurements.
- Returns:
True if the data point is an occultation measurement, False otherwise.
- Return type:
bool
- _use_star_astrometry(data)[source]
Use occulting star’s astrometry to replace the ra and dec values.
Notes
The units are a bit odd here. raStar and decStar are in degrees. However, deltaRA and deltaDec are in arcseconds. Thus will either convert to degrees or radians depending on the context.
For more details see the ADES description here: https://github.com/IAU-ADES/ADES-Master/blob/master/ADES_Description.pdf
- Parameters:
data (numpy structured array) – The object data to replace the ra and dec values.
- Returns:
data – The object data with the ra and dec values replaced by the star’s astrometry.
- Return type:
numpy structured array
- _split_by_index(input_list, indices)[source]
Split an input list into a list of sublists, with break points at the provided indices.
- Parameters:
input_list (a list of, in this case, integers.)
indices (a list of indices at which to split the input list.)
- Return type:
list of lists.
- _time_distance(ic0, ic1, jds)[source]
Find the separation in time between two set of indices (index chunks), given the corresponding set of julian dates.
- Parameters:
ic0 (a list of indices (index chunk 0))
ic1 (a list of indices (index chunk 1))
jds (a collection of julian dates.)
- Returns:
float
- Return type:
the size of the time gap separating the two chunks.
- _nearest_chunk(target, index_chunks, jds, self_match=False)[source]
Given an index chunk (target) and the set of all the index chunks, find the index chunk that is nearest in time, that has the smallest separation in time.
- Parameters:
target (a list of indices (index chunk))
index_chunks (a list of lists of indices)
jds (a collection of julian dates.)
self_match (allow the target to match to itself)
- Returns:
list (the nearest index chunk.)
float (the separation in time between the target and the nearest chunk.)
- _next_nearest(chunk_sequence, index_chunks, jds)[source]
Given a sequence of index chunks and a collection of other index chunks, find the index chunk that is nearest in time to the sequence. This will be the next one to include in the fit.
- Parameters:
chunk_sequence (a list of lists of indices)
index_chunks (a list of lists of indices)
jds (a collection of julian dates.)
self_match (allow the target to match to itself)
- Returns:
list
- Return type:
the nearest index chunk.
- _iterate_sequence(sequence, other_chunks, jds)[source]
Given a sequence of index chunks and a collection of other index chunks, iteratively build the sequence.
- Parameters:
sequence (a list of lists of indices (the start of the sequence))
other_chunks (a list of lists of indices)
jds (a collection of julian dates.)
- Returns:
list of lists
- Return type:
the resulting list of lists of indices
- _build_sequence(jds, sep_dt=90.0)[source]
Given a set of julian dates, in the order of the observations, split the observations into sets of indices that have gaps of at least sep_dt (days) between them. These are index chunks. Then develop a sequence of the index chunks that will be fit in order. The first chunk will have the longest time span. The next will be the closest in time to the first. The next will be the closest in time to the first two, etc.
- Parameters:
jds (a collection of julian dates in order of the observations (sorted).)
sep_dt (float the mininum separation between chunks)
- Returns:
list of lists (the resulting sequence of lists of indices that)
will be fit.
- create_empty_result(id, dtypes)[source]
Create an empty return object
- Parameters:
id (str) – The id of the object to provide an empty result for
dtypes (np.array) – The list of datatypes for the structured array.
- Returns:
Empty numpy structured array
- Return type:
np.array
- do_gauss_iod(observations, seq)[source]
Calculate an initial orbit estimate using Gauss’s method.
- Parameters:
observations (list[Observation]) – The list of Observations used for the orbit estimate
seq (list[list[int]) – The list of lists of indexes of observations that are closely spaced in time.
- Returns:
A collection of orbit fit results that can be used to perform a higher quality fit estimate.
- Return type:
list[FitResult]
- do_fit(observations, seq, cache_dir, iod='gauss')[source]
Carry out an orbit fit to the observations in a series of steps. A list of lists of observation indices specifies the order in which the fit proceeds.
A Gauss preliminary order is fit for the 0-th segment, using the first, middle, and last observations in that segment.
Then an orbit fit is done on the 0-th segment, using the initial orbit from Gauss. If that fails, any other preliminary solutions are tried.
Next, a fit to the full set of observations is attempted, given the fit to the primary segment as an initial guess. If that succeeds, the solution is returned.
Otherwise, adjacent segments of observations are added and the fit is updated, iteratively.
- Parameters:
observations (list) – A time-ordered list of observations
seq (list of lists) – A list of lists of observation indices.
iod (str) – The IOD used to generate an initial guess orbit. Currently supports [‘gauss’]. Default is ‘gauss’.
- Returns:
The result of the orbit fit.
- Return type:
FitResult
- do_other_fit(iod: str)[source]
This is a place holder function for future IOD implememtations that require more significant data manipulation.
- _orbitfit(data, cache_dir: str, primary_id_column_name: str, initial_guess=None, bias_dict: dict = None, sort_array: bool = True, weight_data: bool = False, iod: str = 'gauss')[source]
This function will contain all of the calls to the c++ code that will calculate an orbit given a set of observations. Note that all observations should correspond to the same object.
This is function that is passed to the parallelizer.
- Parameters:
data (numpy structured array) – The object data to derive an orbit for
cache_dir (str) – The directory where the required orbital files are stored
primary_id_column_name (str) – The name of the primary identifier column for the objects.
initial_guess (numpy structured array) – Optional guess data to use for the orbit fit. Default is None.
bias_dict (dict) – A dictionary containing bias corrections for different catalogs.
sort_array (bool) – Whether to sort the observations by obstime before processing. Default is True.
weight_data (bool) – Whether to apply data weighting based on the observation code, date, catalog and program. Default is False.
iod (str) – The IOD used to generate an initial guess orbit. Currently supports [‘gauss’]. Default is ‘gauss’.
- orbitfit(data, cache_dir: str, initial_guess=None, num_workers=1, primary_id_column_name='provID', debias=False, weight_data=False, iod='gauss')[source]
This is the function that you would call interactively. i.e. from a notebook
- Parameters:
data (numpy structured array) – The object data to derive an orbit for
cache_dir (str) – The directory where the required orbital files are stored
initial_guess (numpy structured array) – Optional initial guess data to use for the orbit fit. Default is None.
num_workers (int) – The number of workers to use for parallel processing. Default is 1
primary_id_column_name (str) – The name of the primary identifier column for the objects. Default is “provID”.
debias (bool) – Whether to apply debiasing corrections to the observations. Default is False.
weight_data (bool) – Whether to apply data weighting based on the observation code, date, catalog and program. Default is False.
iod (str) – The IOD used to generate an initial guess orbit. Currently supports [‘gauss’]. Default is ‘gauss’.
- orbitfit_cli(input: str, input_file_format: Literal['MPC80col', 'ADES_csv', 'ADES_psv', 'ADES_xml', 'ADES_hdf5'], output_file_stem: str, output_file_format: Literal['csv', 'hdf5'] = 'csv', chunk_size: int = 10000, num_workers: int = -1, cli_args: argparse.Namespace | None = None)[source]
This is the function that is called from the command line
- Parameters:
input (str) – Path to the input data file.
input_file_format (Literal[MPC80col, ADES_csv, ADES_psv, ADES_xml, ADES_hdf5]) – The format of the input data file.
output_file_stem (str) – The stem of the output file.
output_file_format (Literal[csv, hdf5] optional (default="csv")) – The format of the output file. Must be one of: “csv”, “hdf5”
num_workers (int, optional (default=-1)) – The number of workers to use for parallel processing of the individual chunk. If -1, the number of workers will be set to the number of CPUs on the system. The default is 1 worker.
cli_args (argparse.Namespace, optional (default=None)) – The argparse object that was created when running from the CLI.