snsdata  SNS Data¶
Liquids 
Loader for reduced data from the SNS Liquids instrument. 
Magnetic 
Loader for reduced data from the SNS Magnetic instrument. 
QRL_to_data 
Convert data to T, L, R 
SNSData 

TOF_to_data 
Convert TOF data to neutron probe. 
boltzmann_feather 
Return expected intensity as a function of wavelength given the TOF feather range and the total number of counts. 
has_columns 

intensity_from_spline 

load 
Return a probe for SNS data. 
parse_sns_file 
Parse SNS reduced data, returning header and data. 
write_file 
Save probe as SNS reduced file. 
SNS data loaders
The following instruments are defined:
Liquids, Magnetic
These are resolution.Pulsed
classes tuned with
default instrument parameters and loaders for reduced SNS data.
See resolution
for details.

class
refl1d.snsdata.
Liquids
(**kw)[source]¶ Bases:
refl1d.snsdata.SNSData
,refl1d.instrument.Pulsed
Loader for reduced data from the SNS Liquids instrument.

T
= None¶

TOF_range
= (6000, 60000)¶

Thi
= 90¶

Tlo
= 90¶

calc_dT
(T, slits, **kw)¶

calc_slits
(**kw)¶ Determines slit openings from measurement pattern.
If slits are fixed simply return the same slits for every angle, otherwise use an opening range [Tlo, Thi] and the value of the slits at the start of the opening to define the slits. Slits below Tlo and above Thi can be specified separately.
T incident angle Tlo, Thi angle range over which slits are opening slits_at_Tlo openings at the start of the range, or fixed opening slits_below, slits_above openings below and above the range
Use fixed_slits is available, otherwise use opening slits.

dLoL
= 0.02¶

d_moderator
= 14.85¶

d_s1
= 2086.0¶

d_s2
= 230.0¶

classmethod
defaults
()¶ Return default instrument properties as a printable string.

feather
= array([[ 2.02555 , 2.29927 , 2.57299 , 2.87409 , 3.22993 , 3.58577 , 4.07847 , 4.5438 , 5.11861 , 5.7208 , 6.37774 , 7.19891 , 8.04745 , 9.06022 , 10.1825 , 11.4142 , 12.8102 , 14.3431 ], [20.6369 , 23.6943 , 23.6943 , 21.1146 , 15.5732 , 12.8981 , 9.4586 , 6.59236 , 4.68153 , 3.05732 , 1.91083 , 1.24204 , 0.955414, 0.573248, 0.477707, 0.382166, 0.191083, 0.286624]])¶

fixed_slits
= None¶

instrument
= 'Liquids'¶

load
(filename, **kw)¶

magnetic_probe
(Aguide=270.0, shared_beam=True, **kw)¶ Simulate a polarized measurement probe.
Returns a probe with Q, angle, wavelength and the associated uncertainties, but not any data.
Guide field angle Aguide can be specified, as well as keyword arguments for the geometry of the probe cross sections such as slit settings slits and T to define the angular divergence and dLoL to define the wavelength resolution.

probe
(**kw)¶ Simulate a measurement probe.
Returns a probe with Q, angle, wavelength and the associated uncertainties, but not any data.
You can override instrument parameters using key=value. In particular, slit settings slits and T define the angular divergence and dLoL defines the wavelength resolution.

radiation
= 'neutron'¶

resolution
(L, dL, **kw)¶ Return the resolution of the measurement. Needs T, L, dL specified as keywords.

sample_broadening
= 0¶

sample_width
= 10000000000.0¶

simulate
(sample, uncertainty=1, **kw)¶ Simulate a run with a particular sample.
Parameters:  sample : Stack
Reflectometry model
 T : [float]  °
List of angles to be measured, such as [0.15, 0.4, 1, 2].
 slits : [float] or [(float, float)]  mm
Slit settings for each angle.
 uncertainty = 1 : float or [float]  %
Incident intensity is set so that the median dR/R is equal to uncertainty, where R is the idealized reflectivity of the sample.
 dLoL = 0.02: float
Wavelength resolution
 normalize = True : boolean
Whether to normalize the intensities
 theta_offset = 0 : float  °
Sample alignment error
 background = 0 : float
Background counts per incident neutron (background is assumed to be independent of measurement geometry).
 back_reflectivity = False : boolean
