Data Classifier

Welcome to the documentation for the Data Classifier module, contains the functions for classifying data.

pywifes.data_classifier.classify(data_dir, naxis2_to_process=0, greedy_stds=False, coadd_mode='all', mode_save_fn=None)

Classify FITS files in the specified directory based on the CAMERA keyword in the header. It filters files into blue and red (arms) observations, extracting metadata for each. It returns a dictionary containing metadata for the blue and red observations.

Parameters:
  • data_dir (str) – The directory containing FITS files to classify.

  • naxis2_to_process (int, optional) – The value of the NAXIS2 keyword to filter files by. Defaults to 0 (no filtering).

  • greedy_stds (bool) – Whether to treat OBJECT images near known standard stars as STANDARDs

  • coadd_mode (str) – Whether to group together OBJECT frames for the same target. Options: ‘all’ (default), ‘none’, ‘prompt’ (user-selected).

  • mode_save_fn (str) – Filename for saving grouping of images to coadd if coadd_mode = ‘prompt’.

Returns:

A dictionary containing metadata for the blue and red observations.

Return type:

dict

pywifes.data_classifier.cube_matcher(paths_list)
pywifes.data_classifier.get_obs_metadata(filenames, data_dir, greedy_stds=False, coadd_mode='all', mode_save_fn=None, camera='blue')

Retrieve metadata for observed data files.

This function categorizes observed data files based on their image type (‘BIAS’, ‘DARK’, ‘FLAT’, ‘SKYFLAT’, ‘ARC’, ‘WIRE’, ‘STANDARD’, ‘OBJECT’, ‘SKY’) and object name. It groups standard star observations together and separates science observations from standard star observations.

Parameters:
  • filenames (list of str) – List of filenames of observed data files.

  • data_dir (str) – Directory path where the data files are located.

  • greedy_stds (bool) – Whether to treat OBJECT exposures near known standard stars as STANDARDs.

  • coadd_mode (str) – Whether to group together OBJECT frames for the same target. Options: ‘all’ (default), ‘none’, ‘prompt’ (user-selected).

  • mode_save_fn (str) – Filename for saving grouping of images to coadd if coadd_mode = ‘prompt’.

  • camera (str) – Which camera, for parsing of coadd association dictionary. Allowed values: “blue”, “red”.

Returns:

Dictionary containing metadata for observed data files. The dictionary has the following keys:

  • ’bias’: List of filenames of bias frames.

  • ’dark’: List of filenames of dark frames.

  • ’domeflat’: List of filenames of domeflat frames.

  • ’twiflat’: List of filenames of twilight flat frames.

  • ’arc’: List of filenames of arc frames.

  • ’wire’: List of filenames of wire frames.

  • ’sci’: List of dictionaries, each containing information about science observations. Each dictionary has the following keys:
    • ’sci’: List of filenames of science observations.

    • ’sky’: List of filenames of sky observations.

  • ’std’: List of dictionaries, each containing information about standard star observations. Each dictionary has the following keys:
    • ’sci’: List of filenames of standard star observations.

    • ’name’: Name of the standard star.

    • ’type’: List of strings indicating the type of observation (‘flux’,’telluric’).

Return type:

dict