DAE Spectra
Spectra refers to a contiguous array of numbers which are used to map and/or group detectors which may not be in any order and may describe individual sections of a detector array which should be treated as one pixel. Grouping detectors together may be because this creates a smaller resultant histogram, or as an example several detectors may map to the same scattering angle on a powder diffractometer and therefore should be treated as one area.
This grouping/mapping is configured by the spectra .dat files which are selected by the user, and are applied in practice for the spectra plots as well as for writing datasets separated by spectra ID in a NeXus file.
The ISISDAE IOC serves spectra information (data collected in the Data Acquisition Electronics hardware) via the following PV format
$(P)DAE:SPEC:$(PERIOD):$(SPEC):X
$(P)DAE:SPEC:$(PERIOD):$(SPEC):Y
$(P)DAE:SPEC:$(PERIOD):$(SPEC):YC
$(P)DAE:SPEC:$(PERIOD):$(SPEC):C
Where SPEC is the spectrum number, PERIOD the period, X is the time-of-flight axis values, Y is the counts / microsecond (i.e. divided by histogram time bin width), YC is just counts in each bin (i.e. not divided by time), and C is total counts for that spectrum (summed over all time-of-flight bins). So X, Y and YC are arrays and C is a single number. X represents time bin centres, if there are N histogram time bins there will be N values in Y, YC and X. The size of the waveform array can be determined from the .NORD PV field e.g. X.NORD (note: the NeXus raw data file stores bin boundaries rather than centres, so the time_of_flight axis (equivalent to X) will be size N+1 rather than N in the data file. Mantid will handle this transparently for you when it loads the file).
A spectrum number exists for every detector (pixel) and monitor. In addition the scientist can associate a “monitor number” (starting at 1 and increasing sequentially) with each spectrum number that is associated with a monitor. The monitor data can then be accessed via additional PVs that have the same general format as above but used the prefix $(P)DAE:MON:$(PERIOD):$(MON_NUM). So for example if monitor number 1 is spectrum number 1234 then the counts per unit time can be accessed as either $(P)DAE:SPEC:$(PERIOD):1234:Y or $(P)DAE:MON:$(PERIOD):1:Y. There are no corresponding :DET: names for detectors, they are always accessed as :SPEC:. The :MON: mechanism is a convenient alias for monitors, but provides no additional information to using :SPEC:. The underlying spectrum number for a monitor can be obtained via $(P)DAE:MON:$(PERIOD):1:S. Some instruments can change their detector setup between experiments and depending on how they have assigned spectrum numbers this may result in a different :SPEC: being needed for each monitor than previously. So using :MON: syntax to access monitors is usually safer.
For most instruments $(PERIOD) will always be 1, however some instruments scan their devices and detector/monitor data at each scan point can be accessed via using different values of $(PERIOD). SANS, reflectometry and muon instruments regularly use multiple periods, most other instruments only occasionally if at all. If the instrument is currently running in period mode then the PV $(P)DAE:NUMPERIODS will have a value greater than 1 and $(PERIOD) can then have values from 1 to NUMPERIODS representing the NUMPERIODS scan points.
Monitors and detectors are stored separately in the NeXus raw data (.nxs) file and when this is read into Mantid a separate workspace is created for each. If periods have been used, then a “workspace group” is created. Workspace indexes always start at 0, the actual spectrum/monitor number will be stored in one of the workspace axes. As monitor numbers always start at 1 and increase numerically, index 0 of the monitor workspace will always be monitor number 1 etc. The same does not apply to the detector workspace i.e. index 0 there is not guaranteed to be spectrum 1 as if spectrum 1 is a monitor it will not be present in that workspace.