corgidrp.sorting#
Functions#
|
Convert an ISO 8601 timestamp string to a numerical time stamp. |
|
For a given EM gain, this function groups frames consecutive in time stamp into |
|
Sorting algorithm that given a dataset will output a dataset with the |
Module Contents#
- corgidrp.sorting.extract_datetime(datetime_str)[source]#
Convert an ISO 8601 timestamp string to a numerical time stamp.
Accepts strings with or without sub-second precision (e.g. ‘YYYY-MM-DDTHH:MM:SS’ or ‘YYYY-MM-DDTHH:MM:SS.ssssss’).
- Parameters:
datetime_str (str) – ISO 8601 time string
- Returns:
time stamp in seconds since the epoch (1970-01-01T00:00:00Z)
- Return type:
float
- corgidrp.sorting.sort_remove_frames(dataset_in_list, cal_type, actual_visit=True)[source]#
For a given EM gain, this function groups frames consecutive in time stamp into groups with the same exposure time. Then it finds the two sets with the same exposure time that are the most separated in time. It then examines any other sets with repeated exposure times, keeps the set of those with the most frames, and discards the rest.
- Parameters:
dataset_in_list (list of corgidrp.Dataset) – list of datasets with all the frames to be sorted.
cal_type (string) – the calibration type. Case insensitive. Accepted values are: ‘k-gain’ or ‘kgain’ for K-gain calibration ‘non-lin(earity)’, ‘nonlin(earity)’ for non-linearity calibration, where the letters within parenthesis are optional.
actual_visit (bool) – if True, the dataset is expected to be a dataset from an actual visit (frames taken in the specific order for the visit), as opposed to a generic collection of files from which we might extract files that satisfy the requirements of the calibration script. Default is True.
- Returns:
- list of indices of frames to be left out of the final
dataset.
- del_rep_inds_tot (list): list of indices of repeated exposure time sets to be
left out of the final dataset.
exptime_cons (list): list of exposure times for the sets, including the ones to be excluded. count_cons (list): list of number of frames for each exposure time set, including the ones to be excluded. filepath_list (list): list of file paths for the frames, including the ones to be excluded.
- Return type:
inds_leave_out (list)
- corgidrp.sorting.sort_pupilimg_frames(dataset_in, cal_type='', actual_visit=True)[source]#
Sorting algorithm that given a dataset will output a dataset with the frames used to generate a mean frame and the frames used to calibrate the calibration type: k-gain. non-linearity.
The output dataset has an added keyword value in its extended header: OBSNAME with values ‘MNFRAME’ (for mean frame), ‘KGAIN’ (for K-gain), and ‘NONLIN’ (for non-linearity).
- Parameters:
dataset_in (corgidrp.Dataset) – dataset with all the frames to be sorted. By default, it is expected to contain all the frames from the PUPILIMG visit files associated with a calibration campaign. Function works if data in Datset is None (useful for large RAM-heavy Dataset), and data is loaded in at the end.
cal_type (string) – the calibration type. Case insensitive. Accepted values are: ‘k-gain’ or ‘kgain’ for K-gain calibration ‘non-lin(earity)’, ‘nonlin(earity)’ for non-linearity calibration, where the letters within parenthesis are optional.
actual_visit (bool) – if True, the dataset is expected to be a dataset from an actual visit (frames taken in the specific order for the visit), as opposed to a generic collection of files from which we might extract files that satisfy the requirements of the calibration script. Default is True.
- Returns:
Dataset with the frames used to generate a mean frame and the frames used to calibrate the calibration type: k-gain or non-linearity.