nabu.resources.nxflatfield module¶
- nabu.resources.nxflatfield.get_frame_possible_urls(dataset_info, user_dir, output_dir)[source]¶
Return a dict with the possible location of reduced dark/flat frames.
- Parameters:
dataset_info (DatasetAnalyzer object) – DatasetAnalyzer object: data structure containing information on the parsed dataset
user_dir (str or None) – User-provided directory location for the reduced frames.
output_dir (str or None) – Output processing directory
- nabu.resources.nxflatfield.save_reduced_frames(dataset_info, reduced_frames_arrays, reduced_frames_urls)[source]¶
- nabu.resources.nxflatfield.get_metadata_url(url, frame_type)[source]¶
Return the url of the metadata stored alongside flats/darks
- nabu.resources.nxflatfield.data_url_exists(data_url)[source]¶
Return true iff the file exists and the data URL is valid (i.e data/group is actually in the file)
- nabu.resources.nxflatfield.update_dataset_info_flats_darks(dataset_info, flatfield_mode, output_dir=None, darks_flats_dir=None)[source]¶
Update a DatasetAnalyzer object with reduced flats/darks (hereafter “reduced frames”).
How the reduced frames are loaded/computed/saved will depend on the “flatfield_mode” parameter.
The principle is the following: (1) Attempt at loading already-computed reduced frames (XXX_darks.h5 and XXX_flats.h5):
First check files in the user-defined directory ‘darks_flats_dir’
Then try to load from files located alongside the .nx dataset (dataset directory)
Then try to load from output_dir, if provided
If loading fails, or flatfield_mode == “force_compute”, compute the reduced frames.
Save these reduced frames
Save in darks_flats_dir, if provided by user
Otherwise, save in the data directory (next to the .nx file), if write access OK
Otherwise, save in output directory