sas.sascalc.calculator package

Submodules

sas.sascalc.calculator.BaseComponent module

Provide base functionality for all model components

class sas.sascalc.calculator.BaseComponent.BaseComponent

Bases: object

Basic model component

Since version 0.5.0, basic operations are no longer supported.

calculate_ER()

Calculate effective radius

calculate_VR()

Calculate volume fraction ratio

clone()

Returns a new object identical to the current object

evalDistribution(qdist)

Evaluate a distribution of q-values.

  • For 1D, a numpy array is expected as input:

    evalDistribution(q)
    

    where q is a numpy array.

  • For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime], where 1D arrays,

    qx_prime = [ qx[0], qx[1], qx[2], ....]
    

    and

    qy_prime = [ qy[0], qy[1], qy[2], ....]
    

Then get

q = np.sqrt(qx_prime^2+qy_prime^2)

that is a qr in 1D array;

q = [q[0], q[1], q[2], ....]

Note

Due to 2D speed issue, no anisotropic scattering is supported for python models, thus C-models should have their own evalDistribution methods.

The method is then called the following way:

evalDistribution(q)

where q is a numpy array.

Parameters:

qdist – ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays

getDispParamList()

Return a list of all available parameters for the model

getParam(name)

Set the value of a model parameter :param name: name of the parameter

getParamList()

Return a list of all available parameters for the model

getParamListWithToken(token, member)

get Param List With Token

getParamWithToken(name, token, member)

get Param With Token

getProfile()

Get SLD profile

: return: (z, beta) where z is a list of depth of the transition points

beta is a list of the corresponding SLD values

is_fittable(par_name)

Check if a given parameter is fittable or not

Parameters:

par_name – the parameter name to check

run(x)

run 1d

runXY(x)

run 2d

setParam(name, value)

Set the value of a model parameter

Parameters:
  • name – name of the parameter

  • value – value of the parameter

setParamWithToken(name, value, token, member)

set Param With Token

set_dispersion(parameter, dispersion)

model dispersions

sas.sascalc.calculator.geni module

Compute scattering from a set of points. For 1-D scattering use Iq(q, x, y, z, sld, vol, is_avg)

sas.sascalc.calculator.geni.Iq(q, x, y, z, sld, vol, is_avg=False)

Computes 1D isotropic. Isotropic: Assumes all slds are real (no magnetic) Also assumes there is no polarization: No dependency on spin. All values must be numpy vectors of the correct size. Returns I(q)

sas.sascalc.calculator.geni.Iqxy(qx, qy, x, y, z, sld, vol, mx, my, mz, in_spin, out_spin, s_theta, s_phi, elements=None, is_elements=False)

Computes 2D anisotropic. in_spin and out_spin indicate portion of polarizer and analyzer transmission that are spin up. s_theta and s_phi are the polarization direction angles. All other values must be numpy vectors of the correct size. Returns I(qx, qy)

sas.sascalc.calculator.geni.center_of_mass(nuc_sl_data: MagSLD | OMF2SLD) list[float]

Calculate Center of Mass(CoM) of provided molecule using an SL profile

Parameters:

nuc_sl_data – A coordinate data object (MagSLD or OMF2SLD)

Returns:

A list of the calculated spatial center of mass, given as cartesian coordinates.

sas.sascalc.calculator.geni.create_beta_plot(q_x: ndarray, nuc_sl_data: MagSLD | OMF2SLD, form_factor: ndarray) ndarray

Carry out the computation of beta Q using provided & calculated data

Parameters:
  • q_x – The Q values where the beta will be calculated.

  • nuc_sl_data – A coordinate data object (MagSLD or OMF2SLD)

  • form_factor – The form factor calculated prior to applying the beta approximation.

Returns:

An array of form factor values with the beta approximation applied.

sas.sascalc.calculator.geni.element_transform(geometry, normals, rn_norm, volumes, qx, qy)

carries out fourier transform on elements

This function carries out the polyhedral transformation on the elements that make up the mesh. This algorithm only works on meshes where all the elements have the same number of faces, and each face has the same number of vertices. It is heavily based on the algorithm in:

An implementation of an efficient direct Fourier transform of polygonal areas and volumes. Brian B. Maranville. https://arxiv.org/abs/2104.08309

Parameters:
  • geometry (numpy.ndarray) – A 4D numpy array of the form elements x faces x vertices x vertex_coordinates.

  • normals (numpy.ndarray) – A 3D numpy array of the form elements x faces x normal_coordinates. The normals provided should be normalised.

  • rn_normals – A 2D numpy array of the form elements x faces containing the perpendicular distances from each face to the origin of the co-ordinate system.

  • volumes (nump.ndarray) – A 1D numpy array containing the volumes of the elements

  • qx (float) – The x component of the Q vector which represents the position in fourier space.

  • qy (float) – The y component of the Q vector which represents the position in fourier space.

Returns:

A 1D numpy array of the fourier transforms of each element at the given Q value

Return type:

numpy.ndarray

sas.sascalc.calculator.geni.f_of_q(q_x: ndarray, nuc_sl_data: MagSLD | OMF2SLD) ndarray

Compute the base F(Q) calculation based from the nuclear data.

Parameters:
  • q_x – The Q values where the beta will be calculated.

  • nuc_sl_data – A coordinate data object (MagSLD or OMF2SLD)

Returns:

An array of form factor data.

sas.sascalc.calculator.geni.njit(*args, **kw)
sas.sascalc.calculator.geni.orth(A, b)
sas.sascalc.calculator.geni.radius_of_gyration(nuc_sl_data: MagSLD | OMF2SLD) tuple[str, str, float]

Calculate parameters related to the radius of gyration using and SLD profile.

Parameters:

nuc_sl_data – A scattering length object for a series of atomic points in space

Returns:

A tuple of the string representation of the radius of gyration, Guinier slope, and Rg as a float.

sas.sascalc.calculator.gsc_model module

create plugin model from the Generic Scattering Calculator

sas.sascalc.calculator.gsc_model.generate_model(f_name: str, data_to_plot: ndarray, x_values: ndarray, f_q: list, mass: float) str

Generate an empirical model from the current plugin state

sas.sascalc.calculator.gsc_model.generate_plugin(f_name: str, data_to_plot: ndarray, x_values: ndarray, f_q: list, mass: float) tuple[str, Path]

Generate an empirical plugin model using calculated data.

Parameters:
  • f_name – The desired file name for the resulting model

  • data_to_plot – The plottable data

  • x_values – The x values, as a numpy array

  • f_q – The calculated F(Q)

  • mass – The mass associated with the Rg calculation

sas.sascalc.calculator.instrument module

This module is a small tool to allow user to control instrumental parameters

class sas.sascalc.calculator.instrument.Aperture

Bases: object

An object class that defines the aperture variables

set_sample_distance(distance=[])

Set the sample aperture distance

set_sample_size(size=[])

Set the sample aperture size

set_source_size(size=[])

Set the source aperture size

class sas.sascalc.calculator.instrument.Detector

Bases: object

An object class that defines the detector variables

set_distance(distance=[])

Set the detector distance

set_pix_size(size=[])

Set the detector pix_size

set_size(size=[])

Set the detector size

class sas.sascalc.calculator.instrument.Neutron

Bases: object

An object that defines the wavelength variables

get_band()

To get the wavelength band

get_default_spectrum()

get default spectrum

get_intensity()

To get the value of intensity

get_mass()

To get the neutron mass

get_ramdom_value()

To get the value of wave length

get_spectrum()

To get the wavelength spectrum

get_wavelength()

To get the value of wavelength

get_wavelength_spread()

To get the value of wavelength spread

plot_spectrum()

To plot the wavelength spactrum : requirement: matplotlib.pyplot

set_band(band=[])

To set the wavelength band

Parameters:

band – array of [min, max]

set_full_band()

set band to default value

set_intensity(intensity=368428)

Sets the intensity in counts/sec

set_mass(mass=1.67492729e-24)

Sets the wavelength

