nabu.resources.nxflatfield
source module nabu.resources.nxflatfield
Functions
-
get_frame_possible_urls — Return a dict with the possible location of reduced dark/flat frames.
-
get_metadata_url — Return the url of the metadata stored alongside flats/darks
-
data_url_exists — Return true iff the file exists and the data URL is valid (i.e data/group is actually in the file)
-
update_dataset_info_flats_darks — Update a DatasetAnalyzer object with reduced flats/darks (hereafter "reduced frames").
source get_frame_possible_urls(dataset_info, user_dir, output_dir)
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
source save_reduced_frames(dataset_info, reduced_frames_arrays, reduced_frames_urls)
source get_metadata_url(url, frame_type)
Return the url of the metadata stored alongside flats/darks
source tomoscan_load_reduced_frames(dataset_info, frame_type, url)
source data_url_exists(data_url)
Return true iff the file exists and the data URL is valid (i.e data/group is actually in the file)
source update_dataset_info_flats_darks(dataset_info, flatfield_mode, loading_mode='load_if_present', output_dir=None, darks_flats_dir=None)
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 (2) If loading fails, or flatfield_mode == "force_compute", compute the reduced frames. (3) 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
Raises
-
ValueError