opticam.utils.data_checks

Functions

scan_data(out_directory, data_directory, instrument[, ...])

Check that the data are self-consistent.

parse_header_results(results, files, out_directory, logger)

Parse the header info results.

get_binning_scale(binning)

Given a binning mode string, extract the x and y binning scales as integers.

Module Contents

opticam.utils.data_checks.scan_data(out_directory, data_directory, instrument, barycenter=True, verbose=True, return_output=False, logger=None, number_of_processors=cpu_count() // 2)

Check that the data are self-consistent.

Parameters

out_directoryPath | str

The path to the directory in which output files will be saved.

data_directoryPath | str

The path to the directory containing the data.

instrumentInstrument

The instrument that produced the data.

barycenterbool, optional

Whether to apply a Barycentric correction to the image time stamps, by default True. Only relevant if return_output=True.

verbosebool, optional

Whether to print any output info, by default True.

return_outputbool, optional

Whether to return any output, by default False.

loggerLogger | None, optional

The logger, by default None.

number_of_processors_type_, optional

The number of processors to use, by default cpu_count() // 2.

Returns

None | tuple[dict[str, list[MEFSlice]], int, dict[str, float], list[MEFSlice], float]:

If return_output=True, the files grouped by camera, binning scale, Barycentric MJD dates, ignored files, and the reference date are returned. Otherwise, nothing is returned.

Parameters:
  • out_directory (pathlib.Path | str)

  • data_directory (pathlib.Path | str)

  • instrument (opticam.instruments.Instrument)

  • barycenter (bool)

  • verbose (bool)

  • return_output (bool)

  • logger (logging.Logger | None)

Return type:

None | tuple[dict[str, list[opticam.mef_slice.MEFSlice]], int, dict[str, float], list[opticam.mef_slice.MEFSlice], float]

opticam.utils.data_checks.parse_header_results(results, files, out_directory, logger)

Parse the header info results.

Parameters

resultstuple[list[float], list[float], list[str], list[str], list[float]]

The header info results.

fileslist[MEFSlice]

The list of MEFSlice instances representing each image.

out_directorystr

The directory path to which any output files will be saved.

loggerLogger | None

The logger.

Returns

tuple[str, dict[str, float], dict[str, str], dict[str, str], list[MEFSlice]]

The binning scale, BMJD dates, cameras, filters, and ignored files.

Raises

ValueError

If more than three filters are detected.

ValueError

If more than one binning mode is detected.

Parameters:
  • results (tuple[list[float], list[float], list[str], list[str], list[float]])

  • files (list[opticam.mef_slice.MEFSlice])

  • out_directory (pathlib.Path)

  • logger (logging.Logger | None)

Return type:

tuple[str, dict[str, float], dict[str, str], dict[str, str], list[opticam.mef_slice.MEFSlice]]

opticam.utils.data_checks.get_binning_scale(binning)

Given a binning mode string, extract the x and y binning scales as integers.

Parameters

binningstr

The binning mode string (e.g., “2x2”, “1 2”, etc.). The first number is assumed to be the binning scale in x, while the second number is assumed to be the binning scale in y.

Returns

int

The binning scale.

Parameters:

binning (str)

Return type:

int