set_spectrum(spectrum)

Set spectrum

Parameters:

spectrum – numpy array

set_wavelength(wavelength=6.0)

Sets the wavelength

set_wavelength_spread(spread=0.125)

Sets the wavelength spread

setup_spectrum()

To set the wavelength spectrum, and intensity, assumes wavelength is already within the spectrum

class sas.sascalc.calculator.instrument.Sample

Bases: object

An object class that defines the sample variables

set_distance(distance=[])

Set the sample distance

set_size(size=[])

Set the sample size

set_thickness(thickness=0.0)

Set the sample thickness

class sas.sascalc.calculator.instrument.TOF

Bases: Neutron

TOF: make list of wavelength and wave length spreads

get_intensity_list()

get list of the intensity wrt wavelength_list

get_wave_list()

Get wavelength and wavelength_spread list

set_wave_list(wavelength=[])

Set wavelength list

Parameters:

wavelength – list of wavelengths

set_wave_spread_list(wavelength_spread=[])

Set wavelength_spread list

Parameters:

wavelength_spread – list of wavelength spreads

sas.sascalc.calculator.instrument.validate(value=None)

Check if the value is folat > 0.0

Return value:

True / False

sas.sascalc.calculator.kiessig_calculator module

This module is a small tool to allow user to quickly determine the size value in real space from the fringe width in q space.

class sas.sascalc.calculator.kiessig_calculator.KiessigThicknessCalculator

Bases: object

compute thickness from the fringe width of data

compute_thickness()

Calculate thickness.

Returns:

the thickness.

get_deltaq()

return deltaQ value in 1/A unit

get_thickness_unit()
Returns:

the thickness unit.

set_deltaq(dq=None)

Receive deltaQ value

Parameters:

dq – q fringe width in 1/A unit

sas.sascalc.calculator.resolution_calculator module

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

class sas.sascalc.calculator.resolution_calculator.ResolutionCalculator

Bases: object

compute resolution in 2D

compute(wavelength, wavelength_spread, qx_value, qy_value, coord='cartesian', tof=False)

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

compute_and_plot(qx_value, qy_value, qx_min, qx_max, qy_min, qy_max, coord='cartesian')

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(qx_value, qy_value, sigma_1, sigma_2, sigma_r, qx_min, qx_max, qy_min, qy_max, coord='cartesian', full_cal=True)

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(size=[], distance=0, phi=0, comp='radial')

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(s_distance, d_distance, wavelength, spread, phi, comp='radial', switch='on')

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(A_value, radius, distance, spread, phi, comp='radial', switch='on')

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(image)

Plot image using pyplot : image: 2d resolution image

: return plt: pylab object

reset_image()

Reset image to default (=[])

set_detector_pix_size(size)

Set detector pixel size

set_detector_size(size)

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

set_intensity(intensity)

Set intensity

set_neutron_mass(mass)

Set Neutron mass

set_sample2detector_distance(distance)

Set detector sample2detector_distance

: param distance: [distance, x_offset]

set_sample2sample_distance(distance)

Set detector sample_slit2sample_distance

: param distance: [distance, x_offset]

set_sample_aperture_size(size)

Set sample aperture size

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

set_source2sample_distance(distance)

Set detector source2sample_distance

: param distance: [distance, x_offset]

set_source_aperture_size(size)

Set source aperture size

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

set_spectrum(spectrum)

Set spectrum

set_wave(wavelength)

Set wavelength list or wavelength

set_wave_list(wavelength_list, wavelengthspread_list)

Set wavelength and its spread list

set_wave_spread(wavelength_spread)

Set wavelength spread or wavelength spread

set_wavelength(wavelength)

Set wavelength

set_wavelength_spread(wavelength_spread)

Set wavelength spread

setup_tof(wavelength, wavelength_spread)

Setup all parameters in instrument

: param ind: index of lambda, etc

sas.sascalc.calculator.sas_gen module

SAS generic computation and sld file readers.

Calculation checked by sampling from an ellipsoid and comparing Iq with the 1D, 2D oriented and 2D oriented magnetic analytical model from sasmodels.

