Data File¶
Object to load and keep track of HdF files and their conversions |
|
Return the difference between two data files by keys |
|
Small function to check if current binning is equal to wanted binning and if not reloads to binning wanted |
|
"Dedicated loader for MultiFLEXX data. |
|
Method to plot the fitted A4 values of the normalization table |
|
Method to plot the fitted Ef values of the normalization table |
|
Method to plot the fitted Ef values of the normalization table |
|
Method to plot the fitted integrated intensities of the normalization table |
|
Save converted file into an NXsqom. |
|
Create an empty data file with a given sample and measurement parameters. |
DataFile Object and Methods¶
- class DataFile.DataFile(fileLocation=None, McStas=False)[source]¶
Object to load and keep track of HdF files and their conversions
- calculateCurratAxeMask(BraggPeaks, dqx=None, dqy=None, dH=None, dK=None, dL=None, spurionType='both', maskInside=True)[source]¶
Generate an elliptical mask centered on the Currat-Axe spurion.
- Parameters
BraggPeaks (-) – List of Bragg peaks to be used for mask. Shape is given by [[H1,K1,L1], [H2,K2,L2], … [HN,KN,LN]]
Kwargs:
dqx (float): Radius used for masking along qx (default None)
dqy (float): Radius used for masking along qy (default None)
dH (float): Radius used for masking along H (default None)
dK (float): Radius used for masking along K (default None)
dL (float): Radius used for masking along L (default None)
spurionType (str): Either monochromator, analyser or both (default ‘both’)
maskInside (bool): If true, points inside is masked otherwise outside (default True)
- Returns
Boolean numpy array with shape equal to self.I.shape
- Return type
mask (list)
Note
If either dqx or dqy is None, utilizes the dH, dK, dL instead.
- difference(other, keys={'Ei', 'I', 'Monitor', '_A3', '_A4', '_binning', 'instrument', 'sample', 'scanParameters'})[source]¶
Return the difference between two data files by keys
- loadBinning(binning)[source]¶
Small function to check if current binning is equal to wanted binning and if not reloads to binning wanted
- loadMultiFLEXXData(fileLocation, calibrationFile=None)[source]¶
“Dedicated loader for MultiFLEXX data.
- Parameters
fileLocation (-) – Location of file
Kwargs:
calibrationFile (str): Location of calibration file (default None: uses shipped calibration)
- plotA4(binning=None)[source]¶
Method to plot the fitted A4 values of the normalization table
Kwargs:
binning (int): Binning for the corresponding normalization table (default self.binning or 8)
- Returns
Figure into which the A4 values are plotted
- Return type
fig (matplotlib figure)
- plotEf(binning=None)[source]¶
Method to plot the fitted Ef values of the normalization table
Kwargs:
binning (int): Binning for the corresponding normalization table (default self.binning or 8)
- Returns
Figure into which the Ef values are plotted
- Return type
fig (matplotlib figure)
- plotEfOverview(binning=None)[source]¶
Method to plot the fitted Ef values of the normalization table
Kwargs:
binning (int): Binning for the corresponding normalization table (default self.binning or 8)
- Returns
Figure into which the Ef values are plotted
- Return type
fig (matplotlib figure)
- plotNormalization(binning=None)[source]¶
Method to plot the fitted integrated intensities of the normalization table
Kwargs:
binning (int): Binning for the corresponding normalization table (default self.binning or 8)
- Returns
Figure into which the Ef values are plotted
- Return type
fig (matplotlib figure)
- saveHDF(saveFileName)[source]¶
Save current HDF file object into an HDF file.
- Parameters
saveFileName (-) – File name to be saved into.
- saveNXsqom(saveFileName)[source]¶
Save converted file into an NXsqom.
- Parameters
saveFileName (-) – File name to be saved into.
- updateCalibration(calibrationFile, overwrite=False)[source]¶
Update calibrations for the data file. Does not save the changes.
Args:
calibrationFile (string or list): calibration file, as generated from MJOLNIR.Geometry.Instrument or list of these.
Kwargs:
overwrite (bool): If true, previous binnings will be overwritten if new files contain same binning (default False)
Note
Changes performed by this method is not saved to disk. If this is wanted, use the saveNXsqom method.
- DataFile.createEmptyDataFile(A3, A4, Ei, sample, Monitor=50000, A3Off=0.0, A4Off=0.0, title='EmptyDataFileTitle', name='EmptyDataFile', temperature=None, electricField=None, magneticField=None, detectors=104, pixels=1024, normalizationFiles=None)[source]¶
Create an empty data file with a given sample and measurement parameters.
- Parameters
A3 (-) – Value(s) of measurement A3.
A4 (-) – Value(s) of measurement A4.
Ei (-) – Value(s) of measurement Ei.
sample (-) – Sample measured in data file.
Kwargs:
Monitor (int): Monitor count for datafile (default 50 000)
A3Off (float): Offset in A3 used in datafile (default 0.0)
A4Off (float): Offset in A4 used in datafile (default 0.0)
title (string): Title of datafile (default EmptyDataFileTitle)
name (string): name of datafile (default EmptyDataFile)
temperature (double): Sample temperature (default None)
electricField (double): Sample electricField (default None)
magneticField (double): Sample magneticField (default None)
detectors (int): Number of detectors in spectrometer (default 104)
pixels (int): Number of pixels/detector in spectrometer (default 1024)
normalizationFiles (list or string): List or string to normalization file (default None)
Warning
If no normalization file(s) is/are provided, the resulting data file cannot be converted to HKL!