Whether beam travels through incident medium or through substrate.
 back_absorption = 1 : float
Absorption factor for beam traveling through substrate. Only needed for back reflectivity measurements.

slits
= None¶

slits_above
= None¶

slits_at_Tlo
= None¶

slits_below
= None¶

wavelength
= (2.0, 15.0)¶


class
refl1d.snsdata.
Magnetic
(**kw)[source]¶ Bases:
refl1d.snsdata.SNSData
,refl1d.instrument.Pulsed
Loader for reduced data from the SNS Magnetic instrument.

T
= None¶

TOF_range
= (0, inf)¶

Thi
= 90¶

Tlo
= 90¶

calc_dT
(T, slits, **kw)¶

calc_slits
(**kw)¶ Determines slit openings from measurement pattern.
If slits are fixed simply return the same slits for every angle, otherwise use an opening range [Tlo, Thi] and the value of the slits at the start of the opening to define the slits. Slits below Tlo and above Thi can be specified separately.
T incident angle Tlo, Thi angle range over which slits are opening slits_at_Tlo openings at the start of the range, or fixed opening slits_below, slits_above openings below and above the range
Use fixed_slits is available, otherwise use opening slits.

dLoL
= 0.02¶

d_s1
= 190.5¶

d_s2
= 35.56¶

classmethod
defaults
()¶ Return default instrument properties as a printable string.

fixed_slits
= None¶

instrument
= 'Magnetic'¶

load
(filename, **kw)¶

magnetic_probe
(Aguide=270.0, shared_beam=True, **kw)¶ Simulate a polarized measurement probe.
Returns a probe with Q, angle, wavelength and the associated uncertainties, but not any data.
Guide field angle Aguide can be specified, as well as keyword arguments for the geometry of the probe cross sections such as slit settings slits and T to define the angular divergence and dLoL to define the wavelength resolution.

probe
(**kw)¶ Simulate a measurement probe.
Returns a probe with Q, angle, wavelength and the associated uncertainties, but not any data.
You can override instrument parameters using key=value. In particular, slit settings slits and T define the angular divergence and dLoL defines the wavelength resolution.

radiation
= 'neutron'¶

resolution
(L, dL, **kw)¶ Return the resolution of the measurement. Needs T, L, dL specified as keywords.

sample_broadening
= 0¶

sample_width
= 10000000000.0¶

simulate
(sample, uncertainty=1, **kw)¶ Simulate a run with a particular sample.
Parameters:  sample : Stack
Reflectometry model
 T : [float]  °
List of angles to be measured, such as [0.15, 0.4, 1, 2].
 slits : [float] or [(float, float)]  mm
Slit settings for each angle.
 uncertainty = 1 : float or [float]  %
Incident intensity is set so that the median dR/R is equal to uncertainty, where R is the idealized reflectivity of the sample.
 dLoL = 0.02: float
Wavelength resolution
 normalize = True : boolean
Whether to normalize the intensities
 theta_offset = 0 : float  °
Sample alignment error
 background = 0 : float
Background counts per incident neutron (background is assumed to be independent of measurement geometry).
 back_reflectivity = False : boolean
Whether beam travels through incident medium or through substrate.
 back_absorption = 1 : float
Absorption factor for beam traveling through substrate. Only needed for back reflectivity measurements.

slits
= None¶

slits_above
= None¶

slits_at_Tlo
= None¶

slits_below
= None¶

wavelength
= (1.8, 14)¶


refl1d.snsdata.
TOF_to_data
(instrument, header, data)[source]¶ Convert TOF data to neutron probe.
Wavelength is set from the average of the times at the edges of the bins, not the average of the wavelengths. Wavelength resolution is set assuming the wavelength at the edges of the bins defines the full width at half maximum.
The correct answer is to look at the wavelength distribution within the bin including effects of pulse width and intensity as a function wavelength and use that distribution, or a gaussian approximation thereof, when computing the resolution effects.

refl1d.snsdata.
boltzmann_feather
(L, counts=100000, range=None)[source]¶ Return expected intensity as a function of wavelength given the TOF feather range and the total number of counts.
TOF feather is approximately a boltzmann distribution with gaussian convolution. The following looks pretty enough; don’t know how well it corresponds to the actual SNS feather.