nabu.resources.nxflatfield module

nabu.resources.nxflatfield.get_frame_possible_urls(dataset_info, user_dir, output_dir, frame_type)[source]

Return a list 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

  • frame_type (str) – Frame type, can be “flats” or “darks”.

nabu.resources.nxflatfield.get_metadata_url(url, frame_type)[source]

Return the url of the metadata stored alongside flats/darks

nabu.resources.nxflatfield.tomoscan_load_reduced_frames(dataset_info, frame_type, url)[source]
nabu.resources.nxflatfield.tomoscan_save_reduced_frames(dataset_info, frame_type, url, frames, info)[source]
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

  1. If loading fails, or flatfield_mode == “force_compute”, compute the reduced frames.

  2. 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

nabu.resources.nxflatfield.my_reduce_flats(di)[source]