lower = mean - threshold upper = mean + threshold # single out the too low and too high pixels too_low = img < lower[int_q] too_hi = img > upper[int_q] mask = mask * ~too_low * ~too_hi return mask.astype(bool) img_folder = '/mnt/bulk-data/research_data/USC_beamtime/APS_March_2016/S1/temp_exp' cal_folder = '/mnt/bulk-data/research_data/USC_beamtime/APS_March_2016/Calibration/CeO2_25_3_12' geo = Geometry() geo.load(os.path.join(cal_folder, 'CeO2calibration_25-00004_sum.poni')) lamda = geo.wavelength * 10 ** 10 print(lamda) img = TiffStack(os.path.join(img_folder, 'd25_S6_VT-00000.tif'))[0] mask = np.ones(img.shape, dtype=bool) mask *= mask_edge(img.shape, 30) r = geo.rArray((2048, 2048)) q = geo.qArray((2048, 2048)) rmax = np.max(r) qmax = np.max(q) pixel_size = geo.pixel1 distance = geo.dist wavelength = lamda
lower = mean - threshold upper = mean + threshold # single out the too low and too high pixels too_low = img < lower[int_q] too_hi = img > upper[int_q] mask = mask * ~too_low * ~too_hi return mask.astype(bool) img_folder = '/mnt/bulk-data/research_data/USC_beamtime/APS_March_2016/even_more_cells' cal_folder = img_folder geo = Geometry() geo.load(os.path.join(cal_folder, 'CeO2_d25-00023.poni')) lamda = geo.wavelength * 10 ** 10 print(lamda) img = TiffStack(os.path.join(img_folder, 'S32_d25-00020.tif'))[0] mask = np.ones(img.shape, dtype=bool) mask *= mask_edge(img.shape, 30) r = geo.rArray((2048, 2048)) q = geo.qArray((2048, 2048)) rmax = np.max(r) qmax = np.max(q) pixel_size = geo.pixel1 distance = geo.dist wavelength = lamda