imars3d.backend package

iMars3D’s backend packages: the core of the application.

The main entry point for the back end software.

This can be invoked using

python -m imars3d.backend <configfile>

The built-in help will give the options when supplied a --help flag.

Subpackages

Submodules

imars3d.backend.reconstruction module

reconstruction module for imars3d package.

class imars3d.backend.reconstruction.recon(*args, **params)[source]

Bases: ParameterizedFunction

Perform reconstruction on a stack of tomographic data.

Parameters:
  • arrays (np.ndarray) – Input stack of tomography data

  • theta (np.array) – Projection angles (in radians)

  • center (float) – Rotation center

  • algorithm (str) – Name of reconstruction algorithm

  • filter_name (str) – Name of filter used for reconstruction

  • is_radians (boolean) – True if input theta is in radians, false if in degrees

  • perform_minus_log (boolean) – True if we want to run tomopy.minus_log on the arrays data before reconstruction

Returns:

Reconstructed tomographic data

Return type:

np.ndarray

max_workers = 0

imars3d.backend.autoredux module

Provides functions that are used in the auto reduction scripts.

imars3d.backend.autoredux.auto_reduction_ready(data_file: str | Path) bool[source]

Check if the data file is ready for auto reduction.

Expected directory tree for data_file is /SNS/CG1D/IPTS-XXXXX/raw/_IMAGING_TYPE_/

Parameters:

data_file – The data file to check. Assumes the file exists

Returns:

True if the data file is ready for auto reduction, False otherwise.

Return type:

bool

imars3d.backend.autoredux.extract_info_from_path(data_file: str | Path) dict[source]

Extract information from the data file path.

The data file path must conform to the following directory hierarchy .. code-block:: sh

/FACILITY/INSTRUMENT/IPTS/raw/[PREPATH]/ct_scans/[SUBPATH]/IMAGENAME.tiff

PREPATH and SUBPATH are optional and can encompass one or more directories.

Examples

/HFIR/CG1D/IPTS-25777/raw/ct_scans/20191029_ironman_small_0070_000_000_0002.tiff
/HFIR/CG1D/IPTS-25777/raw/2019_Oct/ct_scans/20191029_ironman_small_0070_000_000_0002.tiff
/HFIR/CG1D/IPTS-25777/raw/2019_Oct/29/ct_scans/20191029_ironman_small_0070_000_000_0002.tiff
/HFIR/CG1D/IPTS-25777/raw/2019_Oct/29/ct_scans/iron_man/XYZ/20191029_ironman_small_0070_000_000_0002.tiff
Parameters:

data_file – The data file to extract information

Returns:

The extracted information with the following keys: facility, instrument, ipts, prepath, subpath

Return type:

dict

imars3d.backend.autoredux.load_template_config(config_path: str | Path) dict[source]

Load the given path as a template configuration file.

Parameters:

config_path (Union[str, pathlib.Path]) – Path of template config to be loaded

Returns:

The template configuration file.

Return type:

dict

Raises:
  • FileNotFoundError – If the given path cannot be resolved

  • JSONDecodeError – If the resolved file cannot be parsed as JSON

imars3d.backend.autoredux.substitute_template(config: dict, values: dict) dict[source]

Update the template configuration with actual values.

Parameters:
  • config – dictionary resulting from loading the template JSON configuration file

  • values – dictionary resulting from scanning the path to the input radiograph with function extract_info_from_path

Return type:

dictionary with template keywords substituted with actual values