Commit 76c69584 authored by Owen Arnold's avatar Owen Arnold
Browse files

More explicit instructions around installation

parent abc70312
......@@ -6,36 +6,7 @@ script written by Jon Taylor, Owen Arnold and Robin Woracek.
**Please note that this package is still under development.**
## Installation
* Install Mantid from [here]( ensure that you take the official latest release.
* Check that Mantid is in the python path. Official releases should automatically add themselves. Check that the path to the Mantid bin directory is listed, i.e.
* [Optional Step] We strongly recomment the use of `virtualenv` to install and use `wfm-stitching`, see [here]( for information on installing and activating a virtual environment
* Download and install the binary distribution. You can find these on [gitlab]( under releases.
`pip install {path to *.whl}`
* You can verify that this has installed correctly using:
`pip show wfm-stitching`
which yields, if installed correctly, something like the following:
Name: wfm-stitching
Version: 0.1.0
Location: ~/virtualenvironments/v20/lib/python2.7/site-packages
Requires: astropy
6. You are done, you should be able to import from `wfm_stitching`, i.e.
from wfm_stitching import WFMProcessor
You must follow the [installation](./ instructions to apply the package correctly.
# Processing Data
......@@ -61,7 +32,7 @@ an input, more specifically a list of strings that are used as an input to Manti
frame_parameters = ['12540,64,22170', '23330,64,32600', '33500,64,42220',
'42900,64,50270', '51800,64,58540', '60354,64,69000']
Each string has three values `start,step,stop` in microseconds. All frames must have the same
step size, otherwise they can't be added in the end. After cutting out the frames, each frame
is shifted by a certain number of microseconds. The offset of the first frame depends on the
......@@ -70,9 +41,9 @@ between the cutouts in the chopper disc. For simplicity, this can be done with a
that only takes the initial shift:
from wfm_stitching import make_frame_shifts
frame_shifts = make_frame_shifts(-6200)
The documentation of that function contains a few more details on how to adjust the other frame
shifts in a flexible way as well.
......@@ -82,7 +53,7 @@ regarding the instrument geometry. Three values are important here:
wfm_position = 28.55
sample_position = 51.39
detector_position = 51.4
These three values are the distance from the source to the point of the chopper cascade that
becomes the new origin - this will not change for a given beamline. The other two values are
the distances from the source to the sample and the detector, respectively.
......@@ -91,7 +62,7 @@ Based on these values, a `WFMProcessor` can be instantiated:
processor = WFMProcessor(wfm_position, sample_position, detector_position,
frame_parameters, frame_shifts)
With the instance of `WFMProcessor`, data can be processed, but first it has to be
loaded from a file.
......@@ -103,15 +74,15 @@ Data files generally come in one of two forms:
- A NeXus file, usually generated from an image stack. The file contains one spectrum per pixel,
and each image corresponds to one time point in each spectrum. So for a stack that was generated
from 1000 images with 512x512 pixels, there would be 512x512 spectra with 1000 poings each.
Both can be loaded using the `load` function, if more than one argument is specified, the files
are added up:
from wfm_stitching import load
ws_csv = load('some_csv_data', '/path/to/a/file.csv')
ws_img = load('some_img_data', '/path/to/a/file.nxs')
Example data files can be aquired from here (login required, sorry).
### Stitching frames together
......@@ -126,7 +97,7 @@ to a Wavelength spectrum. For doing that, the underlying Mantid algorithm needs
knowledge of the instrument geometry, so the file that contains it must be made available:
processed_images = p.process(ws_img, '/path/to/Instrument.xml', '0,64,70000')
The last parameter of the function are the common binning parameters. By default, the workspace
will be converted to a wavelength spectrum with the parameters `1.5,0.01,10.0`, it can be changed
by supplying another range - or suppressed by supplying `None` (in that case, the processed
......@@ -134,7 +105,7 @@ data will be in TOF). In case the input data have the wrong time unit, a scaling
be done with `scale=1e3` (default is `1e6`). Especially when the script is used in batch mode,
it is advisable to enable the `delete_temporary_workspaces`-flag, especially when working
with image data - it may require large amounts of RAM (tens of GB).
Some detectors need to perform a readout operation during a pulse, for example to prevent
overflow in case of high flux. This leads to gaps in the spectrum, where no data points are
available. To process spectra (or image stacks) that contain such artifacts, these gaps
......@@ -151,7 +122,7 @@ re-arranging the data at the same x-position of all spectra into the correct sha
(quadratic image), so there will be as many images as there are data points in each spectrum:
from wfm_stitching import save_fits_stack
save_fits_stack('/path/to/output/directory', 'base_filename_', processed_images)
The size of the image is guessed by taking the square root of the number of spectra, but can
......@@ -159,6 +130,6 @@ be overridden by supplying the `pixels`-parameter as an integer. The base filena
numbers appended to it, and each file contains it's position in the image stack in terms of
physical units (microseconds or Angstroms) in the header.
### Development
### Development
See **** for important maintenance and development topics
See **** for important maintenance and development topics
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment