This pakcage contains a suite of Python modules and scripts that are critical for the data reduction of Neutron Imaging at Oak Ridge National Laboratory.
Install the package (once published on pip) with
$ pip install NeutronImaging
For developers, it is highly recommended to setup an isolated virtual environment for this repository. After cloning this repository to your local machine, go to the root of this repo and use the follwing commands to install dependencies
$ pip install -r requirements.txt
$ pip install -r requirements_dev.txt
use the following command to install this package to your path
$ pip install -e .
For unit test, run
pytest tests
at the root of this repo.
Examples of using this package as a Python module are provided as Jupyter Notebooks insdie the example
folder.
To generate the json
file that is needed for subsequent data reduction, use
$ generate_config.py IPTS-20267/raw/radiographs IPTS-20267/raw/ob IPTS-20267/raw/df IPTS-20267.json
where
IPTS-20267/raw/radiographs
contains the raw imagesIPTS-20267/raw/ob
contains open beam images (white field)IPTS-20267/raw/df
contains dark field images
If you would like to have multiple experiment configuration files nested in one json
file, simply use
$ generate_config.py IPTS-20267/raw/radiographs,IPTS-20267-2/raw/radiographs IPTS-20267/raw/ob IPTS-20267/raw/df IPTS-20267.json
notice that:
- You can have more than one folder for raw images, but they need to be within the same string separated by
,
. - You can have only one folder for open beam directory
- You cna have only one folder for dark field directory
The command above will yield a json
file with the following structure
{"IPTS-20267": {"CONFIG_DATA"},
"IPTS-20268": {"CONFIG_DATA"}
}
The default tolerance for the categorization with respect to aperture positions is 1mm. However, you can change the default value by specify it as below
$ generate_config.py \
IPTS-20267/raw/radiographs \
IPTS-20267/raw/ob \
IPTS-20267/raw/df \
IPTS-20267.json --tolerance=2
After installing this package, the scripts located in scripts
should be visible in your Path.
Simpy type mcp_detector_correction.py
, you should see the following
$ mcp_detector_correction.py
Usage:
mcp_detector_correction [--skipimg] [--verbose] <input_dir> <output_dir>
mcp_detector_correction (-h | --help)
mcp_detector_correction --version
Therefore, you can process the example data with the following command at the root of this repo
$ mcp_detector_correction.py data tmp
and you will see the following in your terminal
$ mcp_detector_correction.py data tmp
Parsing input
Validating input arguments
Processing metadata
Loading images into memory
Perform correction
corrected image summary
dimension: (916, 512, 512)
type: float64
Writing data to tmp
NOTE: make sure you create a
tmp
folder first.