sasdata.data_util.averaging module

This module contains various data processors used by Sasview’s slicers.

class sasdata.data_util.averaging.Boxavg(qx_range: tuple[float, float] = (0.0, 0.0), qy_range: tuple[float, float] = (0.0, 0.0))

Bases: Boxsum

Compute the average intensity within a rectangular Region Of Interest.

class sasdata.data_util.averaging.Boxcut(qx_range: tuple[float, float] = (0.0, 0.0), qy_range: tuple[float, float] = (0.0, 0.0))

Bases: CartesianROI

Find a rectangular 2D region of interest.

class sasdata.data_util.averaging.Boxsum(qx_range: tuple[float, float] = (0.0, 0.0), qy_range: tuple[float, float] = (0.0, 0.0))

Bases: CartesianROI

Compute the sum of the intensity within a rectangular Region Of Interest.

class sasdata.data_util.averaging.CircularAverage(r_range: tuple[float, float], center: tuple[float, float] = (0.0, 0.0), nbins: int = 100, base: float | None = None)

Bases: PolarROI

Calculate I(|Q|) by circularly averaging 2D data between 2 radial limits.

This class is initialised by specifying lower and upper limits on the magnitude of Q values to consider during the averaging, though currently SasView always calls this class using the full range of data. When called, this class is supplied with a Data2D object. It returns a Data1D object where intensity is given as a function of Q only.

class sasdata.data_util.averaging.Ring(r_range: tuple[float, float], center: tuple[float, float] = (0.0, 0.0), nbins: int = 100, base: float | None = None)

Bases: PolarROI

Calculate I(φ) by radially averaging 2D data between 2 radial limits.

This class is initialised by specifying lower and upper limits on the magnitude of Q values to consider during the averaging. When called, this class is supplied with a Data2D object. It returns a Data1D object. This Data1D object gives intensity as a function of the angle from the positive x-axis, φ, only.

class sasdata.data_util.averaging.Ringcut(r_range: tuple[float, float] = (0.0, 0.0), phi_range: tuple[float, float] = (0.0, 6.283185307179586), center: tuple[float, float] = (0.0, 0.0))

Bases: PolarROI

Defines a ring on a 2D data set. The ring is defined by r_min, r_max, and the position of the center of the ring.

The data returned is the region inside the ring

Phi_min and phi_max should be defined between 0 and 2*pi in anti-clockwise starting from the x- axis on the left-hand side

class sasdata.data_util.averaging.SectorPhi(r_min: float, r_max: float, phi_min: float = 0.0, phi_max: float = 6.283185307179586, center: tuple[float, float] = (0.0, 0.0), nbins: int = 100)

Bases: WedgePhi

Sector average as a function of phi. I(phi) is return and the data is averaged over Q.

A sector is defined by r_min, r_max, phi_min, phi_max. The number of bin in phi also has to be defined.

class sasdata.data_util.averaging.SectorQ(r_range: tuple[float, float], phi_range: tuple[float, float] = (0.0, 6.283185307179586), center: tuple[float, float] = (0.0, 0.0), nbins: int = 100, fold: bool = True, base: float | None = None)

Bases: PolarROI

Project I(Q, φ) data onto I(Q) within a region defined by Cartesian limits.

The projection is computed by averaging together datapoints with the same angle φ (so long as they are within the ROI), measured anticlockwise from the positive x-axis.

This class is initialised by specifying lower and upper limits on both the magnitude of Q and the angle φ. These four parameters specify the primary Region Of Interest, however there is a secondary ROI with the same |Q| values on the opposite side of the origin (φ + π). How this secondary ROI is treated depends on the value of the fold parameter. If fold is set to True, data on opposite sides of the origin are averaged together and the results are plotted against positive values of Q. If fold is set to False, the data from the two regions are graphed separeately, with the secondary ROI data labelled using negative Q values.

When called, this class is supplied with a Data2D object. It returns a Data1D object where intensity is given as a function of Q only.

class sasdata.data_util.averaging.Sectorcut(phi_range: tuple[float, float] = (0.0, 3.141592653589793), center: tuple[float, float] = (0.0, 0.0))

Bases: PolarROI

Defines a sector (major + minor) region on a 2D data set. The sector is defined by phi_min, phi_max, where phi_min and phi_max are defined by the right and left lines wrt central line.

Phi_min and phi_max are given in units of radian and (phi_max-phi_min) should not be larger than pi

class sasdata.data_util.averaging.SlabX(qx_range: tuple[float, float] = (0.0, 0.0), qy_range: tuple[float, float] = (0.0, 0.0), nbins: int = 100, fold: bool = False, base: float | None = None)

Bases: CartesianROI

Average I(Q_x, Q_y) along the y direction (within a ROI), giving I(Q_x).

This class is initialised by specifying the boundaries of the ROI and is called by supplying a Data2D object. It returns a Data1D object. The averaging process can also be thought of as projecting 2D -> 1D.

There also exists the option to “fold” the ROI, where Q data on opposite sides of the origin but with equal magnitudes are averaged together, resulting in a 1D plot with only positive Q values shown.

class sasdata.data_util.averaging.SlabY(qx_range: tuple[float, float] = (0.0, 0.0), qy_range: tuple[float, float] = (0.0, 0.0), nbins: int = 100, fold: bool = False, base: float | None = None)

Bases: CartesianROI

Average I(Q_x, Q_y) along the x direction (within a ROI), giving I(Q_y).

This class is initialised by specifying the boundaries of the ROI and is called by supplying a Data2D object. It returns a Data1D object. The averaging process can also be thought of as projecting 2D -> 1D.

There also exists the option to “fold” the ROI, where Q data on opposite sides of the origin but with equal magnitudes are averaged together, resulting in a 1D plot with only positive Q values shown.

class sasdata.data_util.averaging.WedgePhi(r_range: tuple[float, float], phi_range: tuple[float, float] = (0.0, 6.283185307179586), center: tuple[float, float] = (0.0, 0.0), nbins: int = 100, base: float | None = None)

Bases: PolarROI

Project I(Q, φ) data onto I(φ) within a region defined by Cartesian limits.

The projection is computed by averaging together datapoints with the same Q value (so long as they are within the ROI).

This class is initialised by specifying lower and upper limits on both the magnitude of Q and the angle φ, measured anticlockwise from the positive x-axis. When called, this class is supplied with a Data2D object. It returns a Data1D object where intensity is given as a function of Q only.

class sasdata.data_util.averaging.WedgeQ(r_range: tuple[float, float], phi_range: tuple[float, float] = (0.0, 6.283185307179586), center: tuple[float, float] = (0.0, 0.0), nbins: int = 100, base: float | None = None)

Bases: PolarROI

Project I(Q, φ) data onto I(Q) within a region defined by Cartesian limits.

The projection is computed by averaging together datapoints with the same angle φ (so long as they are within the ROI), measured anticlockwise from the positive x-axis.

This class is initialised by specifying lower and upper limits on both the magnitude of Q and the angle φ. When called, this class is supplied with a Data2D object. It returns a Data1D object where intensity is given as a function of Q only.

sasdata.data_util.averaging.get_dq_data(data2d: Data2D) ndarray[tuple[Any, ...], dtype[floating]]

Get the dq for resolution averaging The pinholes and det. pix contribution present in both direction of the 2D which must be subtracted when converting to 1D: dq_overlap should be calculated ideally at q = 0. Note This method works on only pinhole geometry. Extrapolate dqx(r) and dqy(phi) at q = 0, and take an average.