class sas.sascalc.calculator.sas_gen.GenSAS

Bases: object

Generic SAS computation Model based on sld (n & m) arrays

calculate_Iq(qx, qy=None)

Evaluate the function :Param x: array of x-values :Param y: array of y-values :return: function value

evalDistribution(qdist)

Evaluate a distribution of q-values.

Parameters:

qdist – ndarray of scalar q-values (for 1D) or list [qx,qy] where qx,qy are 1D ndarrays (for 2D).

file_verification(nuc_data, mag_data)

Verifies that enabled files are compatible and can be combined

When the user wishes to combine two different files for nuclear (nuc_data) and magnetic (mag_data) data they must have the same 3D data points in real-space. This function decides whther verification of this is necessary and if so carries it out. In the case that the two files have the same real-space data points in different orders this function re-orders the stored data within the MagSLD objects to make them align. The full verification is only carried out once for any pair of loaded files.

getProfile()

Get SLD profile : return: sld_data

reset_transformations()

Set previous transformations as invalid

run(x=0.0)

Evaluate the model :param x: simple value :return: (I value)

runXY(x=0.0)

Evaluate the model :param x: simple value :return: I value :Use this runXY() for the computation

set_is_avg(is_avg=False)

Sets is_avg: [bool]

set_pixel_volumes(volume)

Set the volume of a pixel in (A^3) unit :Param volume: pixel volume [float]

set_rotations(uvw_to_UVW=Rotation.from_matrix(array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])), xyz_to_UVW=Rotation.from_matrix(array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])))

Set the rotations for the coordinate systems

The rotation matrices are given for the COMPONENTS of the vectors - that is xyz_to_UVW transforms the components of a vector from the xyz to UVW frame. This is the same rotation that transforms the basis vectors from UVW to xyz.

set_sld_data(sld_data=None)

Sets sld_data

transform_angles()
transform_magnetic_slds()
transform_positions()

Transform position data

class sas.sascalc.calculator.sas_gen.MagSLD(pos_x, pos_y, pos_z, sld_n=None, sld_mx=None, sld_my=None, sld_mz=None, vol_pix=None)

Bases: object

Magnetic SLD.

get_sldn()

Returns nuclear sld

pos_x = None
pos_y = None
pos_z = None
set_conect_lines(line_x: list[tuple[float, float]], line_y: list[tuple[float, float]], line_z: list[tuple[float, float]])

Set bonding line data if taken from pdb

set_elements(elements, are_elements_array)

Set elements for a non-rectangular grid

This sets element data for the object allowing non rectangular grids to be used. It sets a boolean flag in the class, stores the structure of the elements and sets the pixel type to ‘element’, and hence nodes and stepsize to None. Once this flag is enabled the sld data is expected to match up to elements as opposed to points.

Parameters:

elements (list) – The elements which describe the volume. This should be a list (of elements) of a list (of faces) of a list (of vertex indices). It may be a jagged array due to the freedom of the .vtk file format. Faces may not be triangulised.

set_nodes()

Set xnodes, ynodes, and znodes

set_pix_type(pix_type)

Set pixel type :Param pix_type: string, ‘pixel’ or ‘atom’

set_pixel_symbols(symbol='pixel')

Set pixel :Params pixel: str; pixel or atomic symbol, or array of strings

set_pixel_volumes(vol)

Set pixel volumes :Params pixel: str; pixel or atomic symbol, or array of strings

set_sldms(sld_mx, sld_my, sld_mz)

Sets mx, my, mz and abs(m).

set_sldn(sld_n, non_zero_mag_only=True)

Sets neutron SLD.

Warning: if sld_n is a scalar and attribute is_data is True, then only pixels with non-zero magnetism will be set by default. Use the argument non_zero_mag_only=False to change this

set_stepsize()

Set xtepsize, ystepsize, and zstepsize

sld_mx = None
sld_my = None
sld_mz = None
sld_n = None
class sas.sascalc.calculator.sas_gen.OMF2SLD

