SPEC standard plugin#
SPEC data file standard control lines
- see
SPEC manual, Standard Data File Format, https://www.certif.com/spec_manual/user_1_4_1.html
- class spec2nexus.plugins.spec_common.SPEC_Comment[source]#
#C – any comment either in the scan header or somewhere in the scan
IN-MEMORY REPRESENTATION
(SpecDataFileHeader): comments
(SpecDataFileScan): comments
HDF5/NeXus REPRESENTATION
file root-level attribute: SPEC_comments : string array of all comments from first header block
dataset named comments under /NXentry group, such as /S1/comments : string array of all comments from this scan block
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_CountTime[source]#
#T – counting against this constant number of seconds (see #M)
IN-MEMORY REPRESENTATION
(SpecDataFileScan): T
HDF5/NeXus REPRESENTATION
Dataset named T in the NXentry group, such as /S1/T
Dataset named counting_basis in the NXentry group with value SPEC scan with constant counting time, such as /S1/counting_basis
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_CounterMnemonics[source]#
#j – mnemonics of counter (new with SPEC v6)
IN-MEMORY REPRESENTATION
(SpecDataFileHeader): j : mnemonics
HDF5/NeXus REPRESENTATION
NXnote group named counter_cross_reference in the NXentry group, such as /S1/counter_cross_reference
datasets with names supplied as SPEC counter mnemonics, string values supplied as SPEC counter names
- postprocess(header, *args, **kws)[source]#
optional: More processing deferred until after data file has been read.
- process(text, header, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_CounterNames[source]#
#J – names of counters (each separated by two spaces) (new with SPEC v6)
IN-MEMORY REPRESENTATION
(SpecDataFileHeader): J : mnemonics
HDF5/NeXus REPRESENTATION
NXnote group named counter_cross_reference in the NXentry group, such as /S1/counter_cross_reference
datasets with names supplied as SPEC counter mnemonics, string values supplied as SPEC counter names
- postprocess(header, *args, **kws)[source]#
optional: More processing deferred until after data file has been read.
- process(text, header, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_DataLine[source]#
(scan_data) – scan data line
Scan data could include interspersed MCA data or even describe 2-D or 3-D data. T his method reads the data lines and buffers them for post-processing in
spec2nexus.plugins.spec_common_spec2nexus.data_lines_postprocessing()
.IN-MEMORY REPRESENTATION
(SpecDataFileScan): data_lines : values
(SpecDataFileScan): data : {labels: values}
HDF5/NeXus REPRESENTATION
NXdata group named data in the NXentry group, such as /S1/data
datasets with names supplied in L, array values collected in data_lines
- postprocess(scan, *args, **kws)[source]#
optional: More processing deferred until after data file has been read.
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_Date[source]#
#D – date/time stamp
IN-MEMORY REPRESENTATION
(SpecDataFileHeader): date str, ISO8601 format
HDF5/NeXus REPRESENTATION
file root-level attribute: SPEC_date str (value for 1st header block is used)
- process(text, sdf_object, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_Epoch[source]#
#E – the UNIX epoch (seconds from 00:00 GMT 1/1/70)
In SPEC data files, the
#E
control line indicates the start of a header block.IN-MEMORY REPRESENTATION
(SpecDataFileHeader): epoch int
HDF5/NeXus REPRESENTATION
file root-level attribute: SPEC_epoch int
- process(buf, sdf_object, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_File[source]#
#F – original data file name (starts a file header block)
Module
spec2nexus.spec
is responsible for handling this control line.IN-MEMORY REPRESENTATION
(SpecDataFile): fileName
(SpecDataFileHeader) : file
HDF5/NeXus REPRESENTATION
file root-level attribute: SPEC_file
- process(text, spec_file_obj, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_Geometry[source]#
#G – diffractometer geometry (numbered rows: #G0, #G1, …)
IN-MEMORY REPRESENTATION
(SpecDataFileScan): G
HDF5/NeXus REPRESENTATION
NXnote group named G in the NXentry group, such as /S1/G
Datasets created from dictionary <scan>.G (indexed by number from the scan block, such as
G0
,G1
, …). Meaning of contents for each index are defined by geometry-specific SPEC diffractometer support.
NXinstrument & NXsample groups for interpreted information
- postprocess(scan, *args, **kws)[source]#
optional: More processing deferred until after data file has been read.
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_HKL[source]#
#Q – \(Q\) (\(hkl\)) at start of scan
IN-MEMORY REPRESENTATION
(SpecDataFileScan): Q
HDF5/NeXus REPRESENTATION
Dataset named Q in the NXentry group, such as /S1/M
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_Labels[source]#
#L – data column labels
IN-MEMORY REPRESENTATION
(SpecDataFileScan): L : labels
(SpecDataFileScan): data : {labels: values}
HDF5/NeXus REPRESENTATION
NXdata group named data in the NXentry group, such as /S1/data
datasets with names supplied in L, array values collected in data_lines
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_MCA[source]#
#@MCA – MCA data formatting declaration (ignored for now)
declares this scan contains MCA data (SPEC’s array_dump() format, such as
"#@MCA 16C"
)From documentation provided by the ESRF BLISS group: (https://www.esrf.eu/blissdb/macros/getsource.py?macname=mca.mac)
#@MCA 16C Format string passed to data_dump() function. This format string is held by the global variable “MCA_FMT” and can then been adapted to particular needs. “%%16C” is the default. It dumps data on 1 line, cut every 16 points:
@A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\ 0 0 0 0 0 0 0 0 0 0 0 ...
“%%16” would do the same without any backslash “1” would dump 1 point per line, …
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_MCA_Array[source]#
@A – MCA Array data
MCA data. Each value is the content of one channel, or an integrated value over several channels if a reduction was applied.
Since the MCA Array data is interspersed with scan data, this method reads the data lines and buffers them for post-processing in
spec2nexus.plugins.spec_common_spec2nexus.data_lines_postprocessing()
.IN-MEMORY REPRESENTATION
(SpecDataFileScan): data_lines : values
(SpecDataFileScan): data : {labels: values}
HDF5/NeXus REPRESENTATION
NXdata group named data in the NXentry group, such as /S1/data
Dataset _mca_ : float MCA data reported on @A lines
- Dataset _mca_channel_: provided as HDF5 dimension scale for _mca_ dataset
if CALIB data specified: float scaled MCA channels – \(x_k = a +bk + ck^2\)
if CALIB data not specified: int MCA channel numbers
- postprocess(scan, *args, **kws)[source]#
optional: More processing deferred until after data file has been read.
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_MCA_Calibration[source]#
#@CALIB – coefficients to compute a scale based on the MCA channel number
\(x_k = a +bk + ck^2\) for MCA data, \(k\) is channel number
IN-MEMORY REPRESENTATION
(SpecDataFileScan): MCA[‘CALIB’] =
dict(a, b, c)
HDF5/NeXus REPRESENTATION
defines a dimension scale for MCA data
NXnote group named MCA in the NXentry group, such as /S1/MCA
Dataset calib_a : float
Dataset calib_b : float
Dataset calib_c : float
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_MCA_ChannelInformation[source]#
#@CHANN – MCA channel information
number_saved, first_saved, last_saved, reduction_coef
IN-MEMORY REPRESENTATION
(SpecDataFileScan): MCA[‘CALIB’] =
dict(number_saved, first_saved, last_saved, reduction_coef)
HDF5/NeXus REPRESENTATION
NXnote group named MCA in the NXentry group, such as /S1/MCA
Dataset number_saved : int number of channels saved
Dataset first_saved : int first channel saved
Dataset first_saved : int last channel saved
Dataset reduction_coef : float reduction coefficient
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_MCA_CountTime[source]#
#@CTIME – MCA count times
preset_time, elapsed_live_time, elapsed_real_time
IN-MEMORY REPRESENTATION
(SpecDataFileScan): MCA[‘CALIB’] =
dict(preset_time, elapsed_live_time, elapsed_real_time)
HDF5/NeXus REPRESENTATION
NXnote group named MCA in the NXentry group, such as /S1/MCA
Dataset preset_time : float
Dataset elapsed_live_time : float
Dataset elapsed_real_time : float
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_MCA_RegionOfInterest[source]#
#@ROI – MCA ROI (Region Of Interest) channel information
ROI_name, first_chan, last_chan
IN-MEMORY REPRESENTATION
(SpecDataFileScan): MCA[‘ROI’] = {ROI_name:dict(first_chan, last_chan)}
HDF5/NeXus REPRESENTATION
NXnote group ROI in in NXnote group named MCA in the NXentry group, such as /S1/MCA/ROI
Dataset {ROI_name} : int [first_chan, last_chan]
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_Monitor[source]#
#M – counting against this constant monitor count (see #T)
IN-MEMORY REPRESENTATION
(SpecDataFileScan): M
HDF5/NeXus REPRESENTATION
Dataset named M in the NXentry group, such as /S1/M
Dataset named counting_basis in the NXentry group with value SPEC scan with constant monitor count, such as /S1/counting_basis
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_NormalizingFactor[source]#
#I – intensity normalizing factor
IN-MEMORY REPRESENTATION
(SpecDataFileScan): I
HDF5/NeXus REPRESENTATION
Dataset named intensity_factor in the NXentry group, such as /S1/intensity_factor
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_NumColumns[source]#
#N – number of columns of data [ num2 sets per row ]
IN-MEMORY REPRESENTATION
(SpecDataFileScan): N : [int]
HDF5/NeXus REPRESENTATION
not written to file
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_PositionerMnemonics[source]#
#o – positioner mnemonics (new with SPEC v6)
IN-MEMORY REPRESENTATION
(SpecDataFileHeader): o : mnemonics
HDF5/NeXus REPRESENTATION
NXnote group named positioner_cross_reference in the NXentry group, such as /S1/positioner_cross_reference
datasets with names supplied as SPEC positioner mnemonics, string values supplied as SPEC positioner names
- postprocess(header, *args, **kws)[source]#
optional: More processing deferred until after data file has been read.
- process(text, header, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_PositionerNames[source]#
#O – positioner names (numbered rows: #O0, #O1, …)
IN-MEMORY REPRESENTATION
(SpecDataFileHeader) : O : label
(SpecDataFileScan): positioner : {label: value}
HDF5/NeXus REPRESENTATION
NXnote group named positioners in the NXentry group, such as /S1/positioners
datasets created from dictionary <scan>.positioner
NXnote group named positioner_cross_reference in the NXentry group, such as /S1/positioner_cross_reference
datasets with names supplied as SPEC positioner mnemonics, string values supplied as SPEC positioner names
- process(text, sdf_object, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_Positioners[source]#
#P – positioner values at start of scan (numbered rows: #P0, #P1, …)
IN-MEMORY REPRESENTATION
(SpecDataFileHeader) : O : label
(SpecDataFileScan): positioner : {label: value}
HDF5/NeXus REPRESENTATION
NXnote group named positioners in the NXentry group, such as /S1/positioners
datasets created from dictionary <scan>.positioner
- postprocess(scan, *args, **kws)[source]#
interpret the motor positions from the scan header
- Parameters
scan (SpecDataFileScan) – data from a single SPEC scan
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_Scan[source]#
#S – SPEC scan
In SPEC data files, the
#S
control line indicates the start of a scan block. Each scan will be written to a separate NXentry group in the HDF5 file.- NXentry:
“The top-level NeXus group which contains all the data and associated information that comprise a single measurement.”
– https://download.nexusformat.org/doc/html/classes/base_classes/NXentry.html
IN-MEMORY REPRESENTATION
(SpecDataFile):
(SpecDataFileHeader):
HDF5/NeXus REPRESENTATION
/NXentry group named ‘S%d` scan_number at root level, such as /S1
- process(part, sdf, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_TemperatureSetPoint[source]#
#X – Temperature Set Point (desired temperature)
The default declaration of the #X control line is written:
def Fheader '_cols++;printf("#X %gKohm (%gC)\n",TEMP_SP,DEGC_SP)'
The supplied macro alters this slightly (replacing %g with %f) and uses the
spec2nexus.scanf.scanf()
implementation with this format:fmt = "#X %fKohm (%fC)"
Depending on the circumstances, this might be a good candidate to override with a custom ControlLineBase that parses the data as written. If the conversion process fails for any reason in this implementation, the #X line is ignored.
IN-MEMORY REPRESENTATION
(SpecDataFileScan): TEMP_SP
(SpecDataFileScan): DEGC_SP
HDF5/NeXus REPRESENTATION
Dataset named TEMP_SP in the NXentry group, such as /S1/TEMP_SP
Dataset named DEGC_SP in the NXentry group, such as /S1/DEGC_SP
- process(text, scan, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_UserReserved[source]#
#U – Reserved for user-defined information
IN-MEMORY REPRESENTATION
(SpecDataFileHeader): U, [str]
(SpecDataFileScan): U, [str]
HDF5/NeXus REPRESENTATION
Within a group named UserReserved in the NXentry group: dataset(s) named header_## (from the SPEC data file header section) or item_## (from the SPEC data file scan section), such as /S1/UserReserved/header_1 and /S1/UserReserved/item_5
- process(text, sdf_object, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- class spec2nexus.plugins.spec_common.SPEC_UserResults[source]#
#R – Reserved for user results
IN-MEMORY REPRESENTATION
(SpecDataFileHeader): R, [str]
(SpecDataFileScan): R, [str]
HDF5/NeXus REPRESENTATION
Within a NXnote group named UserResults in the NXentry group: dataset(s) named header_## (from the SPEC data file header section) or item_## (from the SPEC data file scan section), such as /S1/UserResults/header_1 and /S1/UserResults/item_5
- process(text, sdf_object, *args, **kws)[source]#
required: Handle this line from a SPEC data file.
PARAMETERS
- text str:
?raw text?
- spec_obj obj:
Instance of
SpecDataFile
,SpecDataFileHeader
, orSpecDataFileScan
- spec2nexus.plugins.spec_common.combine_split_NM_lines(nm, data_lines)[source]#
combine split lines of data
#N N [M]
Indicates there are N columns of data. If M is present, it indicates there are M sets of data columns on each line.
- spec2nexus.plugins.spec_common.data_lines_postprocessing(scan)[source]#
interpret the data lines from the body of the scan
- Parameters
scan (SpecDataFileScan) – data from a single SPEC scan