Skip to main content

Neutron Imaging Reduction

Project description

NeutronImagingScripts

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.

Overview

Installation

General users

Install the package (once published on pip) with

$ pip install NeutronImagingScripts

Developers

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.

Usage

Use as a Package

Examples of using this package as a Python module are provided as Jupyter Notebooks insdie the example folder.

Use as a commandline tool

Generate Configuration File for Data Reduction

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 images
  • IPTS-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

MCP Detector correction

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.

Developer Notes

Project details


Release history Release notifications | RSS feed

This version

1.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

NeutronImaging-1.2.tar.gz (26.8 kB view hashes)

Uploaded Source

Built Distribution

NeutronImaging-1.2-py3-none-any.whl (25.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page