Bases: object

Convert OMFData to MAgData

get_omfdata()

Return all data

get_output()

Return output

remove_null_points(remove=False, recenter=False)

Removes any mx, my, and mz = 0 points

set_data(omfdata, shape='rectangular')

Set all data

class sas.sascalc.calculator.sas_gen.OMFData

Bases: object

OMF Data.

set_m(mx, my, mz)

Set the Mx, My, Mz values

class sas.sascalc.calculator.sas_gen.OMFReader

Bases: object

Class to load omf/ascii files (3 columns w/header).

ext = ['.omf', '.OMF']
read(path)

Load data file :param path: file path :return: x, y, z, sld_n, sld_mx, sld_my, sld_mz

type = ['OMF files (*.OMF, *.omf)|*.omf']
type_name = 'OMF ASCII'
class sas.sascalc.calculator.sas_gen.PDBReader

Bases: object

PDB reader class: limited for reading the lines starting with ‘ATOM’

ext = ['.pdb', '.PDB']
logger = <Logger sas_gen.PDBReader (WARNING)>
read(path)

Load data file

Parameters:

path – file path

Returns:

MagSLD

Raises:

RuntimeError – when the file can’t be opened

type = ['pdb files (*.PDB, *.pdb)|*.pdb']
type_name = 'PDB'
write(path, data)

Write

class sas.sascalc.calculator.sas_gen.SLDReader

Bases: object

SLD reader for text files.

format: 1 line of header - may give any information n lines of data points of the form:

4 columns: x y z sld 6 columns: x y z mx my mz 7 columns: x y z sld mx my mz 8 columns: x y z sld mx my mz volume

where all n lines have the same format.

ext = ['.sld', '.SLD', '.txt', '.TXT', '.*']
read(path)

Load data file :param path: file path :return MagSLD: x, y, z, sld_n, sld_mx, sld_my, sld_mz :raise RuntimeError: when the file can’t be loaded

type = ['sld files (*.SLD, *.sld)|*.sld', 'txt files (*.TXT, *.txt)|*.txt', 'all files (*.*)|*.*']
type_name = 'SLD ASCII'
write(path, data)

Write sld file :Param path: file path :Param data: MagSLD data object

class sas.sascalc.calculator.sas_gen.VTKReader

Bases: object

Class to read and process .vtk files

ext = ['.vtk', '.VTK']
get_faces(e, element_type)

Returns the faces of the elements

This function takes in the vertices and element type of an element and returns a list of faces - the orientation of the vertices in each face does not appear to be guaranteed in the vtk file format.

Parameters:
  • e (list of int) – The vertices (as indices) of the element in the order as given in the .vtk file specification.

  • element_type (int) – The element_type (as given in the file specification).

Returns:

A list of faces which is in turn a list of vertex indices, None if the element type is not supported

Return type:

list of list of int or None

get_vols(e, element_type, v)

Returns the volumes of the elements

This function takes in the vertices and element type of an element and returns the real space volume of each element.

Parameters:
  • e (list of int) – the vertices (as indexes) of the element in the order as given in the .vtk file specification.

  • element_type (int) – The element_type (as given in the file specification).

  • v (list) – A list of real space positions which are indexed by e.

Returns:

The volume of the element.

Return type:

float

load_attribute(lines, size)

Returns a single set of data - either point data or element data

Parameters:
  • lines (iterator) – The lines of the file - with the next lines being the first after the descriptor POINT_DATA or CELL_DATA.

  • size (int) – The expected length of each attribute - either the number of points or number of elements.

Returns:

a tuple containg both the data loaded - and the next lines in the file - which is None if the file is ended.

Return type:

2-tuple

load_data_attributes(lines, num_points, num_elements)

Extract the data attributes from the file

In the vtk file format the data attributes (POINT_DATA and CELL_DATA) are the last part of the file. This function processes that data and returns it.

Parameters:
  • lines (iterator) – The lines from the file - with the next line being either POINT_DATA or CELL_DATA.

  • num_points (int) – The number of points in the loaded file.

  • num_elements (int) – The number of elements in the loaded file.

