Scattering kernels¶
Detectors¶
Counter (SCounter)¶
-
class
mcramp.scat.
SCounter
(idx=0, ctx=None, filename=None, **kwargs)[source]¶ Scattering kernel for Counter detector. Marks a neutron as detected for usage alongside the ‘SRescal’ component, and outputs a floating point number equal to the sum of the weights of detected neutrons.
- Parameters
- filenamestr or None
Name of the file to which neutron counts will be saved. No file saved if filename is None
Methods
Data
Returns the sum of detected neutron weights as a floating point number.
Plot
None
Save
Saves the sum of detected neutron weights as a npy file if the parameter filename is not None.
1D Detector (SDetector1D)¶
-
class
mcramp.scat.
SDetector1D
(binning=(0, 0, 0), restore_neutron=False, idx=0, var='energy', ctx=None, filename=None, **kwargs)[source]¶ Scattering kernel for a one axis monitor supporting a variety of axis variables.
- Parameters
- binning3-tuple of floats
Lower bin edge, bin size, and upper bin edge for axis variable
- restore_neutronBoolean
If False, neutron is terminated upon intersection with this component
- var{ “energy”, “theta”, “tof” }
Quantity which defines the axis along which neutron weights are histogrammed
- filenamestr or None
Name of the file to which spectrum will be saved. No file saved if filename is None
- Attributes
- binning
Methods
Data
Returns a 2-tuple of numpy arrays, the first containing the generated binning axis and the second containing the histogrammed neutron weights in each bin.
Plot
Displays a plot of histogrammed neutron weights as a function of neutron energy
Save
Saves the histogram axis and histogrammed neutron weights in each energy bin to numpy files “filename_X.dat” and “filename_Z.dat” if filename is not None.
2D Detector (SDetector2D)¶
-
class
mcramp.scat.
SDetector2D
(shape='', axis1_binning=(0, 0, 0), axis2_binning=(0, 0, 0), axis1_var='theta', axis2_var='tof', restore_neutron=False, idx=0, ctx=None, filename=None, logscale=False, **kwargs)[source]¶ Scattering kernel for a two axis monitor supporting a variety of axis variables.
- Parameters
- axis1_var, axis2_var{ “x”, “y”, “theta”, “alpha”, “tof”, “divX”, “divY” }
- Chooses the variables of each axis. These correspond to:
“x” : x coordinate of intersection point with the detector
“y” : y coordinate of intersection point with the detector
“theta” : Angle made by intersection point in xz plane with z axis, typically the in-plane scattering angle
“alpha” : Angle made by intersection point in yz plane with z axis, typically the out-of-plane scattering angle
“divX” : Horizontal divergence of neutron velocity
“divY” : Vertical divergence of neutron velocity
- axis1_binning3-tuple of floats
Lower bin edge, bin size, and upper bin edge for axis 1
- axis2_binning3-tuple of floats
Lower bin edge, bin size, and upper bin edge for axis 2
- restore_neutronBoolean
If False, neutron is terminated upon intersection with this component
- filenamestr or None
Name of the file to which histogram will be saved. No file saved if filename is None
- logscaleBoolean
If True, histogram intensity is plotted on a logarithmic scale
- Attributes
- axis1_binning
- axis2_binning
- sample_pos
Methods
Data
Returns a 3-tuple of numpy arrays, the first two containing the binning for axes 1 and 2, respectively, and the third containing the histogrammed neutron weights for each bin
Plot
Displays a plot of the two dimensional histogram of neutron weights along the chosen axes.
Save
Saves the binning along axes 1 and 2 and the histogrammed neutron weights for each bin as filename_X, filename_Y, and filename_Z, respectively, if filename is not None.
Optics¶
Guide (SGuide)¶
-
class
mcramp.scat.
SGuide
(w1=0, h1=0, w2=0, h2=0, l=0, R0=0, Qc=0, alpha=0, m=1, W=0, idx=0, ctx=0, max_bounces=50, **kwargs)[source]¶ Scattering kernel for tapered rectangular Guide. Recreates the functionality of the Guide component in McStas. The path of the neutron through the guide is numerically simulated and its weight adjusted according to the reflectivity function of the guide walls.
Intersection is taken as the point at which the neutron enters the guide and the guide geometry is taken to lie centered along the z axis.
- Parameters
- w1float
Width of the guide entrance in meters
- h1float
Height of the guide entrance in meters
- w2float
Width of the guide exit in meters
- h2float
Height of the guide exit in meters
- lfloat
Length of the guide in meters
- R0float
Low-angle reflectivity of the guide
- Qcfloat
Critical scattering vector of the guide
- alphafloat
Slope of the reflectivity
- mfloat
m-value of the guide coating
- Wfloat
Width of the guide supermirror cutoff
- max_bouncesfloat
Cutoff to prevent infinite scattering due to numerical error in the kernel
Methods
Data
None
Plot
None
Save
None
Disk chopper (SChopper)¶
-
class
mcramp.scat.
SChopper
(slit_width=0.0, radius=0.0, freq=0.0, n_slits=0, phase=0.0, jitter=0.0, idx=0, ctx=0, **kwargs)[source]¶ Scattering kernel for Chopper component. Replicates the functionality of the DiskChopper component in McStas. Neutrons with velocities that are not permitted by the chopper are terminated.
- Parameters
- slit_widthfloat
Width of the chopper slits in meters
- radiusfloat
Radius of the chopper disc in meters
- freqfloat
Angular frequency of the chopper in radians per second
- n_slitsfloat
Number of chopper slits
- phasefloat
Initial phase of the chopper in radians
- jitterfloat
Jitter in the chopper phase in radians
Methods
Data
None
Plot
None
Save
None
Monochromator (SMonochromator)¶
-
class
mcramp.scat.
SMonochromator
(slab_width=0.0, slab_height=0.0, gap=0.0, n_horizontal=1, n_vertical=1, mosaic_horizontal=0.0, mosaic_vertical=0.0, r0=1.0, d_spacing=0.0, radius_vertical=0.0, radius_horizontal=0.0, idx=0, ctx=0, **kwargs)[source]¶ Scattering kernel for general curved Monochromator. Recreates the functionality of the Monochromator_curved component in McStas. Reflection takes place from the local yz plane, higher order scattering and anisotropic gaussian mosaic is simulated.
- Parameters
- slab_widthfloat
Width of monochromator crystal slabs in meters
- slab_heightfloat
Height of monochromator crystal slabs in meters
- gapfloat
Gap between monochromator crystal slabs in meters
- n_horizontalfloat
Number of monochromator crystal slabs in the z direction
- n_verticalfloat
Number of monochromator crystal slabs in the y direction
- mosaic_horizontalfloat
Crystal mosaic in the z direction in arc minutes
- mosaic_verticalfloat
Crystal mosaic in the y direction in arc minutes
- r0float
Maximum reflectivity of the monochromator crystal
- d_spacingfloat
Lattice spacing of the monochromator crystal plane in AA
- radius_verticalfloat
Radius of curvature normal to the z direction in meters
- radius_horizontalfloat
Radius of curvature normal to the y direction in meters
Methods
Data
None
Plot
None
Save
None
Linear collimator (SLinearCollimator)¶
-
class
mcramp.scat.
SLinearCollimator
(length=0.0, divergence_H=0.0, divergence_V=0.0, transmission=1.0, idx=0, ctx=0, **kwargs)[source]¶ Scattering kernel for Linear Collimator component. Recreates the functionality of the Collimator_linear component in McStas. Neutrons with divergence exceeding that permitted by the collimator are terminated.
- Parameters
- lengthfloat
Flight path length of the collimator
- divergence_Hfloat
Maximum horizontal divergence accepted by the collimator
- divergence_Vfloat
Maximum vertical divergence accepted by the collimator
- transmissionfloat
Transmission coefficient of the collimator
Methods
Data
None
Plot
None
Save
None
Samples¶
Single line powder (SPowder1)¶
-
class
mcramp.scat.
SPowder1
(d_spacing=0.0, pack=0.0, vc=0.0, sigma_abs=0.0, multiplicity=0, DW=0.0, F2=0.0, d_phi=180.0, idx=0, ctx=None, **kwargs)[source]¶ Scattering kernel for single Bragg scattering powder sample. Recreates the functionality of the Powder1 component in McStas. If a neutron satisfies the Bragg condition, it is scattered at an angle twotheta into a random angle on the Debye-Scherrer cone. Phi focusing is implemented to improve simulation performance.
WARNING: Neutron weights are NOT verified to be physically accurate for the scattering from this component, however the lineshape is correct.
- Parameters
- d_spacingfloat
Lattice spacing corresponding to the Bragg powder line in AA
- packfloat in range [0, 1]
Packing fraction of the sample
- vcfloat
Volume of the sample unit cell in AA^3
- sigma_absfloat
Absorption cross section of the sample at 2200 m/s in barns
- multiplicityint
Multiplicity of the powder line
- DWfloat in range [0, 1]
Debye-Waller factor
- F2float
Structure factor of the powder line
- d_phifloat in range [0.0, 180.0]
Max angle around Debye-Scherrer cone into which neutrons are scattered
Methods
Data
None
Plot
None
Save
None