sgt package

Submodules

Module contents

Higher-level interface for manipulation of scattering geometry.

class sgt.PlanarRectangularDetector(px_numbers: tuple[int, int], px_sizes: tuple[float, float], center_offset: tuple[float, float], rotation_matrix: ndarray[tuple[int, ...], dtype[float64]], sample_to_detector_distance: float)[source]

Bases: object

Calculates coordinates for a planar rectangular detector.

This class is designed to be immutable. All calculations are done upon instantiation based on the parameters given to the initializer. If any of the parameters need to be modified, create a new instance.

u

Horizontal (u) coordinates of each pixel in the detector coordinate system

v

Vertical (v) coordinates of each pixel in the detector coordinate system

eu

Basis vector along the u axis in the lab coordinate system

ev

Basis vector along the v axis in the lab coordinate system

en

Basis vector along the n axis in the lab coordinate system

x

x coordinates of each pixel in the lab coordinate system

y

y coordinates of each pixel in the lab coordinate system

z

z coordinates of each pixel in the lab coordinate system

xyz_center

Coordinate of the detector center point in the lab coordinate system

shortest_distance

The shortest distance from the sample to the detector plane

pixel_solid_angle_coverage_correction_factors

correction factors for each pixel accounting for pixel solid angle coverage

class sgt.ReciprocalGeometry(x: ndarray[tuple[int, ...], dtype[float64]], y: ndarray[tuple[int, ...], dtype[float64]], z: ndarray[tuple[int, ...], dtype[float64]], wavelength: float)[source]

Bases: object

Calculates q vector.

This class is designed to be immutable. All calculations are done upon instantiation based on the parameters given to the initializer. If any of the parameters need to be modified, create a new instance.

qx

x component of the scattering vector q

qy

y component of the scattering vector q

qz

z component of the scattering vector q

qabs

absolute value of the scattering vector q

azimuthal_angle_rad

Azimuthal angle in radians (= atan(qy/qx))

wavelength

wavelength of the incident beam

class sgt.PixelSorter(bin_edges: ndarray[tuple[int, ...], dtype[float64]], binning_coords: ndarray[tuple[int, ...], dtype[float64]], masked_pixels: ndarray[tuple[int, ...], dtype[any]])[source]

Bases: object

Circular averager

bin_edges

Edges of each bin

binning_coords

Coordinates (positions) used for binning

masked_pixels

Truth array or index array that specifies the pixels to mask

bin_midpoints

Midpoints of bin edges

indices_in_bin

Binning index array

bin_counts

Pixel counts in each bin

bin(intensities: ndarray[tuple[int, ...], dtype[float64]], errors: ndarray[tuple[int, ...], dtype[float64]]) tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]

Bin intensity & error using binning indices

Parameters:
  • intensities – Intensity array

  • errors – Errors of intensity. Can be zero-filled array in case the error output is not necessary

Returns:

Binned arrays of intensity and error

sgt.load_geometry_from_dict(d: dict) tuple[PlanarRectangularDetector, ReciprocalGeometry][source]