dxchange.exchange

Module for describing beamline/experiment specific data recipes.

Functions:

read_als_832(fname[, ind_tomo, normalized, …]) Read ALS 8.3.2 standard data format.
read_als_832h5(fname[, ind_tomo, ind_flat, …]) Read ALS 8.3.2 hdf5 file with stacked datasets.
read_anka_topotomo(fname, ind_tomo, …[, …]) Read ANKA TOPO-TOMO standard data format.
read_aps_1id(fname[, ind_tomo, proj, sino, …]) Read APS 1-ID standard data format.
read_aps_2bm(fname[, proj, sino]) Read APS 2-BM standard data format.
read_aps_5bm(fname[, sino]) Read APS 5-BM standard data format.
read_aps_7bm(fname[, proj, sino]) Read APS 7-BM standard data format.
read_aps_13bm(fname, file_format[, proj, sino]) Read APS 13-BM standard data format.
read_aps_13id(fname[, group, proj, sino]) Read APS 13-ID standard data format.
read_aps_26id(image_directory, ind_tomo, …) Read APS 26-ID tomography data from a stack of xrm files.
read_aps_32id(fname[, exchange_rank, proj, …]) Read APS 32-ID standard data format.
read_aus_microct(fname, ind_tomo, ind_flat, …) Read Australian Synchrotron micro-CT standard data format.
read_diamond_l12(fname, ind_tomo[, proj]) Read Diamond Light Source L12 (JEEP) standard data format.
read_dx(fname[, exchange_rank, proj, sino, …]) Read data exchange standard data format.
read_elettra_syrmep(fname, ind_tomo, …[, …]) Read Elettra SYRMEP standard data format.
read_esrf_id19(fname[, proj, sino]) Read ESRF ID-19 standard data format.
read_lnls_imx(folder[, proj, sino]) Read LNLS IMX standard data format.
read_petraIII_p05(fname, ind_tomo, ind_flat, …) Read Petra-III P05 standard data format.
read_sls_tomcat(fname[, ind_tomo, proj, sino]) Read SLS TOMCAT standard data format.
dxchange.exchange.read_als_832(fname, ind_tomo=None, normalized=False, proj=None, sino=None)[source]

Read ALS 8.3.2 standard data format.

Parameters:
  • fname (str) – Path to file name without indices and extension.
  • ind_tomo (list of int, optional) – Indices of the projection files to read.
  • normalized (boolean, optional) – If False, darks and flats will not be read. This should only be used for cases where tomo is already normalized. 8.3.2 has a plugin that normalization is preferred to be done with prior to tomopy reconstruction.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_als_832h5(fname, ind_tomo=None, ind_flat=None, ind_dark=None, proj=None, sino=None)[source]

Read ALS 8.3.2 hdf5 file with stacked datasets.

Parameters:
  • fname (str) – Path to hdf5 file.
  • ind_tomo (list of int, optional) – Indices of the projection files to read.
  • ind_flat (list of int, optional) – Indices of the flat field files to read.
  • ind_dark (list of int, optional) – Indices of the dark field files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.
  • list of int – Indices of flat field data within tomography projection list

dxchange.exchange.read_anka_topotomo(fname, ind_tomo, ind_flat, ind_dark, proj=None, sino=None)[source]

Read ANKA TOPO-TOMO standard data format.

Parameters:
  • fname (str) – Path to data folder name without indices and extension.
  • ind_tomo (list of int) – Indices of the projection files to read.
  • ind_flat (list of int) – Indices of the flat field files to read.
  • ind_dark (list of int, optional) – Indices of the dark field files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_aps_tomoscan_hdf5(fname, exchange_rank=0, proj=None, sino=None, dtype=None)[source]

Read APS tomoscan HDF5 format.

Parameters:
  • fname (str) – Path to hdf5 file.
  • exchange_rank (int, optional) – exchange_rank is added to “exchange” to point tomopy to the data to reconstruct. if rank is not set then the data are raw from the detector and are located under exchange = “exchange/…”, to process data that are the result of some intermediate processing step then exchange_rank = 1, 2, … will direct tomopy to process “exchange1/…”,
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
  • dtype (numpy datatype, optional) – Convert data to this datatype on read if specified.
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.
  • ndarray – 1D theta in radian.

dxchange.exchange.read_aps_1id(fname, ind_tomo=None, proj=None, sino=None, layer=0)[source]

Read APS 1-ID standard data format.

Parameters:
  • fname (str) – Path to file name without indices and extension.
  • ind_tomo (list of int, optional) – Indices of the projection files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
  • layer (int, optional) – Specify the layer to reconstruct
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_aps_2bm(fname, proj=None, sino=None)[source]

Read APS 2-BM standard data format.

Parameters:
  • fname (str) – Path to hdf5 file.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_aps_5bm(fname, sino=None)[source]

Read APS 5-BM standard data format.

Parameters:
  • fname (str) – Path to data folder.
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_aps_7bm(fname, proj=None, sino=None)[source]

Read APS 7-BM standard data format.

Parameters:
  • fname (str) – Path to hdf5 file.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • array – Projection angles in radian.

dxchange.exchange.read_aps_8bm(image_directory, ind_tomo, ind_flat, image_file_pattern=u'image_00000.xrm', flat_file_pattern=u'ref_00000.xrm', proj=None, sino=None)[source]

Read APS 8-BM tomography data from a stack of xrm files.

