Instrument¶
Instrument object used to calculated analytic scattering coverage. |
|
Append wedge(s) to instrument. |
|
Recursive plotting routine. |
|
Method to initialize and perform analytical calculations of scattering quantities. |
|
Method for saving current file as XML in fileName. |
|
Generate CAMEA XML file to be used as instrument file. |
|
Method to generate look-up tables for normalization. |
|
Convert McStas simulation to h5 format. |
Instrument Object and Methods¶
- class Instrument.Instrument(position=(0, 0, 0), wedges=[], fileName='', **kwargs)[source]¶
Instrument object used to calculated analytic scattering coverage. Based on the GeometryConcept object it contains all needed information about the setup used in further calculations.
Kwargs:
position (float 3d): Position of the instrument always at origin (default (0,0,0))
wedges (list of wedges or single wedge): Wedge or list of wedges which the instrument consists of (default empty)
fileName (string): Filename of xml file (ending in xml). To load binary files use self.load(filename).
- Raises
- AttributeError –
- __init__(position=(0, 0, 0), wedges=[], fileName='', **kwargs)[source]¶
Instrument object used to calculated analytic scattering coverage. Based on the GeometryConcept object it contains all needed information about the setup used in further calculations.
Kwargs:
position (float 3d): Position of the instrument always at origin (default (0,0,0))
wedges (list of wedges or single wedge): Wedge or list of wedges which the instrument consists of (default empty)
fileName (string): Filename of xml file (ending in xml). To load binary files use self.load(filename).
- Raises
- AttributeError –
- append(wedge)[source]¶
Append wedge(s) to instrument.
Args
wedge (Wedge(s)): Single wedge or list of wedges
- generateCAMEAXML(fileName)[source]¶
Generate CAMEA XML file to be used as instrument file.
- Parameters
fileName (-) – Name of file to be saved (required)
- generateCalibration(Vanadiumdatafile, A4datafile=False, savelocation='calibration/', tables=['Single', 'PrismaticLowDefinition', 'PrismaticHighDefinition'], plot=False, mask=True, adaptiveBinning=False, ignoreTubes=None, sample='V', sampleMass=None, sampleDebyeWallerFactor=1.0, formulaUnitsPerUnitCell=1.0, sampleIncoherent=5.08)[source]¶
Method to generate look-up tables for normalization. Saves calibration file(s) as ‘Calibration_Np.calib’, where Np is the number of pixels.
Generates 4 different tables:
Prismatic High Definition (8 pixels/energy or 64 pixels/detector)
Prismatic Low Definition (3 pixels/energy or 24 pixels/detector)
Single (1 pixel/energy or 8 pixels/detector)
Number (integer)
- Parameters
Vanadiumdatafile (-) – String to single data file used for normalization, Vanadium Ei scan (required).
Kwargs:
A4datafile (string): String to single data file used for normalization, AlO A4 scan (default False).
savelocation (string): String to save location folder (calibration)
tables (list): List of needed conversion tables (Default: [‘Single’,’PrismaticLowDefinition’,’PrismaticHighDefinition’], increasing number of pixels).
plot (boolean): Set to True if pictures of all fit are to be stored in savelocation
mask (boolean): If True the lower 100 pixels are set to 0
adaptiveBinning (boolean): If true pixel bins are assigned to give same Gaussian area of intensity for all pixels (default False)
ignoreTubes (list of ints): List containing tubes to be ignored in fitting (default [])
sample (string): Chemical composition of sample used for normalization (default ‘V’)
sampleMass (float): Mass of normalization sample (default None)
sampleDebyeWallerFactor (float): Correction of normalization data with Debye-Waller factor (default 1.0)
formulaUnitsPerUnitCell (float): Numer of formal units in normalization sample per unit cell (default 1.0)
sampleIncoherent (float): Incoherent strength of sample (default 5.08)
Warning
At the moment, the active detector area is defined by NumberOfSigmas (currently 3) times the Gaussian width of Vanadium peaks.
When a sample mass is provided, the normalization tables are per default rescaled with Vanadium unless default parameters are overwritten.
- Instrument.convertToHDF(fileName, title, sample, fname, CalibrationFile=None, pixels=1024, cell=[5, 5, 5, 90, 90, 90], factor=10000, detectors=104, ub=None, plane_vector_1=None, plane_vector_2=None, plane_normal=None, rotation_angle_zero=0.0, polar_angle_offset=0.0)[source]¶
Convert McStas simulation to h5 format.
- Parameters
fileName (-) – File name of created file (‘hdf’)
title (-) – Title of HdF file
sample (-) – Name of sample
fname (-) – Location folder of McStas Data (must end with ‘/’ in linux/mac)
Kwargs:
CalibrationFile (str or list of str): Location of calibration file(s) wanted in HdF file (default None)
pixels (int): Number of pixels on detectors (default 1024)
cell (list): Cell parameters passed into the hdf file (default [5,5,5,90,90,90])
factor (float): Overall scale factor for intensity