Skip to content

Commit

Permalink
Checking empty list with new numpy versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
gfreychet committed Jan 26, 2024
1 parent 93985ff commit d0d5c5c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions smi_analysis/SMI_beamline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def __init__(self,
self.det_angle_step = det_angle_step
self.det_angles = det_angles

self.ai = np.array([])
self.ai = []
self.masks = []
self.cake = []
self.inpaints, self.mask_inpaints = np.array([]), np.array([])
self.img_st, self.mask_st = np.array([]), np.array([])
self.inpaints, self.mask_inpaints = [], []
self.img_st, self.mask_st = [], []
self.bs_kind = bs_kind
self.scales = 1

Expand Down Expand Up @@ -224,7 +224,7 @@ def calculate_integrator_gi(self, det_rots):
def stitching_data(self, flag_scale=True, interp_factor=1):
self.img_st, self.qp, self.qz = [], [], []

if not(self.ai.size):
if np.array_equal(self.ai, []):
if len(self.det_angles) != len(self.imgs):
if self.detector != 'Pilatus900kw':
if len(self.det_angles) !=0 and len(self.det_angles) > len(self.imgs):
Expand Down Expand Up @@ -283,7 +283,7 @@ def inpainting(self, **kwargs):
)

def caking(self, radial_range=None, azimuth_range=None, npt_rad=500, npt_azim=500):
if not(self.img_st.size):
if np.array_equal(self.img_st, []):
self.stitching_data()

if radial_range is None and 'Pilatus' in self.detector:
Expand All @@ -292,7 +292,7 @@ def caking(self, radial_range=None, azimuth_range=None, npt_rad=500, npt_azim=50
azimuth_range = (-180, 180)

if self.geometry == 'Transmission':
if not(self.inpaints.size):
if np.array_equal(self.inpaints, []):
self.inpainting()
self.cake, self.q_cake, self.chi_cake = integrate1D.cake_saxs(self.inpaints,
self.ai,
Expand All @@ -304,7 +304,7 @@ def caking(self, radial_range=None, azimuth_range=None, npt_rad=500, npt_azim=50
)
elif self.geometry == 'Reflection':
#ToDo implement a way to modify the dimension of the cake if required (it need to match the image dim ratio)
#if not(self.inpaints.size):
# if np.array_equal(self.inpaints, []):
# self.inpainting()
self.cake, self.q_cake, self.chi_cake = integrate1D.cake_gisaxs(self.img_st,
self.qp,
Expand All @@ -318,7 +318,7 @@ def radial_averaging(self, radial_range=None, azimuth_range=None, npt=2000):
self.q_rad, self.I_rad = [], []

if self.geometry == 'Transmission':
if not(self.inpaints.size):
if np.array_equal(self.inpaints, []):
self.inpainting()
if radial_range is None and (self.detector == 'Pilatus300kw' or self.detector == 'Pilatus900kw'):
radial_range = (0.001, np.sqrt(self.qp[1]**2 + self.qz[1]**2))
Expand All @@ -339,7 +339,7 @@ def radial_averaging(self, radial_range=None, azimuth_range=None, npt=2000):
)

elif self.geometry == 'Reflection':
if not(self.img_st.size):
if np.array_equal(self.img_st, []):
self.stitching_data()
if radial_range is None and 'Pilatus' in self.detector:
radial_range = (0, self.qp[1])
Expand Down Expand Up @@ -373,7 +373,7 @@ def azimuthal_averaging(self, radial_range=None, azimuth_range=None, npt_rad=500
if azimuth_range is None and self.detector == 'Pilatus1m':
azimuth_range = (-180, 180)

if not(self.cake.size):
if np.array_equal(self.cake, []):
self.caking(radial_range=radial_range,
azimuth_range=azimuth_range,
npt_rad=npt_rad,
Expand All @@ -388,7 +388,7 @@ def azimuthal_averaging(self, radial_range=None, azimuth_range=None, npt_rad=500
)

def horizontal_integration(self, q_per_range=None, q_par_range=None):
if not(self.img_st.size):
if np.array_equal(self.img_st, []):
self.stitching_data()

self.q_hor, self.I_hor = integrate1D.integrate_qpar(self.img_st,
Expand All @@ -399,7 +399,7 @@ def horizontal_integration(self, q_per_range=None, q_par_range=None):
)

def vertical_integration(self, q_per_range=None, q_par_range=None):
if not(self.img_st.size):
if np.array_equal(self.img_st, []):
self.stitching_data()

self.q_ver, self.I_ver = integrate1D.integrate_qper(self.img_st,
Expand Down

0 comments on commit d0d5c5c

Please sign in to comment.