| Home | Trees | Indices | Help |
|
|---|
|
|
Reflectometry reduction file formats.
=== File formats ===
Supported formats are:
ICP on NCNR NG-1 and NG-7 NeXus on SNS Liquids and Magnetic
The list of available formats can be found at runtime using reflectometry.reduction.formats()
Sample data for some of these formats is available in datadir. In ipython type the following:
import reflectometry.reduction as red ls $red.datadir
=== Loading files ===
Data files are loaded using:
data = red.load('path/to/file')
This creates a reflectometry data object in memory whose fields can be accessed directly (see below). Note that some data formats can store multiple measurements in the file, so the returned value may be a list of data objects.
Once loaded, data fields can be accessed using data.field for general data, or data.component.field for specific components such as detectors or slits. Within ipython, type data.<Tab> to see the fields available. See help(refldata) for a complete description of all the fields.
Some datasets are huge and can take substantial time to load. Instead of loading the entire dataset, you can use:
data = red.loadmeta('path/to/file')
to load just the metadata, and later use:
data.load()
to load the data itself. Again, loadmeta() returns a list of data objects if there are multiple datasets in the file. Note that the metadata can be wrong if for example an NCNR ICP run was aborted before all the measurements were complete. data.load() will return the points which were actually measured.
=== Saving files === [Not implemented]
Saving files is the inverse of loading:
red.save(data, 'filename.ext') red.save(data, 'filename') # .ext defaults to .dat red.save(data, 'arbitraryfilename', format='.ext') #
This saves the contents of data into the file of type '.ext'. Alternatively, the data can be saved to an arbitrary filename if the format='.ext' keyword is given. If the extension is missing, '.dat' is used.
If no filename is given, then
The save function can be used to convert from one file format to another. This is can be useful for comparing the results of reduction from different reduction programs.
After normalizing by monitor, the data may be in various states of reduction:
It is up to the individual formats to determine how they will store this information.
With no file extension, an ascii format is used with a .dat extension. This is a multicolumn formation with a header defined by:
# field value # field value ... # columns Q dQ R dR wavelength 0.001 0.000121 0.98596 0.00212 4.75 ... 0.02 0.00215 1.2356e-7 2.195e-8 4.75
The columns included will be different for the different states of reduction, in particular, enough information needs to be preserved so that intensity scans can be aligned with the corresponding specular intensity.
With no filename, the file is saved to a file of the same name as the original, but with an extension of e.g., .refl.dat if it is reflectivity data.
Other common output formats include .xml for an xml version of the multicolumn ascii format, following the standards for reduced SANS data, and .nxs for an NeXus/HDF5 versions of the same information.
Note that the reduction process combines many files into one. Storing details such as the sample description from all these files is impractical, and so only one 'head' file will be chosen. This will be the file on which all the corrections have been applied, or the file with the lowest sequence number if multiple files have been combined. When saving to the NeXus format, all the metadata from the head file will be preserved.
=== Registering new formats ===
New formats can be created and register using
red.formats.register(loader)
See the formats.register documentation for a description of the loader function interface.
Currently available formats are returned from:
red.formats.available()
| Functions | |||
|
|||
|
|||
| Variables | |
datadir =
|
|
| Function Details |
Load the measurement description from the file but not the data. Use measurement.load() to load the data for each measurement. Returns a single measurement if there is only one measurement in the file, otherwise it returns a list of measurements. Use formats() to list available file formats. |
Load the reflectometry measurement description and the data. Returns a single measurement if there is only one measurement in the file, otherwise it returns a list of measurements. Use formats() to list available file formats. |
| Variables Details |
datadir
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Mar 17 14:18:20 2009 | http://epydoc.sourceforge.net |