MantidSQw

Readers for dynamic data

class MDMC.readers.observables.MantidSQw.MantidSQw(file_name: str)[source]

A class for reading SQw files from Mantid

Mantid’s ascii output uses one or two files, either:
  • A file containing the SQw data and error for the range of energy values measured at each Q with file_name or

  • A file containing the SQw data and error for the range of energy values measured at each detector (or group of detectors) ID with file_name and a file giving the momentum value associated with each detector (or group of detectors) ID, with the name given by file_name + '_detectors'

If a single file is supplied, then it is assumed that the Q values are included in the data, this is the typical output of Mantid reduced ISIS data. An example reduction script is included in doc/tutorials/data/water_reduction_IRIS.py If there are two files then it is assumed that the second file links the detector ID’s with the corresponding Q’s

ID_or_Q

File containing the ID’s of the detectors, default=None

Type

file, optional

file_detectors

File containing the errors on the dependent variables, default=None

Type

file, optional

file_variables

File containing the variables for each detector ID or Q

Type

file

parse(**settings: dict) None[source]

Parse into SQw format

E is the energy transfer (in meV) Q is wavevector transfer (in Ang^-1)

parse_detectors(file: IO) numpy.ndarray[source]

Parses the detector momenta values.

Parameters

file (file) – Open file containing detector IDs and momenta

Returns

A 1D array of momenta values

Return type

numpy.ndarray

parse_variables(file: IO) tuple[float][source]

Parses the values for energy, SQw and its error for each detector, or momentum value if it is defined instead of detector_ID

Parameters

file (file) – Open file containing the variables

Returns

(X, Y, E) where X is the independent variable (energy), Y is the dependent variable (SQw) and E is the errors of Y

Return type

tuple