CHAP.edd.reader
¶
Module Contents¶
Classes¶
Reader for taking an EDD-style .par file and returning a
|
|
Reader for taking an EDD-style .par file and returning a representing one of the datasets in the file as a NeXus NXentry object. Independent dimensions are determined automatically, and a specific set of items to use for extra scalar datasets to include are hard-coded in. |
|
Reader for turning a single SPEC scan into a MapConfig. |
|
Reader for converting the SPEC input .txt file for EDD dataset
collection to an approporiate input argument for
|
|
Companion to |
|
Reader for returning a sliced verison of an |
API¶
- class CHAP.edd.reader.EddMapReader¶
Bases:
CHAP.reader.Reader
Reader for taking an EDD-style .par file and returning a
MapConfig
representing one of the datasets in the file. Independent dimensions are determined automatically, and a specific set of items to use for extra scalar datasets to include are hard-coded in. The raw data is read if detector_names are specified.Initialization
Constructor of PipelineItem class
- read(parfile, dataset_id, detector_names=None)¶
Return a validated
MapConfig
object representing an EDD dataset.- Parameters:
parfile (str) – Name of the EDD-style .par file containing the dataset.
dataset_id (int) – Number of the dataset in the .par file to return as a map.
detector_names (list[str], optional) – Detector prefixes for the raw data.
- Returns:
Map configuration packaged with the appropriate value for ‘schema’.
- Return type:
- class CHAP.edd.reader.EddMPIMapReader¶
Bases:
CHAP.reader.Reader
Reader for taking an EDD-style .par file and returning a representing one of the datasets in the file as a NeXus NXentry object. Independent dimensions are determined automatically, and a specific set of items to use for extra scalar datasets to include are hard-coded in.
Initialization
Constructor of PipelineItem class
- read(parfile, dataset_id, detector_names)¶
Return a NeXus NXentry object after validating the
MapConfig
object representing an EDD dataset.- Parameters:
parfile (str) – Name of the EDD-style .par file containing the dataset.
dataset_id (int) – Number of the dataset in the .par file to return as a map.
detector_names (list[str]) – Detector prefixes for the raw data.
- Returns:
The EDD map including the raw data packaged with the appropriate value for ‘schema’.
- Return type:
- class CHAP.edd.reader.ScanToMapReader¶
Bases:
CHAP.reader.Reader
Reader for turning a single SPEC scan into a MapConfig.
Initialization
Constructor of PipelineItem class
- read(spec_file, scan_number)¶
Return a dictionary representing a valid map configuration consisting of the single SPEC scan specified.
- Parameters:
spec_file (str) – Name of the SPEC file.
scan_number (int) – Number of the SPEC scan.
- Returns:
Map configuration dictionary
- Return type:
dict
- class CHAP.edd.reader.SetupNXdataReader¶
Bases:
CHAP.reader.Reader
Reader for converting the SPEC input .txt file for EDD dataset collection to an approporiate input argument for
CHAP.common.SetupNXdataProcessor
.Example of use in a
Pipeline
configuration:config: inputdir: /rawdata/samplename outputdir: /reduceddata/samplename pipeline: - edd.SetupNXdataReader: filename: SpecInput.txt dataset_id: 1 - common.SetupNXdataProcessor: nxname: samplename_dataset_1 - common.NexusWriter: filename: data.nxs
Initialization
Constructor of PipelineItem class
- read(filename, dataset_id)¶
Return a dictionary containing the
coords
,signals
, andattrs
arguments appropriate for use withCHAP.common.SetupNXdataProcessor.process
to set up an initialNXdata
object representing a complete and organized structured EDD dataset.- Parameters:
filename (str) – Name of the input .txt file provided to SPEC for EDD dataset collection.
dataset_id (int) – Number of the dataset in the .txt file to return
CHAP.common.SetupNXdataProcessor.process
arguments for.
- Returns:
The dataset’s coordinate names, values, attributes, and signal names, shapes, and attributes.
- Return type:
dict
- class CHAP.edd.reader.UpdateNXdataReader¶
Bases:
CHAP.reader.Reader
Companion to
edd.SetupNXdataReader
andcommon.UpdateNXDataProcessor
. Constructs a list of data points to pass as pipeline data tocommon.UpdateNXDataProcessor
so that anNXdata
constructed byedd.SetupNXdataReader
andcommon.SetupNXdataProcessor
can be updated live as individual scans in an EDD dataset are completed.Example of use in a
Pipeline
configuration:config: inputdir: /rawdata/samplename pipeline: - edd.UpdateNXdataReader: spec_file: spec.log scan_number: 1 - common.SetupNXdataProcessor: nxfilename: /reduceddata/samplename/data.nxs nxdata_path: /entry/samplename_dataset_1
Initialization
Constructor of PipelineItem class
- read(spec_file, scan_number, inputdir='.')¶
Return a list of data points containing raw data values for a single EDD spec scan. The returned values can be passed along to
common.UpdateNXdataProcessor
to fill in an existingNXdata
set up withcommon.SetupNXdataProcessor
.- Parameters:
spec_file (str) – Name of the spec file containing the spec scan (a relative or absolute path).
scan_number (int) – Number of the spec scan.
inputdir (str) – Parent directory of
spec_file
, used only ifspec_file
is a relative path. Will be ignored ifspec_file
is an absolute path. Defaults to'.'
.
- Returs:
List of data points appropriate for input to
common.UpdateNXdataProcessor
.- Return type:
list[dict[str, object]]
- class CHAP.edd.reader.NXdataSliceReader¶
Bases:
CHAP.reader.Reader
Reader for returning a sliced verison of an
NXdata
(which represents a full EDD dataset) that contains data from just a single SPEC scan.Example of use in a
Pipeline
configuration:config: inputdir: /rawdata/samplename outputdir: /reduceddata/samplename pipeline: - edd.NXdataSliceReader: filename: /reduceddata/samplename/data.nxs nxpath: /path/to/nxdata spec_file: spec.log scan_number: 1 - common.NexusWriter: filename: scan_1.nxs
Initialization
Constructor of PipelineItem class
- read(filename, nxpath, spec_file, scan_number, inputdir='.')¶
Return a “slice” of an EDD dataset’s NXdata that represents just the data from one scan in the dataset.
- Parameters:
filename (str) – Name of the NeXus file in which the existing full EDD dataset’s NXdata resides.
nxpath (str) – Path to the existing full EDD dataset’s NXdata group in
filename
.spec_file (str) – Name of the spec file containing whose data will be the only contents of the returned
NXdata
.scan_number (int) – Number of the spec scan whose data will be the only contents of the returned
NXdata
.inputdir (str, optional) – Directory containing
filename
and/orspec_file
, if either one / both of them are not absolute paths. Defaults to'.'
.
- Returns:
An
NXdata
similar to the one atnxpath
infilename
, but containing only the data collected by the specified spec scan.- Return type:
nexusformat.nexus.NXdata