def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) self.DEBUG("EDPluginBioSaxsProcessOneFilev1_5.preProcess") self.__edPluginWaitFile = self.loadPlugin(self.cpWaitFile) if self.dataInput.rawImageSize is not None: self.rawImageSize = self.dataInput.rawImageSize if self.dataInput.rawImage is not None: self.rawImage = self.dataInput.rawImage.path.value self.integratedCurve = self.dataInput.integratedCurve.path.value curveDir = os.path.dirname(self.integratedCurve) if not os.path.isdir(curveDir): try: os.mkdir(curveDir) except OSError: # could occur in race condition ... pass self.sample = self.dataInput.sample self.experimentSetup = self.dataInput.experimentSetup detector = self.experimentSetup.detector.value if detector.lower() == "pilatus": self.detector = pyFAI.detector_factory("Pilatus1M") else: self.detector = pyFAI.detector_factory(detector) try: self.detector.pixel1 = self.experimentSetup.pixelSize_2.value, # flip X,Y self.detector.pixel2 = self.experimentSetup.pixelSize_1.value, # flip X,Y except Exception as err: self.WARNING("in setting pixel size: %s" % err) i0 = self.experimentSetup.beamStopDiode.value normalization_factor = self.experimentSetup.normalizationFactor.value if normalization_factor == 0: warn = "normalization_factor is Null --> If we are testing, this is OK, else investigate !!!" self.lstExecutiveSummary.append(warn) self.warning(warn) normalization_factor = 1. if i0 == 0: warn = "beamStopDiode is Null --> If we are testing, this is OK, else investigate !!!" self.lstExecutiveSummary.append(warn) self.warning(warn) i0 = 1.0 self.normalization_factor = i0 / normalization_factor
def preProcess(self, _edObject=None): EDPluginControl.preProcess(self) self.DEBUG("EDPluginBioSaxsProcessOneFilev1_6.preProcess") self.__edPluginWaitFile = self.loadPlugin(self.cpWaitFile) if self.dataInput.rawImageSize is not None: self.rawImageSize = self.dataInput.rawImageSize if self.dataInput.rawImage is not None: self.rawImage = self.dataInput.rawImage.path.value self.integratedCurve = self.dataInput.integratedCurve.path.value curveDir = os.path.dirname(self.integratedCurve) if not os.path.isdir(curveDir): try: os.mkdir(curveDir) except OSError: # could occur in race condition ... pass self.sample = self.dataInput.sample self.experimentSetup = self.dataInput.experimentSetup detector = self.experimentSetup.detector.value if detector.lower() == "pilatus": self.detector = pyFAI.detector_factory("Pilatus1M") else: self.detector = pyFAI.detector_factory(detector) try: self.detector.pixel1 = self.experimentSetup.pixelSize_2.value, # flip X,Y self.detector.pixel2 = self.experimentSetup.pixelSize_1.value, # flip X,Y except Exception as err: self.WARNING("in setting pixel size: %s" % err) i0 = self.experimentSetup.beamStopDiode.value normalization_factor = self.experimentSetup.normalizationFactor.value if normalization_factor == 0: warn = "normalization_factor is Null --> If we are testing, this is OK, else investigate !!!" self.lstExecutiveSummary.append(warn) self.warning(warn) normalization_factor = 1. if i0 == 0: warn = "beamStopDiode is Null --> If we are testing, this is OK, else investigate !!!" self.lstExecutiveSummary.append(warn) self.warning(warn) i0 = 1.0 self.normalization_factor = i0 / normalization_factor
def correct_geometry(data,detector_type="D5"): """Correct image geometry of XPAD detectors: S540 (or D5), S70 and S140 The default image shape is 960x560 for D5 The corrected shape: D5: 560x960 ==> 578x1153 S70:560x120 ==> 578x120 """ if detector_type == "D5": #8x7 modules, or S540 detector = pyFAI.detector_factory("d5") elif detector_type == "S70": #1x7 modules detector = pyFAI.detector_factory("imxpad_s70") elif detector_type == "S140": #2x7 modules detector = pyFAI.detector_factory("imxpad_s140") else: print "Please specify the detector model." return None #geometry correction xpad_corr = Distortion(detector, resize=True) data = xpad_corr.correct(data) return data
def from_yamdict(cls, input): """Creates a PONI object from the yaml dictionary returned from reading a .poni file """ out = cls() for key in input: if key == 'Detector': if 'Detector_config' in input: if 'max_shape' in input['Detector_config']: if not (input['Detector_config']['max_shape'] is None or type(input['Detector_config']['max_shape']) == str): input['Detector_config']['max_shape'] = list( input['Detector_config']['max_shape']) out.detector = detector_factory( input['Detector'], config=input['Detector_config']) elif 'PixelSize1' in input and 'PixelSize2' in input: out.detector = detector_factory(input['Detector'], config={ 'pixel1': input['PixelSize1'], 'pixel2': input['PixelSize2'], }) else: out.detector = detector_factory(input['Detector']) elif key == 'Wavelength': if type(input[key]) == str: out.wavelength = eval(input[key]) else: out.wavelength = input[key] else: try: setattr(out, cls._poni_keys[key], input[key]) except KeyError: pass return out
def from_yamdict(cls, input): out = cls() for key in input: if key == 'Detector': out.detector = detector_factory( input['Detector'], config=input['Detector_config']) elif key == 'Wavelength': if type(input[key]) == str: out.wavelength = eval(input[key]) else: out.wavelength = input[key] else: try: setattr(out, cls._poni_keys[key], input[key]) except KeyError: pass return out
def InitDetector(args): import pyFAI detector = None if args['experiment'] == 'LCLS': from NPC.Detectors import CSPAD return CSPAD() elif args['experiment'] == 'SACLA': from NPC.Detectors import MPCCD return MPCCD() else: try: detector_name = args['detector'] detector = pyFAI.detector_factory(detector_name) detector.overload = GetOverload(detector_name) return detector # TODO: not the correct exception - needs to be rewritten except RuntimeError: print("This detector is not implemented in pyFAI / NPC - Please contact us") sys.exit(1)
def get_detector_config(): """Gets the configuration of the detector Returns: detector_name -- Pilatus100K, 300K etc. pixel_sz -- pixel size in meters ccd_shape -- number of pixels along both directions orientation -- vertical/horizontal init_dist -- calls function get_initial_distance to esimate the rough sample detector distance """ detector_name = get_detector_name() detector = pyFAI.detector_factory(detector_name) pixel_sz = detector.pixel1 ccd_shape = detector.max_shape orientation = get_detector_orientation() init_dist = get_initial_distance() return detector_name, pixel_sz, ccd_shape, orientation, init_dist
def data_reduction(imArray, QRange=None, ChiRange=None): s1 = int(imArray.shape[0]) s2 = int(imArray.shape[1]) imArray = signal.medfilt(imArray, kernel_size=5) detector_mask = np.ones((s1, s2)) * (imArray <= 0) lamda = 0.7999 PP = 1 #p = pyFAI.AzimuthalIntegrator(wavelength=lamda) #p.setFit2D(d, x0, y0, tilt, Rot, pixelsize, pixelsize) p = pyFAI.AzimuthalIntegrator(wavelength=lamda, detector=pyFAI.detector_factory('pilatus1M'), dist=0.2466, poni1=0.06683, poni2=0.0851, rot1=0.008086, rot2=0.5419, rot3=2.763068) cake, Q, chi = p.integrate2d(imArray, 1000, 1000, mask=detector_mask, polarization_factor=PP) Q = Q * 10e8 centerChi = (np.max(chi) + np.min(chi)) / 2 if (QRange is not None) and (ChiRange is not None): azRange = (centerChi + ChiRange[0], centerChi + ChiRange[1]) radRange = tuple([y / 10E8 for y in QRange]) print(azRange, radRange) else: azRange, radRange = None, None Qlist, IntAve = p.integrate1d(imArray, 1000, azimuth_range=azRange, radial_range=radRange, mask=detector_mask, polarization_factor=PP) Qlist = Qlist * 10e8 chi = chi - centerChi return Q, chi, cake, Qlist, IntAve
def InitDetector(args): import pyFAI detector = None if args['experiment'] == 'LCLS': from NPC.Detectors import CSPAD return CSPAD() elif args['experiment'] == 'SACLA': from NPC.Detectors import MPCCD return MPCCD() else: try: detector_name = args['detector'] detector = pyFAI.detector_factory(detector_name) detector.overload = GetOverload(detector_name) return detector # TODO: not the correct exception - needs to be rewritten except RuntimeError: print( "This detector is not implemented in pyFAI / NPC - Please contact us" ) sys.exit(1)
def test_histo(self): det = detector_factory("Pilatus100k") data = numpy.random.random(det.shape) ai = AzimuthalIntegrator(detector=det, wavelength=1e-10) method = ("no", "histogram", "python") python = ai._integrate1d_ng(data, 100, method=method, error_model="poisson") self.assertEqual(python.compute_engine, "pyFAI.engines.histogram_engine.histogram1d_engine") self.assertEqual(str(python.unit), "q_nm^-1") method = ("no", "histogram", "cython") cython = ai._integrate1d_ng(data, 100, method=method, error_model="poisson") self.assertEqual(cython.compute_engine, "pyFAI.ext.histogram.histogram1d_engine") self.assertEqual(str(cython.unit), "q_nm^-1") self.assertTrue(numpy.allclose(cython.radial, python.radial), "cython position are the same") self.assertTrue(numpy.allclose(cython.intensity, python.intensity), "cython intensities are the same") self.assertTrue(numpy.allclose(cython.sigma, python.sigma), f"cython errors are the same, aerr={(abs(python.sigma - cython.sigma)).max()}") self.assertTrue(numpy.allclose(cython.sum_signal, python.sum_signal), "cython sum_signal are the same") self.assertTrue(numpy.allclose(cython.sum_variance, python.sum_variance), "cython sum_variance are the same") self.assertTrue(numpy.allclose(cython.sum_normalization, python.sum_normalization), "cython sum_normalization are the same") self.assertTrue(numpy.allclose(cython.count, python.count), "cython count are the same") method = ("no", "histogram", "opencl") actual_method = ai._normalize_method(method=method, dim=1, default=ai.DEFAULT_METHOD_1D).method[1:4] if actual_method != method: reason = "Skipping TestIntergrationNextGeneration.test_histo as OpenCL method not available" self.skipTest(reason) opencl = ai._integrate1d_ng(data, 100, method=method, error_model="poisson") self.assertEqual(opencl.compute_engine, "pyFAI.opencl.azim_hist.OCL_Histogram1d") self.assertEqual(str(opencl.unit), "q_nm^-1") self.assertTrue(numpy.allclose(opencl.radial, python.radial), "opencl position are the same") self.assertTrue(numpy.allclose(opencl.intensity, python.intensity), "opencl intensities are the same") self.assertTrue(numpy.allclose(opencl.sigma, python.sigma), "opencl errors are the same") self.assertTrue(numpy.allclose(opencl.sum_signal.sum(axis=-1), python.sum_signal), "opencl sum_signal are the same") self.assertTrue(numpy.allclose(opencl.sum_variance.sum(axis=-1), python.sum_variance), f"opencl sum_variance are the same {abs(opencl.sum_variance.sum(axis=-1) - python.sum_variance).max()}") self.assertTrue(numpy.allclose(opencl.sum_normalization.sum(axis=-1), python.sum_normalization), "opencl sum_normalization are the same") self.assertTrue(numpy.allclose(opencl.count, python.count), "opencl count are the same")
def get_detector(detector: Detector) -> pyFAI.Detector: return pyFAI.detector_factory(detector)
def get_detector(detector: Detector) -> PyFAIDetector: return pyFAI.detector_factory(detector)
import logging import pyFAI, fabio from pyFAI.test.utilstest import UtilsTest from pyFAI.gui.mpl_calib_qt import QtMplCalibWidget from pyFAI.gui.peak_picker import PeakPicker logging.basicConfig() from pyFAI.calibrant import get_calibrant agbh = get_calibrant("AgBh") img = fabio.open(UtilsTest.getimage("Pilatus1M.edf")).data pp = PeakPicker( data=img, calibrant=agbh, wavelength=1e-10, detector=pyFAI.detector_factory("Pilatus1M"), )
def init_integration(cfg_file): #Load a RAW.cfg file raw_settings = raw.load_settings(cfg_file) #Get parameters detector = pyFAI.detector_factory("pilatus1m") masks = raw_settings.get('Masks') mask = masks['BeamStopMask'][0] mask = np.logical_not(mask) sd_distance = raw_settings.get('SampleDistance') pixel_size = raw_settings.get('DetectorPixelSize') wavelength = raw_settings.get('WaveLength') bin_size = raw_settings.get('Binsize') normlist = raw_settings.get('NormalizationList') do_normalization = raw_settings.get('EnableNormalization') #Put everything in appropriate units pixel_size = pixel_size *1e-6 #convert pixel size to m wavelength = wavelength*1e-10 #convert wl to m #Set up q calibration xlen, ylen = detector.shape x_cin = raw_settings.get('Xcenter') y_cin = detector.shape[0]-raw_settings.get('Ycenter') maxlen1 = int(max(xlen - x_cin, ylen - y_cin, xlen - (xlen - x_cin), ylen - (ylen - y_cin))) diag1 = int(np.sqrt((xlen-x_cin)**2 + y_cin**2)) diag2 = int(np.sqrt((x_cin**2 + y_cin**2))) diag3 = int(np.sqrt((x_cin**2 + (ylen-y_cin)**2))) diag4 = int(np.sqrt((xlen-x_cin)**2 + (ylen-y_cin)**2)) maxlen = int(max(diag1, diag2, diag3, diag4, maxlen1)/bin_size) x_c = float(x_cin) y_c = float(y_cin) qmin_theta = calcTheta(sd_distance*1e-3, pixel_size, 0) qmin = ((4*math.pi*math.sin(qmin_theta))/(wavelength*1e10)) qmax_theta = calcTheta(sd_distance*1e-3, pixel_size, maxlen) qmax = ((4*math.pi*math.sin(qmax_theta))/(wavelength*1e10)) q_range = (qmin, qmax) #Set up the pyfai Aziumuthal integrator ai = pyFAI.AzimuthalIntegrator(detector=detector) ai.wavelength = wavelength ai.pixel1 = pixel_size ai.pixel2 = pixel_size ai.setFit2D(sd_distance, x_c, y_c) calibrate_dict = {'Sample_Detector_Distance' : sd_distance, 'Detector_Pixel_Size' : pixel_size, 'Wavelength' : wavelength, 'Beam_Center_X' : x_c, 'Beam_Center_Y' : y_c, 'Radial_Average_Method' : 'pyFAI', } fliplr = raw_settings.get('DetectorFlipLR') flipud = raw_settings.get('DetectorFlipUD') ai.setup_CSR((xlen, ylen), npt=maxlen, mask=mask, pos0_range=q_range, unit='q_A^-1', split='no', mask_checksum=mask.sum()) ai.setup_LUT((xlen, ylen), npt=maxlen, mask=mask, pos0_range=q_range, unit='q_A^-1', mask_checksum=mask.sum()) return ai, mask, q_range, maxlen, normlist, do_normalization, raw_settings, calibrate_dict, fliplr, flipud
def run_integration(configFile, peak_detection_ratio=0.1): Run = RunInit(configFile) params = Run.params mask = fabio.open(params.maskFile).data number_of_run = Run.number_of_run image_extension = params.image_extension img_folder = params.img_folder img_prefix = params.img_prefix img_digit = int(params.img_digit) poni_files = params.poni_files img_begin = np.asarray(params.img_begin) img_end = np.asarray(params.img_end) Qlength = [ np.sqrt((Run.all_Q0[r]**2).sum(axis=2)) for r in range(number_of_run) ] m = np.array([q.min() for q in Qlength]) M = np.array([q.max() for q in Qlength]) Qmin = m.min() Qmax = M.max() print("Q min = %f" % Qmin) print("Q max = %f" % Qmax) maxipix = pyFAI.detector_factory("Maxipix_5x1") ais = [pyFAI.load(pf) for pf in poni_files] for ai in ais: ai.detector = maxipix wl = ai.wavelength * 1e10 tth_min = np.degrees(np.arcsin(Qmin * wl / 4 / np.pi)) * 2 tth_max = np.degrees(np.arcsin(Qmax * wl / 4 / np.pi)) * 2 print("tth min = %f" % tth_min) print("tth max = %f" % tth_max) allData = Run.allData_allRun mg = MultiGeometry(poni_files, radial_range=(tth_min, tth_max)) phi_points = allData.shape[1] bin_pts = 1000 I_tot = np.zeros(bin_pts) num_threads = _NUM_THREADS # """ for j in range(0, phi_points, num_threads): threads = [] for i in range(j, j + num_threads): if i < phi_points: img_data = allData[:, i, :, :] thr = Integrator(mg, i, img_data, mask, bin_pts) thr.start() threads.append(thr) for thr in threads: thr.join() I_tot += thr.I # """ I_tot = I_tot / phi_points q_tth = np.linspace(Qmin, Qmax, bin_pts) tth_q = np.linspace(tth_min, tth_max, bin_pts) outData = np.vstack([tth_q, q_tth, I_tot]) outData = outData.T outFile = splitext(configFile)[0] + "_Integrated_intensity_Q.dat" np.savetxt(outFile, outData, header=str("2Theta (deg) \t Q (1/A) \t Intensity"), fmt="%6.4f") (tth_peak, I_peak) = get_maxima(thr.tth, I_tot, threshold=peak_detection_ratio) tth_peak = np.asarray(tth_peak) Q_shell = 4 * np.pi * np.sin(np.radians(tth_peak / 2)) / wl Qout = np.vstack([tth_peak, Q_shell]) Qout = Qout.T outFile2 = splitext(configFile)[0] + "_tth_Q_peaks.dat" np.savetxt(outFile2, Qout, fmt="%6.4f", header=str("Q max = %.4f\n2Theta (deg) \t Q value (1/A)" % Qmax)) print("TTH peaks: ") print(tth_peak) fig = figure() ax = fig.add_subplot(111) ax.plot(thr.tth, I_tot, lw=2) ax.plot(tth_peak, I_peak, "ro") # for x in tth_peak: # ax.axvline(x, color="r", lw=1) ax.set_xlabel("2Theta (deg)") ax.set_ylabel("Summed intensity (a.u.)") title = splitext(configFile)[0] + " integrated intensity over phi scan" ax.set_title(title) show() saveImg = splitext(configFile)[0] + "_integrated_intensity.png" fig.savefig(saveImg)
def process(self): self.metadata = self.parse_image_file() self.mask_filename = self.input.get("regrouping_mask_filename") shape = self.in_shape[-2:] if self.I1 is None: self.I1 = numpy.ones(shape, dtype=float) elif self.I1.size < self.in_shape[0]: ones = numpy.ones(self.in_shape[0], dtype=float) ones[:self.I1.size] = self.I1 self.I1 = ones # update all metadata with the one provided by input for key, value in self.input.items(): if key in self.KEYS: self.metadata[key] = value forai = {} for key in ("BSize_1", "BSize_2", "Center_1", "Center_2", "PSize_1", "PSize_2", "Rot_1", "Rot_2", "Rot_3", "SampleDistance", "WaveLength"): forai[key] = self.metadata.get(key) self.dist = self.metadata.get("SampleDistance") # Some safety checks, use-input are sometimes False ! if self.dist < 0: #which is impossible self.log_warning( f"Found negative distance: {self.dist}, considering its absolute value" ) self.dist = forai["SampleDistance"] = abs( self.metadata.get("SampleDistance")) if forai["WaveLength"] < 0: self.log_warning( f"Found negative wavelength: {forai['WaveLength']}, considering its absolute value" ) forai["WaveLength"] = abs(self.metadata.get("WaveLength")) self.dummy = self.metadata.get("Dummy", self.dummy) self.delta_dummy = self.metadata.get("DDummy", self.delta_dummy) # read detector distortion distortion_filename # self.log_warning("Metadata: " + str(self.metadata)) # self.log_warning("forai: " + str(forai)) self.ai = AzimuthalIntegrator() self.ai.setSPD(**forai) self.distortion_filename = self.input.get( "distortion_filename") or None if type(self.distortion_filename) in StringTypes: detector = pyFAI.detector_factory( "Frelon", {"splineFile": self.distortion_filename}) if tuple(detector.shape) != shape: self.log_warning( "Binning needed for spline ? detector claims %s but image size is %s" % (detector.shape, shape)) detector.guess_binning(shape) self.ai.detector = detector else: self.ai.detector.shape = self.in_shape[-2:] self.log_warning("AI:%s" % self.ai) self.cache_ai = CacheKey(str(self.ai), self.mask_filename, shape) if self.cache_ai in self.cache: self.ai._cached_array.update(self.cache.get(self.cache_ai)) else: # Initialize geometry: self.ai.qArray(shape) self.ai.chiArray(shape) self.ai.deltaQ(shape) self.ai.deltaChi(shape) self.ai.solidAngleArray(shape) self.cache.get(self.cache_ai, {}).update(self.ai._cached_array) if self.input.get("do_polarization"): self.polarization = self.ai.polarization( factor=self.input.get("polarization_factor"), axis_offset=self.input.get("polarization_axis_offset", 0)) # Read and Process dark if type(self.dark_filename) in StringTypes and os.path.exists( self.dark_filename): dark = self.read_data(self.dark_filename) if dark.ndim == 3: method = self.input.get("dark_filter") if method.startswith("quantil"): lower = self.input.get("dark_filter_quantil_lower", 0) upper = self.input.get("dark_filter_quantil_upper", 1) self.dark = pyFAI.average.average_dark( dark, center_method=method, quantiles=(lower, upper)) else: if method is None: method = "median" self.dark = pyFAI.average.average_dark( dark, center_method=method) else: self.dark = dark elif type(self.dark_filename) in (int, float): self.dark = float(self.dark_filename) if numpy.isscalar(self.dark): self.dark = numpy.ones(self.ai.detector.shape) * self.dark self.ai.detector.set_darkcurrent(self.dark) # Read and Process Flat self.flat_filename = self.input.get("flat_filename") if type(self.flat_filename) in StringTypes and os.path.exists( self.flat_filename): if self.flat_filename.endswith( ".h5") or self.flat_filename.endswith( ".nxs") or self.flat_filename.endswith(".hdf5"): flat = self.read_data(self.flat_filename) else: flat_fabio = fabio.open(self.flat_filename) flat = flat_fabio.data dummy = flat_fabio.header.get("Dummy") try: dummy = float(dummy) except: self.log_error("Dummy value in mask is unconsistent %s" % dummy) dummy = None if flat.ndim == 3: self.flat = pyFAI.average.average_dark(flat, center_method="median") else: self.flat = flat if (self.flat is not None) and (self.flat.shape != shape): binning = [j / i for i, j in zip(shape, self.flat.shape)] if tuple(binning) != (1, 1): self.log_warning("Binning for flat is %s" % binning) if max(binning) > 1: binning = [int(i) for i in binning] self.flat = pyFAI.utils.binning(self.flat, binsize=binning, norm=False) else: binning = [ i // j for i, j in zip(shape, self.flat.shape) ] self.flat = pyFAI.utils.unBinning(self.flat, binsize=binning, norm=False) if numpy.isscalar(self.flat): self.flat = numpy.ones(self.ai.detector.shape) * self.flat self.ai.detector.set_flatfield(self.flat) # Read and Process mask if type(self.mask_filename) in StringTypes and os.path.exists( self.mask_filename): try: mask_fabio = fabio.open(self.mask_filename) except: mask = self.read_data(self.mask_filename) != 0 else: # this is very ID02 specific !!!! dummy = mask_fabio.header.get("Dummy") try: dummy = float(dummy) except: self.log_error("Dummy value in mask is unconsitent %s" % dummy) dummy = None ddummy = mask_fabio.header.get("DDummy") try: ddummy = float(ddummy) except: self.log_error("DDummy value in mask is unconsitent %s" % ddummy) ddummy = 0 if ddummy: mask = abs(mask_fabio.data - dummy) <= ddummy else: mask = (mask_fabio.data == dummy) self.log_warning("found %s pixel masked out" % (mask.sum())) self.dummy = dummy self.delta_dummy = ddummy if mask.ndim == 3: mask = pyFAI.average.average_dark(mask, center_method="median") if (mask is not None) and (mask.shape != shape): binning = [j / i for i, j in zip(shape, mask.shape)] if tuple(binning) != (1, 1): self.log_warning("Binning for mask is %s" % binning) if max(binning) > 1: binning = [int(i) for i in binning] mask = pyFAI.utils.binning( mask, binsize=binning, norm=True) > 0 else: binning = [i // j for i, j in zip(shape, mask.shape)] mask = pyFAI.utils.unBinning( mask, binsize=binning, norm=False) > 0 # nota: this is assigned to the detector ! self.ai.mask = mask # bug specific to ID02, dummy=0 means no dummy ! if self.dummy == 0: self.dummy = None self.create_hdf5() self.process_images()
#!/usr/bin/python3 import logging logger = logging.basicConfig(level=logging.INFO) import numpy, pyFAI, pyFAI.azimuthalIntegrator method = ("no", "csr", "cython") detector = pyFAI.detector_factory("Pilatus_100k") ai = pyFAI.azimuthalIntegrator.AzimuthalIntegrator(detector=detector) rm = max(detector.shape) * detector.pixel1 img = numpy.random.random(detector.shape) print(ai.integrate1d(img, 5, unit="r_m", radial_range=[0, rm], method=method)) # print(ai.integrate1d(img, 5, unit="r_m", method=method)) for k, v in ai.engines.items(): print(k, v, id(v.engine)) print(ai.integrate1d(img, 5, unit="r_m", radial_range=[0, rm], method=method)) # print(ai.integrate1d(img, 5, unit="r_m", method=method)) for k, v in ai.engines.items(): print(k, v, id(v.engine))