manipulations

DataLoader.manipulations

Data manipulations for 2D data sets. Using the meta data information, various types of averaging are performed in Q-space

class DataLoader.manipulations.Boxavg(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0)

Bases: DataLoader.manipulations.Boxsum

Perform the average of counts in a 2D region of interest.

class DataLoader.manipulations.Boxcut(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0)

Bases: object

Find a rectangular 2D region of interest.

class DataLoader.manipulations.Boxsum(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0)

Bases: object

Perform the sum of counts in a 2D region of interest.

class DataLoader.manipulations.CircularAverage(r_min=0.0, r_max=0.0, bin_width=0.00050000000000000001)

Bases: object

Perform circular averaging on 2D data

The data returned is the distribution of counts as a function of Q

class DataLoader.manipulations.Ring(r_min=0, r_max=0, center_x=0, center_y=0, nbins=20)

Bases: object

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 distribution of counts around the ring as a function of phi.

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 DataLoader.manipulations.Ringcut(r_min=0, r_max=0, center_x=0, center_y=0)

Bases: object

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 DataLoader.manipulations.SectorPhi(r_min, r_max, phi_min=0, phi_max=6.2831853071795862, nbins=20)

Bases: DataLoader.manipulations._Sector

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 DataLoader.manipulations.SectorQ(r_min, r_max, phi_min=0, phi_max=6.2831853071795862, nbins=20)

Bases: DataLoader.manipulations._Sector

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

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

class DataLoader.manipulations.Sectorcut(phi_min=0, phi_max=3.1415926535897931)

Bases: object

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 DataLoader.manipulations.SlabX(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0, bin_width=0.001)

Bases: DataLoader.manipulations._Slab

Compute average I(Qx) for a region of interest

class DataLoader.manipulations.SlabY(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0, bin_width=0.001)

Bases: DataLoader.manipulations._Slab

Compute average I(Qy) for a region of interest

DataLoader.manipulations.flip_phi(phi)

Correct phi to within the 0 <= to <= 2pi range

Returns:phi in >=0 and <=2Pi
DataLoader.manipulations.get_intercept(q, q_0, q_1)

Returns the fraction of the side at which the q-value intercept the pixel, None otherwise. The values returned is the fraction ON THE SIDE OF THE LOWEST Q.

    A           B    
+-----------+--------+    <--- pixel size
0                    1     
Q_0 -------- Q ----- Q_1   <--- equivalent Q range
if Q_1 > Q_0, A is returned
if Q_1 < Q_0, B is returned
if Q is outside the range of [Q_0, Q_1], None is returned
DataLoader.manipulations.get_pixel_fraction(qmax, q_00, q_01, q_10, q_11)

Returns the fraction of the pixel defined by the four corners (q_00, q_01, q_10, q_11) that has q < qmax.:

        q_01                q_11
y=1         +--------------+
            |              |
            |              |
            |              |
y=0         +--------------+
        q_00                q_10

            x=0            x=1
DataLoader.manipulations.get_pixel_fraction_square(x, xmin, xmax)

Return the fraction of the length from xmin to x.:

    A            B
+-----------+---------+
xmin        x         xmax
Parameters:
  • x – x-value
  • xmin – minimum x for the length considered
  • xmax – minimum x for the length considered
Returns:

(x-xmin)/(xmax-xmin) when xmin < x < xmax

DataLoader.manipulations.get_q(dx, dy, det_dist, wavelength)
Parameters:
  • dx – x-distance from beam center [mm]
  • dy – y-distance from beam center [mm]
Returns:

q-value at the given position

DataLoader.manipulations.get_q_compo(dx, dy, det_dist, wavelength, compo=None)

This reduces tiny error at very large q. Implementation of this func is not started yet.<–ToDo

DataLoader.manipulations.reader2D_converter(data2d=None)

convert old 2d format opened by IhorReader or danse_reader to new Data2D format

Parameters:data2d – 2d array of Data2D object
Returns:1d arrays of Data2D object

Table Of Contents

Previous topic

loader

Next topic

qsmearing

This Page