Returns:

Either the loaded data attributes of None if loading failed. The data is a 2-tuple of lists of attributes - each attribute being a list of length 3 containing: the data as a list, the name of the attribute and the number of components of the attribute. The first list in the tuple is data associated with points, and the second is data associated with elements.

Return type:

2-tuple

read(path)

This function reads in a vtk file

Parameters:

path (string) – The filepath to be loaded

Returns:

A MagSLD instance containing the loaded data or None if loading failed

Return type:

MagSLD or None

type = ['vtk files (*.VTK, *.vtk)|*.vtk']
type_name = 'VTK'
unstructured_grid_read(lines, path)

Processes .vtk files in ASCII unstructured_grid format

Parameters:
  • lines (iterator) – an iterator with the (non-empty) lines of the file, starting one line after the DATASET marker

  • path (string) – The filepath to be loaded

Returns:

A MagSLD instance containing the loaded data or None if loading failed

Return type:

MagSLD or None

sas.sascalc.calculator.sas_gen.compare(obj, qx, qy=None, plot_points=False, theory=None)

Compare GenSAS calculator obj to old C and sasmodels versions.

theory is the I(q) value for the shape, if known.

sas.sascalc.calculator.sas_gen.decode(s)
sas.sascalc.calculator.sas_gen.demo()

Run a GenSAS operation demo.

sas.sascalc.calculator.sas_gen.demo_load()

Check loading of coordinate data.

sas.sascalc.calculator.sas_gen.demo_oommf()

Calculate theory from saved OOMMF magnetic data.

sas.sascalc.calculator.sas_gen.demo_pdb(is_avg=False)

Calculation I(q) for object in pdb file.

sas.sascalc.calculator.sas_gen.demo_save()

Check saving of coordinate data.

sas.sascalc.calculator.sas_gen.demo_shape(shape='ellip', samples=2000, nq=100, view=(60, 30, 0), qmax=0.5, use_2d=False, **kw)

Sample from shape with analytic model.

shape is one of the shapes from sasmodels/explore/realspace.py

samples is the number of sample points

view is the rotation angle for the shape

qmax is the max q value

use_2d produces a 2D shape rather

Remaining keywords are specific to the shape. See def build_SHAPE(…) in realspace.py for details.

sas.sascalc.calculator.sas_gen.mag2sld(mag, v_unit=None)

Convert magnetization to magnatic SLD sldm = Dm * mag where Dm = gamma * classical elec. radius/(2*Bohr magneton) Dm ~ 2.90636E8 [(A m)^(-1)]= 2.90636E-12 [to Ang^(-2)]

sas.sascalc.calculator.sas_gen.realspace_Iq(self, qx, qy)

Compute Iq for GenSAS object using sasmodels/explore/realspace.py

sas.sascalc.calculator.sas_gen.sas_gen_c(self, qx, qy=None)

C interface to sas_gen, for comparison to new python interface.

Note: this requires the old C implementation which may have already been removed from the repository.

sas.sascalc.calculator.sas_gen.set_axis_equal_3D(ax)

Set equal axes on a 3D plot.

sas.sascalc.calculator.sas_gen.test()

Check that the GenSAS can load coordinates and compute I(q).

sas.sascalc.calculator.sas_gen.transform_center(pos_x, pos_y, pos_z)

re-center :return: posx, posy, posz [arrays]

sas.sascalc.calculator.slit_length_calculator module

This module is a small tool to allow user to quickly determine the slit length value of data.

class sas.sascalc.calculator.slit_length_calculator.SlitlengthCalculator

Bases: object

compute slit length from SAXSess beam profile (1st col. Q , 2nd col. I , and 3rd col. dI.: don’t need the 3rd)

calculate_slit_length()

Calculate slit length.

Returns:

the slit length calculated value.

get_slit_length_unit()
Returns:

the slit length unit.

set_data(x=None, y=None)

Receive two vector x, y and prepare the slit calculator for computation.

Parameters:
  • x – array

  • y – array

Module contents