neutronpy.fileio.load_instrument

neutronpy.fileio.load_instrument(filename, filetype='ascii')[source]

Creates Instrument class using input par and cfg files.

Parameters:
filename : str or tuple

Path to the instrument file. If filetype is ‘parcfg’ then two files should be provided in order of ‘.par’, ‘.cfg’ as a tuple.

filetype : str, optional

Default: ‘ascii’. Instrument file formats ‘ascii’, ‘parcfg’, ‘hdf5’, or ‘taz’ (xml) are available. ‘ascii’, ‘hdf5’ and ‘taz’ in format generated by load_instrument. ‘taz’ format compatible with Takin software. See Notes for information about ‘parcfg’ format details.

Returns:
setup : obj

Returns Instrument class object based on the information in the input files.

Notes

The format of the parfile consists of two tab-separated columns, the first column containing the values and the second column containing the value names preceded by a ‘%’ character:

Type Name Description
float %DM Monochromater d-spacing (Ang^-1)
float %DA Analyzer d-spacing (Ang^-1)
float %ETAM Monochromator mosaic (arc min)
float %ETAA Analyzer mosaic (arc min)
float %ETAS Sample mosaic (arc min)
int %SM Scattering direction of monochromator (+1 clockwise, -1 counterclockwise)
int %SS Scattering direction of sample (+1 clockwise, -1 counterclockwise)
int %SA Scattering direction of analyzer (+1 clockwise, -1 counterclockwise)
float %K Fixed wavevector (incident or final) of neutrons
float %ALPHA1 Horizontal collimation of in-pile collimator (arc min)
float %ALPHA2 Horizontal collimation of collimator between monochromator and sample (arc min)
float %ALPHA3 Horizontal collimation of collimator between sample and analyzer (arc min)
float %ALPHA4 Horizontal collimation of collimator between analyzer and detector (arc min)
float %BETA1 Vertical collimation of in-pile collimator (arc min)
float %BETA2 Vertical collimation of collimator between monochromator and sample (arc min)
float %BETA3 Vertical collimation of collimator between sample and analyzer (arc min)
float %BETA4 Vertical collimation of collimator between analyzer and detector (arc min)
float %AS Sample lattice constant a (Ang)
float %BS Sample lattice constant b (Ang)
float %CS Sample lattice constant c (Ang)
float %AA Sample lattice angle alpha (deg)
float %BB Sample lattice angle beta (deg)
float %CC Sample lattice angle gamma (deg)
float %AX Sample orientation vector u_x (r.l.u.)
float %AY Sample orientation vector u_y (r.l.u.)
float %AZ Sample orientation vector u_z (r.l.u.)
float %BX Sample orientation vector v_x (r.l.u.)
float %BY Sample orientation vector v_y (r.l.u.)
float %BZ Sample orientation vector v_z (r.l.u.)
float %QX  
float %QY  
float %QZ  
float %EN  
float %dqx  
float %dqy  
float %dqz  
float %de  
float %gh  
float %gk  
float %gl  
float %gmod  

The format of the cfgfile (containing values necessary for Popovici type calculations) can consists of a single column of values, or two tab-separated columns, the first column containing the values and the second column containing the value descriptions preceded by a ‘%’ character. The values MUST be in the following order:

Type Description
float =0 for circular source, =1 for rectangular source
float width/diameter of the source (cm)
float height/diameter of the source (cm)
float =0 No Guide, =1 for Guide
float horizontal guide divergence (minutes/Angs)
float vertical guide divergence (minutes/Angs)
float =0 for cylindrical sample, =1 for cuboid sample
float sample width/diameter perp. to Q (cm)
float sample width/diameter along Q (cm)
float sample height (cm)
float =0 for circular detector, =1 for rectangular detector
float width/diameter of the detector (cm)
float height/diameter of the detector (cm)
float thickness of monochromator (cm)
float width of monochromator (cm)
float height of monochromator (cm)
float thickness of analyser (cm)
float width of analyser (cm)
float height of analyser (cm)
float distance between source and monochromator (cm)
float distance between monochromator and sample (cm)
float distance between sample and analyser (cm)
float distance between analyser and detector (cm)
float horizontal curvature of monochromator 1/radius (cm-1)
float vertical curvature of monochromator (cm-1) was 0.013
float horizontal curvature of analyser (cm-1) was 0.078
float vertical curvature of analyser (cm-1)
float distance monochromator-monitor
float width monitor (cm)
float height monitor (cm)