nabu.resources.dataset_analyzer module

class nabu.resources.dataset_analyzer.DatasetAnalyzer(location, extra_options=None, logger=None)[source]

Bases: object

Initialize a Dataset analyzer.

Parameters:
  • location (str) – Dataset location (directory or file name)

  • extra_options (dict, optional) – Extra options on how to interpret the dataset.

  • logger (logging object, optional) – Logger. If not set, messages will just be printed in stdout.

kind = 'none'

Base class for datasets analyzers.

property energy

Return the energy in kev.

property distance

Return the sample-detector distance in meters.

property pixel_size

Return the pixel size in microns.

property rotation_angles

Return the rotation angles in radians.

property is_halftomo

Indicates whether the current dataset was performed with half acquisition.

property detector_tilt

Return the detector tilt in degrees

property projections_srcurrent

Return the synchrotron electric current for each projection.

check_defined_attribute(name, error_msg=None)[source]

Utility function to check that a given attribute is defined.

class nabu.resources.dataset_analyzer.EDFDatasetAnalyzer(location, extra_options=None, logger=None)[source]

Bases: DatasetAnalyzer

EDF Dataset analyzer for legacy ESRF acquisitions

Initialize a Dataset analyzer.

Parameters:
  • location (str) – Dataset location (directory or file name)

  • extra_options (dict, optional) – Extra options on how to interpret the dataset.

  • logger (logging object, optional) – Logger. If not set, messages will just be printed in stdout.

kind = 'edf'

Base class for datasets analyzers.

remove_unused_radios()[source]

Remove “unused” radios. This is used for legacy ESRF scans.

property hdf5_entry

Return the HDF5 entry of the current dataset. Not applicable for EDF (return None)

class nabu.resources.dataset_analyzer.HDF5DatasetAnalyzer(location, extra_options=None, logger=None)[source]

Bases: DatasetAnalyzer

HDF5 dataset analyzer

Initialize a Dataset analyzer.

Parameters:
  • location (str) – Dataset location (directory or file name)

  • extra_options (dict, optional) – Extra options on how to interpret the dataset.

  • logger (logging object, optional) – Logger. If not set, messages will just be printed in stdout.

kind = 'hdf5'

Base class for datasets analyzers.

property z_translation
property x_translation
property dataset_hdf5_url
property hdf5_entry

Return the HDF5 entry of the current dataset

get_data_slices(what)[source]

Return indices in the data volume where images correspond to a given kind.

Parameters:

what (str) – Which keys to get. Can be “projections”, “flats”, “darks”

Returns:

slices – A list where each item is a slice.

Return type:

list of slice

nabu.resources.dataset_analyzer.analyze_dataset(dataset_path, extra_options=None, logger=None)[source]
nabu.resources.dataset_analyzer.get_0_180_radios(dataset_info, return_indices=False)[source]

Get the radios at 0 degres and 180 degrees.

Parameters:
  • dataset_info (DatasetAnalyzer instance) – Data structure with the dataset information

  • return_indices (bool, optional) – Whether to return radios indices along with the radios array.

Returns:

res – If return_indices is True, return a tuple (radios, indices). Otherwise, return an array with the radios.

Return type:

array or tuple