resolution_calculator

sans.calculator.resolution_calculator

This object is a small tool to allow user to quickly determine the variance in q from the instrumental parameters.

class sans.calculator.resolution_calculator.ResolutionCalculator

Bases: object

compute resolution in 2D

__class__

alias of type

__delattr__

x.__delattr__(‘name’) <==> del x.name

__dict__ = <dictproxy object at 0x0205AC50>
__getattribute__

x.__getattribute__(‘name’) <==> x.name

__hash__

x.__hash__() <==> hash(x)

__init__()
__module__ = 'sans.calculator.resolution_calculator'
static __new__(S, ...) → a new object with type S, a subtype of T
__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

x.__repr__() <==> repr(x)

__setattr__

x.__setattr__(‘name’, value) <==> x.name = value

__str__

x.__str__() <==> str(x)

__weakref__

list of weak references to the object (if defined)

_atan_phi()

Find the angle phi of q on the detector plane for qx_value, qy_value given : qx_value: x component of q : qy_value: y component of q

: return phi: the azimuthal angle of q on x-y plane

_cal_A_value()

Calculate A value for gravity

: s_distance: source to sample distance : d_distance: sample to detector distance

_gaussian1d()

Calculate 1D Gaussian distribution : value: value : mean: mean value : sigma: variance

: return: gaussian (value)

_gaussian2d()

Calculate 2D Gaussian distribution : x_val: x value : y_val: y value : x0_val: mean value in x-axis : y0_val: mean value in y-axis : sigma_x: variance in x-direction : sigma_y: variance in y-direction

: return: gaussian (value)

_gaussian2d_polar()

Calculate 2D Gaussian distribution for polar coodinate : x_val: x value : y_val: y value : x0_val: mean value in x-axis : y0_val: mean value in y-axis : sigma_x: variance in r-direction : sigma_y: variance in phi-direction : sigma_r: wavelength variance in r-direction

: return: gaussian (value)

_get_beamcenter_drop()

Get the beam center drop (delta y) in y diection due to gravity

Return delta y:the beam center drop in cm
_get_beamcenter_position()
Parameters:
  • num_x – number of pixel in x-direction
  • num_y – number of pixel in y-direction
  • offset – detector offset in x-direction in pix number
Returns:

pix number; pos_x, pos_y in pix index

_get_detector_qxqy_pixels()

Get the pixel positions of the detector in the qx_value-qy_value space

_get_polar_value()

Find qr_value and phi from qx_value and qy_value values

: return qr_value, phi

_get_qx()
Parameters:
  • dx_size – x-distance from beam center [cm]
  • det_dist – sample to detector distance [cm]
Returns:

q-value at the given position

_rotate_z()

Rotate x-y cordinate around z-axis by theta : x_value: numpy array of x values : y_value: numpy array of y values : theta: angle to rotate by in rad

Returns:x_prime, y-prime
_within_detector_range()

check if qvalues are within detector range

compute()

Compute the Q resoltuion in || and + direction of 2D : qx_value: x component of q : qy_value: y component of q

compute_and_plot()

Compute the resolution : qx_value: x component of q : qy_value: y component of q

get_all_instrument_params()

Get all instrumental parameters

get_default_spectrum()

Get default_spectrum

get_detector_pix_size()

Get detector pixel size

get_detector_qrange()

get max detector q ranges

: return: qx_min, qx_max, qy_min, qy_max tuple

get_detector_size()

Get detector size

get_image()

Get the resolution in polar coordinate ready to plot : qx_value: qx_value value : qy_value: qy_value value : sigma_1: variance in r direction : sigma_2: variance in phi direction : coord: coordinate system of image, ‘polar’ or ‘cartesian’

get_intensity()

Get intensity

get_intensity_list()

Set wavelength spread

get_neutron_mass()

Get Neutron mass

get_sample2detector_distance()

Get detector sample2detector_distance

get_sample2sample_distance()

Get detector sampleslitsample_distance

get_sample_aperture_size()

Get sample aperture size

get_source2sample_distance()

Get detector source2sample_distance

get_source_aperture_size()

Get source aperture size

get_spectrum()

Get _spectrum

get_variance()

Get the variance when the slit/pinhole size is given : size: list that can be one(diameter for circular)

or two components(lengths for rectangular)

: distance: [z, x] where z along the incident beam, x // qx_value : comp: direction of the sigma; can be ‘phi’, ‘y’, ‘x’, and ‘radial’

: return variance: sigma^2

get_variance_gravity()

Get the variance from gravity when the wavelength spread is given

: s_distance: source to sample distance : d_distance: sample to detector distance : wavelength: wavelength : spread: wavelength spread (ratio) : comp: direction of the sigma; can be ‘phi’, ‘y’, ‘x’, and ‘radial’

: return variance: sigma^2

get_variance_wave()

Get the variance when the wavelength spread is given

: radius: the radial distance from the beam center to the pix of q : distance: sample to detector distance : spread: wavelength spread (ratio) : comp: direction of the sigma; can be ‘phi’, ‘y’, ‘x’, and ‘radial’

: return variance: sigma^2 for 2d, sigma^2 for 1d [tuple]

get_wave_list()

Set wavelength spread

get_wavelength()

Get wavelength

get_wavelength_spread()

Get wavelength spread

plot_image()

Plot image using pyplot : image: 2d resolution image

: return plt: pylab object

reset_image()

Reset image to default (=[])

set_detector_pix_size()

Set detector pixel size

set_detector_size()

Set detector size in number of pixels : param size: [pixel_nums] or [x_pix_num, yx_pix_num]

set_intensity()

Set intensity

set_neutron_mass()

Set Neutron mass

set_sample2detector_distance()

Set detector sample2detector_distance

: param distance: [distance, x_offset]

set_sample2sample_distance()

Set detector sample_slit2sample_distance

: param distance: [distance, x_offset]

set_sample_aperture_size()

Set sample aperture size

: param size: [dia_value] or [xheight_value, yheight_value]

set_source2sample_distance()

Set detector source2sample_distance

: param distance: [distance, x_offset]

set_source_aperture_size()

Set source aperture size

: param size: [dia_value] or [x_value, y_value]

set_spectrum()

Set spectrum

set_wave()

Set wavelength list or wavelength

set_wave_list()

Set wavelength and its spread list

set_wave_spread()

Set wavelength spread or wavelength spread

set_wavelength()

Set wavelength

set_wavelength_spread()

Set wavelength spread

setup_tof()

Setup all parameters in instrument

: param ind: index of lambda, etc

Table Of Contents

Previous topic

kiessig_calculator

Next topic

slit_length_calculator

This Page