tomwer.core.scan.nxtomoscan.NXtomoScan#

class tomwer.core.scan.nxtomoscan.NXtomoScan(scan, entry, index=None, overwrite_proc_file=False)#

This is the implementation of a TomoBase class for an acquisition stored in a HDF5 file.

For now several property of the acquisition is accessible thought a getter (like get_scan_range) and a property (scan_range).

This is done to be compliant with TomoBase instanciation. But his will be replace progressively by properties at the ‘TomoBase’ level

Parameters:

scan – scan directory or scan masterfile.h5

Type:

Union[str,None]

clear_caches()#

clear caches. Might be call if some data changed after first read of data or metadata

data_flat_field_correction(data, index=None)#

Apply flat field correction on the given data

Parameters:
  • data (numpy.ndarray) – the data to apply correction on

  • index (Uion[int, None]) – index of the data in the acquisition sequence

Returns:

corrected data

Return type:

numpy.ndarray

static directory_contains_scan(directory, src_pattern=None, dest_pattern=None)#

Check if the given directory is holding an acquisition

Parameters:
  • directory (str) – directory we want to check

  • src_pattern (str) – buffer name pattern (‘lbsram’)

  • dest_pattern – output pattern (‘’). Needed because some acquisition can split the file produce between two directories. This is the case for edf, where .info file are generated in /data/dir instead of /lbsram/data/dir

Type:

str

Returns:

does the given directory contains any acquisition

Return type:

bool

static entry_is_nx_tomo(entry)#
property ff_interval#
static from_dict(_dict)#
static from_identifier(identifier)#

Return the Dataset from a identifier

get_identifier()#

return the dataset identifier of the scan. The identifier is insure to be unique for each scan and allow the user to store the scan as a string identifier and to retrieve it later from this single identifier.

get_nabu_dataset_info(binning=1, binning_z=1, proj_subsampling=1)#
Returns:

nabu dataset descriptor

Return type:

dict

static get_nxtomo_entries(file_path)#
Return type:

tuple

static get_process_file_name(scan)#
get_proj_angle_url(use_cache=True, with_alignment=True)#

retrieve the url for each projections (including the alignement / return one) and associate to each (if possible) the angle. Alignment angle are set as angle (1) to specify that this is an alignment one. :param bool use_cache: :return: dictionary with angle (str or int) as key and url as value :rtype: dict

get_proposal_name()#
Return type:

Optional[str]

get_sinogram(line, subsampling=1, norm_method=None, **kwargs)#

extract the sinogram from projections

Parameters:
  • line – which sinogram we want

  • subsampling – subsampling to apply on the sinogram

Type:

int

Returns:

sinogram from the radio lines

Return type:

numpy.array

property helical#
is_abort(src_pattern, dest_pattern)#

Check if the acquisition have been aborted. In this case the directory should contain a [scan].abo file

Parameters:
  • src_pattern (str) – buffer name pattern (‘lbsram’)

  • dest_pattern – output pattern (‘’). Needed because some acquisition can split the file produce between two directories. This is the case for edf, where .info file are generated in /data/dir instead of /lbsram/data/dir

Returns:

True if the acquisition have been abort and the directory should be abort

is_finish()#
static is_nexus_nxtomo_file(file_path)#
Return type:

bool

static is_nxdetector(grp)#

Check if the grp is an nx detector

Parameters:

grp (h5py.Group) –

Returns:

True if this is the definition of a group

Return type:

bool

load_from_dict(_dict)#

Load properties contained in the dictionnary.

Parameters:

_dict (dict) – dictionary to load

Returns:

self

Raises:

ValueError if dict is invalid

projections_with_angle()#

projections / radio, does not include the return projections

scan_basename()#

return basename of the directory containing the acquisition

scan_dir_name()#

return name of the directory containing the acquisition

Return type:

Optional[str]

scan_parent_dir_basename()#

return parent basename of the directory containing the acquisition

to_dict()#
Returns:

convert the TomoScanBase object to a dictionary. Used to serialize the object for example.

Return type:

dict

to_nabu_dataset_analyser()#

Return the equivalent DatasetAnalyzer for nabu

update()#

update list of radio and reconstruction by parsing the scan folder

property working_directory#

working directory to use for this scan (for launching reconstruction for example)