Parameters:
  • image_directory (str) – Path to data folder name without indices and extension.
  • ind_tomo (list of int) – Indices of the projection files to read.
  • ind_flat (list of int) – Indices of the flat field files to read.
  • image_file_pattern (string) – Specify how the projection files are named.
  • flat_file_pattern (string) – Specify how the flat reference files are named.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • dictionary – Image set metadata.

dxchange.exchange.read_aps_13bm(fname, file_format, proj=None, sino=None)[source]

Read APS 13-BM standard data format. Searches directory for all necessary files, and then combines the separate flat fields.

Parameters:
  • fname (str) – Path to hdf5 file.
  • format (str) – Data format. ‘spe’ or ‘netcdf4’
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

ndarray – 3D tomographic data.

dxchange.exchange.read_aps_13id(fname, group=u'/xrfmap/roimap/sum_cor', proj=None, sino=None)[source]

Read APS 13-ID standard data format.

Parameters:
  • fname (str) – Path to hdf5 file.
  • group (str, optional) – Path to the group inside hdf5 file where data is located.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

ndarray – 3D tomographic data.

dxchange.exchange.read_aps_26id(image_directory, ind_tomo, ind_flat, image_file_pattern=u'image_00000.xrm', flat_file_pattern=u'ref_00000.xrm', proj=None, sino=None)[source]

Read APS 26-ID tomography data from a stack of xrm files.

Parameters:
  • fname (str) – Path to data folder name without indices and extension.
  • ind_tomo (list of int) – Indices of the projection files to read.
  • ind_flat (list of int) – Indices of the flat field files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • dictionary – Image set metadata.

dxchange.exchange.read_aps_32id(fname, exchange_rank=0, proj=None, sino=None, dtype=None)[source]

Read APS 32-ID standard data format.

Parameters:
  • fname (str) – Path to hdf5 file.
  • exchange_rank (int, optional) – exchange_rank is added to “exchange” to point tomopy to the data to reconstruct. if rank is not set then the data are raw from the detector and are located under exchange = “exchange/…”, to process data that are the result of some intemedite processing step then exchange_rank = 1, 2, … will direct tomopy to process “exchange1/…”,
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
  • dtype (numpy datatype, optional) – Convert data to this datatype on read if specified.
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.
  • ndarray – 1D theta in radian.

dxchange.exchange.read_aus_microct(fname, ind_tomo, ind_flat, ind_dark, proj=None, sino=None)[source]

Read Australian Synchrotron micro-CT standard data format.

Parameters:
  • fname (str) – Path to data folder.
  • ind_tomo (list of int) – Indices of the projection files to read.
  • ind_flat (list of int) – Indices of the flat field files to read.
  • ind_dark (list of int) – Indices of the dark field files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_diamond_l12(fname, ind_tomo, proj=None)[source]

Read Diamond Light Source L12 (JEEP) standard data format.

Parameters:
  • fname (str) – Path to data folder.
  • ind_tomo (list of int) – Indices of the projection files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.

dxchange.exchange.read_dx(fname, exchange_rank=0, proj=None, sino=None, dtype=None)[source]

Read data exchange standard data format.

Parameters:
  • fname (str) – Path to hdf5 file.
  • exchange_rank (int, optional) – exchange_rank is added to “exchange” to point tomopy to the data to reconstruct. if rank is not set then the data are raw from the detector and are located under exchange = “exchange/…”, to process data that are the result of some intemedite processing step then exchange_rank = 1, 2, … will direct tomopy to process “exchange1/…”,
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
  • dtype (numpy datatype, optional) – Convert data to this datatype on read if specified.
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.
  • ndarray – 1D theta in radian.
  • meta – dictionary containing the experiment meta data

dxchange.exchange.read_elettra_syrmep(fname, ind_tomo, ind_flat, ind_dark, proj=None, sino=None)[source]

Read Elettra SYRMEP standard data format.

Parameters:
  • fname (str) – Path to data folder.
  • ind_tomo (list of int) – Indices of the projection files to read.
  • ind_flat (list of int) – Indices of the flat field files to read.
  • ind_dark (list of int) – Indices of the dark field files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_esrf_id19(fname, proj=None, sino=None)[source]

Read ESRF ID-19 standard data format.

Parameters:
  • fname (str) – Path to edf file.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_lnls_imx(folder, proj=None, sino=None)[source]

Read LNLS IMX standard data format.

Parameters:
  • folder (str) – Path to sample folder (containing tomo.h5, flat.h5, dark.h5)
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_nsls2_fxi18_h5(fname, proj=None, sino=None)[source]

Read LNLS IMX standard data format.

Parameters:
  • fname (str) – Path to h5 file.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.
  • ndarray – 1D theta in radian.

dxchange.exchange.read_petraIII_p05(fname, ind_tomo, ind_flat, ind_dark, proj=None, sino=None)[source]

Read Petra-III P05 standard data format.

Parameters:
  • fname (str) – Path to data folder.
  • ind_tomo (list of int) – Indices of the projection files to read.
  • ind_flat (list of int) – Indices of the flat field files to read.
  • ind_dark (list of int) – Indices of the dark field files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.

dxchange.exchange.read_sls_tomcat(fname, ind_tomo=None, proj=None, sino=None)[source]

Read SLS TOMCAT standard data format.

Parameters:
  • fname (str) – Path to file name without indices and extension.
  • ind_tomo (list of int, optional) – Indices of the projection files to read.
  • proj ({sequence, int}, optional) – Specify projections to read. (start, end, step)
  • sino ({sequence, int}, optional) – Specify sinograms to read. (start, end, step)
Returns:

  • ndarray – 3D tomographic data.
  • ndarray – 3D flat field data.
  • ndarray – 3D dark field data.