• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyFAI.load函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyFAI.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: set_ai

    def set_ai(self):
        poni = str(self.poni.text()).strip()
        if poni and os.path.isfile(poni):
            self.ai = pyFAI.load(poni)
        detector = str(self.detector.currentText()).lower().strip() or "detector"
        self.ai.detector = pyFAI.detectors.detector_factory(detector)

        wavelength = str(self.wavelength.text()).strip()
        if wavelength:
            try:
                fwavelength = float(wavelength)
            except ValueError:
                logger.error("Unable to convert wavelength to float: %s" % wavelength)
            else:
                if fwavelength <= 0 or fwavelength > 1e-6:
                    logger.warning("Wavelength is in meter ... unlikely value %s" % fwavelength)
                self.ai.wavelength = fwavelength

        splineFile = str(self.splineFile.text()).strip()
        if splineFile and os.path.isfile(splineFile):
            self.ai.detector.splineFile = splineFile

        self.ai.pixel1 = self._float("pixel1", 1)
        self.ai.pixel2 = self._float("pixel2", 1)
        self.ai.dist = self._float("dist", 1)
        self.ai.poni1 = self._float("poni1", 0)
        self.ai.poni2 = self._float("poni2", 0)
        self.ai.rot1 = self._float("rot1", 0)
        self.ai.rot2 = self._float("rot2", 0)
        self.ai.rot3 = self._float("rot3", 0)

        if self.chi_discontinuity_at_0.isChecked():
            self.ai.setChiDiscAtZero()

        mask_file = str(self.mask_file.text()).strip()
        if mask_file and os.path.exists(mask_file) and bool(self.do_mask.isChecked()):
            try:
                mask = fabio.open(mask_file).data
            except Exception as error:
                logger.error("Unable to load mask file %s, error %s" % (mask_file, error))
            else:
                self.ai.mask = mask
        dark_files = [i.strip() for i in str(self.dark_current.text()).split(",")
                      if os.path.isfile(i.strip())]
        if dark_files and bool(self.do_dark.isChecked()):
            d0 = fabio.open(dark_files[0]).data
            darks = numpy.zeros(d0.shape[0], d0.shape[1], len(dark_files), dtype=numpy.float32)
            for i, f in enumerate(dark_files):
                darks[:, :, i] = fabio.open(f).data
            self.ai.darkcurrent = darks.mean(axis= -1)

        flat_files = [i.strip() for i in str(self.flat_field.text()).split(",")
                      if os.path.isfile(i.strip())]
        if flat_files and bool(self.do_flat.isChecked()):
            d0 = fabio.open(flat_files[0]).data
            flats = numpy.zeros(d0.shape[0], d0.shape[1], len(flat_files), dtype=numpy.float32)
            for i, f in enumerate(flat_files):
                flats[:, :, i] = fabio.open(f).data
            self.ai.darkcurrent = flats.mean(axis= -1)
        print self.ai
开发者ID:amundhov,项目名称:pyFAI,代码行数:60,代码来源:integrate_ui.py


示例2: loadgeometry

def loadgeometry(ponifilepath=None):
    """Loads the detector geometry information from a poni file or from hard coded information
    Parameters
    ----------
    ponifilepath: str
        File path to the .poni file
    Returns
    -------
    a: an object which contains the geometry information for the detector
    """
    if ponifilepath is None:
        distance = 0.204666698799
        poni1 = 0.205911555168
        poni2 = 0.207264947729
        rot1 = 0.0105322341791
        rot2 = 0.0104587423844
        rot3 = -3.27539683464e-08
        spline_file = None
        wavelength = 1.839e-11
        detector = "Perkin"
        # This is the PyFAI geometry stuff
        a = geo.Geometry(dist=distance, poni1=poni1, poni2=poni2, rot1=rot1,
                         rot2=rot2, rot3=rot3, pixel1=200e-6, pixel2=200e-6,
                         splineFile=None, detector=detector,
                         wavelength=wavelength)
    else:
        a = pyFAI.load(ponifilepath)
    return a
开发者ID:ZhouHUB,项目名称:xpd_workflow,代码行数:28,代码来源:maskwrite5.py


示例3: __init__

 def __init__(self, poni, img):
     self.ponifile = poni
     self.ai = pyFAI.load(poni)
     self.img = fabio.open(img)
     self.r = None
     self.I = None
     self.resynth = None
     self.delta = None
开发者ID:SulzmannFr,项目名称:pyFAI,代码行数:8,代码来源:check_calib.py


示例4: loadgeometry

def loadgeometry(ponifilepath=None):
    """Loads the detector geometry information from a poni file or from hard coded information
    Parameters
    ----------
    ponifilepath: str
        File path to the .poni file
    Returns
    -------
    Azimuthal integrator object:
        an object which contains the geometry information for the detector
    """
    if ponifilepath is None:
        filepath = tkFileDialog.askopenfilename()
        a = pyFAI.load(ponifilepath)
    else:
        a = pyFAI.load(ponifilepath)
    return a
开发者ID:ZhouHUB,项目名称:xpd_workflow,代码行数:17,代码来源:IO.py


示例5: q_from_xy

def q_from_xy(x, y, ai=None, calfile=None):

    if ai is None: ai = pyFAI.load(calfile)

    try:
        return ai.qFunction(np.array([y,]),np.array([x,]))[0]
    except:
        return 0
开发者ID:maurov,项目名称:xraylarch,代码行数:8,代码来源:xrd_pyFAI.py


示例6: set_ai

    def set_ai(self):
        poni = str(self.poni.text()).strip()
        if poni and op.isfile(poni):
            self.ai = pyFAI.load(poni)
        detector = str(self.detector.currentText()).lower().strip() or "detector"
        self.ai.detector = pyFAI.detectors.detector_factory(detector)

        wavelength = str(self.wavelength.text()).strip()
        if wavelength:
            try:
                fwavelength = float(wavelength)
            except ValueError:
                logger.error("Unable to convert wavelength to float: %s" % wavelength)
            else:
                if fwavelength <= 0 or fwavelength > 1e-6:
                    logger.warning("Wavelength is in meter ... unlikely value %s" % fwavelength)
                self.ai.wavelength = fwavelength

        splineFile = str(self.splineFile.text()).strip()
        if splineFile and op.isfile(splineFile):
            self.ai.detector.splineFile = splineFile

        self.ai.pixel1 = self._float("pixel1", 1)
        self.ai.pixel2 = self._float("pixel2", 1)
        self.ai.dist = self._float("dist", 1)
        self.ai.poni1 = self._float("poni1", 0)
        self.ai.poni2 = self._float("poni2", 0)
        self.ai.rot1 = self._float("rot1", 0)
        self.ai.rot2 = self._float("rot2", 0)
        self.ai.rot3 = self._float("rot3", 0)

        if self.chi_discontinuity_at_0.isChecked():
            self.ai.setChiDiscAtZero()

        mask_file = str(self.mask_file.text()).strip()
        if mask_file  and bool(self.do_mask.isChecked()):
            if op.exists(mask_file):
                try:
                    mask = fabio.open(mask_file).data
                except Exception as error:
                    logger.error("Unable to load mask file %s, error %s" % (mask_file, error))
                else:
                    self.ai.mask = mask
#            elif mask_file==FROM_PYMCA:
#                self.ai.mask = mask
        dark_files = [i.strip() for i in str(self.dark_current.text()).split(",")
                      if op.isfile(i.strip())]
        if dark_files and bool(self.do_dark.isChecked()):
            self.ai.set_darkfiles(dark_files)

        flat_files = [i.strip() for i in str(self.flat_field.text()).split(",")
                      if op.isfile(i.strip())]
        if flat_files and bool(self.do_flat.isChecked()):
            self.ai.set_flatfiles(flat_files)
        print self.ai
开发者ID:mik854e,项目名称:pyFAI,代码行数:55,代码来源:integrate_widget.py


示例7: integrate_xrd_row

def integrate_xrd_row(rowxrd2d, calfile, unit='q', steps=2048,
                      wedge_limits=None, mask=None, dark=None,
                      flip=True):
    '''
    Uses pyFAI (poni) calibration file to produce 1D XRD data from a row of 2D XRD images

    Must provide pyFAI calibration file

    rowxrd2d     : 2D diffraction images for integration
    calfile      : poni calibration file
    unit         : unit for integration data ('2th'/'q'); default is 'q'
    steps        : number of steps in integration data; default is 10000
    wedge_limits : azimuthal slice limits
    mask         : mask array for image
    dark         : dark image array
    flip         : vertically flips image to correspond with Dioptas poni file calibration
    '''

    if not HAS_pyFAI:
        print('pyFAI not imported. Cannot calculate 1D integration.')
        return

    try:
        ai = pyFAI.load(calfile)
    except:
        print('calibration file "%s" could not be loaded.' % calfile)
        return

    if type(dark) is str:
        try:
            dark = np.array(tifffile.imread(xrd2dbkgd))
        except:
            dark = None

    dir = -1 if flip else 1
    attrs = dict(mask=mask, dark=dark, method='csr',
             polarization_factor=0.999, correctSolidAngle=True)

    if unit.startswith('2th'):
        attrs.update({'unit':'2th_deg'})
    else:
        attrs.update({'unit':'q_A^-1'})

    if wedge_limits is not None:
        attrs.update({'azimuth_range':wedge_limits})

    # print("Calc XRD 1D for row", ai, steps, attrs)
    q, xrd1d = [], []
    for i, xrd2d in enumerate(rowxrd2d):
        row_q,row_xrd1d = calcXRD1d(xrd2d[::dir,:], ai, steps, attrs)
        q     += [row_q]
        xrd1d += [row_xrd1d]

    return np.array(q), np.array(xrd1d)
开发者ID:maurov,项目名称:xraylarch,代码行数:54,代码来源:xrd_pyFAI.py


示例8: integrate_simple

def integrate_simple(poni_file, image_file, curve_file, nbins=1000):
    """Simple azimuthal integration for a single frame (very inefficient)
    
    :param poni_file: configuration of the geometry
    :param image_file: 
    :param curve_file: output file
    :param nbins: number of output bins
    """
    ai = pyFAI.load(poni_file)
    img = fabio.open(image_file).data
    ai.integrate1d(img, nbins, filename=curve_file, unit="2th_deg", method="splitpixel")
    return {"out_file": curve_file}
开发者ID:kif,项目名称:UPBL09a,代码行数:12,代码来源:id31.py


示例9: twth_from_xy

def twth_from_xy(x, y, ai=None, calfile=None, ang_units='degrees'):

    if ai is None: ai = pyFAI.load(calfile)

    try:
        twth = ai.tth(np.array([y,]),np.array([x,]))
    except:
        return 0

    if ang_units.startswith('rad'):
        return twth[0]
    else:
        return np.degrees(twth[0])
开发者ID:maurov,项目名称:xraylarch,代码行数:13,代码来源:xrd_pyFAI.py


示例10: eta_from_xy

def eta_from_xy(x, y, ai=None, calfile=None, ang_units='degrees'):

    if ai is None: ai = pyFAI.load(calfile)

    try:
        eta = ai.chi(np.array([y,]),np.array([x,]))
    except:
        return 0

    if ang_units.startswith('rad'):
        return eta[0]
    else:
        return np.degrees(eta[0])
开发者ID:maurov,项目名称:xraylarch,代码行数:13,代码来源:xrd_pyFAI.py


示例11: integrate_xrd

def integrate_xrd(xrd_map, AI=None, calfile=None, unit='q', steps=10000, 
                  save=True, aname = 'default', prefix = 'XRD', path = '~/',
                  mask=None, dark=None, verbose=False):

    if HAS_pyFAI:
        if AI is None:
            try:
                ai = pyFAI.load(calfile)
            except IOError:
                print('No calibration parameters specified.')
                return
        else:
            ai = calculate_ai(AI)
        
        if unit == 'q':
            iunit = 'q_A^-1'
        elif unit == '2th':
            iunit='2th_deg'
        else:
            print('Unknown unit: %s. Using q.' % unit)
            unit = 'q'
            iunit = 'q_A^-1'

        t0 = time.time()
    
        if save:
            counter = 1
            while os.path.exists('%s/%s-%s-%03d.xy' % (path,prefix,aname,counter)):
                counter += 1
            fname = '%s/%s-%s-%03d.xy' % (path,prefix,aname,counter)
            print('\nSaving %s data in file: %s\n' % (unit,fname))
            qI = ai.integrate1d(xrd_map,steps,unit=iunit,mask=mask,dark=dark,filename=fname)
        else:
            qI = ai.integrate1d(xrd_map,steps,unit=iunit,mask=mask,dark=dark)
        t1 = time.time()
        if verbose:
            print('\ttime to integrate data = %0.3f s' % ((t1-t0)))

        if verbose:
            print('Parameters for 1D integration:')
            print(ai)
    else:
        print('pyFAI not imported. Cannot calculate 1D integration without it.')
        return

    return qI
开发者ID:bruceravel,项目名称:xraylarch,代码行数:46,代码来源:xrd_calc.py


示例12: integrate_xrd

def integrate_xrd(xrd2d, calfile, unit='q', steps=2048, file='',  wedge_limits=None,
                  mask=None, dark=None, is_eiger=True, save=False, verbose=False):
    '''
    Uses pyFAI (poni) calibration file and 2D XRD image to produce 1D XRD data

    Must provide pyFAI calibration file

    xrd2d        : 2D diffraction images for integration
    calfile      : poni calibration file
    unit         : unit for integration data ('2th'/'q'); default is 'q'
    steps        : number of steps in integration data; default is 10000
    wedge_limits : azimuthal slice limits
    file         : filename for saving data; if '' (default) will not save
    mask         : mask array for image
    dark         : dark image array
    '''

    if HAS_pyFAI:
        try:
            ai = pyFAI.load(calfile)
        except:
            print('Provided calibration file could not be loaded.')
            return
    else:
        print('pyFAI not imported. Cannot calculate 1D integration.')
        return

    attrs = {}
    if unit.startswith('2th'):
        attrs.update({'unit':'2th_deg'})
    else:
        attrs.update({'unit':'q_A^-1'})

    if wedge_limits is not None:
        attrs.update({'azimuth_range':wedge_limits})

    if mask:
        if np.shape(mask) == np.shape(xrd2d): attrs.update({'mask':mask})
    if dark:
        if np.shape(dark) == np.shape(xrd2d): attrs.update({'dark':dark})

    if file is not '':
        if verbose:
            print('\nSaving %s data to file: %s' % (unit,file))
        attrs.update({'filename':file})
    return calcXRD1d(xrd2d, ai, steps, attrs)
开发者ID:maurov,项目名称:xraylarch,代码行数:46,代码来源:xrd_pyFAI.py


示例13: calc_cake

def calc_cake(xrd2d, calfile, unit='q', mask=None, dark=None,
              xsteps=2048, ysteps=2048, verbose=False):

    if HAS_pyFAI:
        try:
            ai = pyFAI.load(calfile)
        except:
            print('Provided calibration file could not be loaded.')
            return
    else:
        print('pyFAI not imported. Cannot calculate 1D integration.')
    attrs = {}
    if unit.startswith('2th'):
        attrs.update({'unit':'2th_deg'})
    else:
        attrs.update({'unit':'q_A^-1'})
    if mask:
        if np.shape(mask) == np.shape(xrd2d): attrs.update({'mask':mask})
    if dark:
        if np.shape(dark) == np.shape(xrd2d): attrs.update({'dark':dark})

    return calcXRDcake(xrd2d, ai, xsteps, ysteps, attrs)
开发者ID:maurov,项目名称:xraylarch,代码行数:22,代码来源:xrd_pyFAI.py


示例14: integrate_xrd

def integrate_xrd(xrd_map, ai=None,AI=None, calfile=None, unit='q', steps=10000, 
                  save=False, file='~/test.xy', mask=None, dark=None, verbose=False):

    if HAS_pyFAI:
        if ai is None:
            if AI is None:
                try:
                    ai = pyFAI.load(calfile)
                except IOError:
                    print('No calibration parameters specified.')
                    return
            else:
                ai = calculate_ai(AI)
        
        attrs = {}
        if unit == '2th':
            attrs.update({'unit':'2th_deg'})
        else:
            attrs.update({'unit':'q_A^-1'})
        if mask:
            attrs.update({'mask':mask})
        if dark:
            attrs.update({'dark':dark})        
        if save:
            print('Saving %s data to file: %s\n' % (unit,file))
            attrs.update({'filename':file})

        if verbose:
            t0 = time.time()
        qI = ai.integrate1d(xrd_map,steps,**attrs)
        if verbose:
            t1 = time.time()
            print('\tTime to integrate data = %0.3f s' % ((t1-t0)))

    else:
        print('pyFAI not imported. Cannot calculate 1D integration without it.')
        return

    return qI
开发者ID:bruceravel,项目名称:xraylarch,代码行数:39,代码来源:XRDCalculations.py


示例15: openPONI

    def openPONI(self,event):
             
        wildcards = 'pyFAI calibration file (*.poni)|*.poni|All files (*.*)|*.*'
        dlg = wx.FileDialog(self, message='Choose pyFAI calibration file',
                           defaultDir=os.getcwd(),
                           wildcard=wildcards, style=wx.FD_OPEN)

        path, read = None, False
        if dlg.ShowModal() == wx.ID_OK:
            read = True
            path = dlg.GetPath().replace('\\', '/')
        dlg.Destroy()
        
        if read:

            try:
                print('Loading calibration file: %s' % path)
                ai = pyFAI.load(path)
            except:
                print('Not recognized as a pyFAI calibration file.')
                return

            self.addLAMBDA(ai._wavelength,units='m')
开发者ID:bruceravel,项目名称:xraylarch,代码行数:23,代码来源:XRD1Dviewer.py


示例16: set_ponifile

 def set_ponifile(self, ponifile=None):
     if ponifile is None:
         ponifile = self.poni.text()
         print ponifile
     try:
         self.ai = pyFAI.load(ponifile)
     except Exception as error:
         logger.error("file %s does not look like a poni-file, error %s" % (ponifile, error))
         return
     self.pixel1.setText(str(self.ai.pixel1))
     self.pixel2.setText(str(self.ai.pixel2))
     self.dist.setText(str(self.ai.dist))
     self.poni1.setText(str(self.ai.poni1))
     self.poni2.setText(str(self.ai.poni2))
     self.rot1.setText(str(self.ai.rot1))
     self.rot2.setText(str(self.ai.rot2))
     self.rot3.setText(str(self.ai.rot3))
     self.splineFile.setText(self.ai.detector.splineFile or "")
     name = self.ai.detector.name.lower()
     if name in self.all_detectors:
         self.detector.setCurrentIndex(self.all_detectors.index(name))
     else:
         self.detector.setCurrentIndex(self.all_detectors.index("detector"))
开发者ID:amundhov,项目名称:pyFAI,代码行数:23,代码来源:integrate_ui.py


示例17: save1D

def save1D(filename, xaxis, I, error=None, xaxis_unit=None, calfile=None,
           has_dark=False, has_flat=False, polarization_factor=None,
           normalization_factor=None):
    '''
    copied and modified from pyFAI/io.py
    '''
    if xaxis_unit is None or xaxis_unit == 'q':
        xaxis_unit = pyFAI.units.Q_A
    elif xaxis_unit.startswith('2th'):
        xaxis_unit = pyFAI.units.TTH_DEG

    if calfile is None:
        ai = None
    else:
        ai = pyFAI.load(calfile)

    xaxis_unit = pyFAI.units.to_unit(xaxis_unit)
    with open(filename, 'w') as f:
        f.write(make_headers(has_dark=has_dark, has_flat=has_flat, ai=ai,
                                 polarization_factor=polarization_factor,
                                 normalization_factor=normalization_factor))
        try:
            f.write('\n# --> %s\n' % (filename))
        except UnicodeError:
            f.write('\n# --> %s\n' % (filename.encode('utf8')))
        if error is None:
            try:
                f.write('#%14s %14s\n' % (xaxis_unit.REPR, 'I '))
            except:
                f.write('#%14s %14s\n' % (xaxis_unit.name, 'I '))
            f.write('\n'.join(['%14.6e  %14.6e' % (t, i) for t, i in zip(xaxis, I)]))
        else:
            f.write('#%14s  %14s  %14s\n' %
                    (xaxis_unit.REPR, 'I ', 'sigma '))
            f.write('\n'.join(['%14.6e  %14.6e %14.6e' % (t, i, s) for t, i, s in zip(xaxis, I, error)]))
        f.write('\n')
开发者ID:maurov,项目名称:xraylarch,代码行数:36,代码来源:xrd_pyFAI.py


示例18: Copyright

# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
#    Project: Fast Azimuthal integration
#             https://github.com/pyFAI/pyFAI
#
#    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
#    Principal author:       Jérôme Kieffer ([email protected])
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import pyFAI, numpy
ai = pyFAI.load("mock.poni")
shape = (600, 600)
ai.xrpd_OpenCL(numpy.ones(shape), 500, devicetype="cpu", useFp64=False)
开发者ID:chiahaoliu,项目名称:pyFAI,代码行数:28,代码来源:bug_ocl_cpu.py


示例19: range

poni = os.path.join(root, "LaB6.poni")
bins = 2048
res = []
list_size = [2 ** i for i in range(10)]
with open(poni, "r") as f:
    for l in f:
        if l.startswith("SplineFile"):
            res.append("SplineFile: %s%s" % (spline, os.linesep))
        else:
            res.append(l)
with open(poni, "w") as f:
    f.writelines(res)
edf = os.path.join(root, "LaB6_0020.edf")

img = fabio.open(edf)
ai = pyFAI.load(poni)
ai.xrpd(img.data, bins)
tth = ai._ttha.ravel().astype(numpy.float32)
dtth = ai._dttha.ravel().astype(numpy.float32)
data = img.data.ravel().astype(numpy.float32)

import splitBBox
t0 = time.time()
ra, rb, rc, rd = splitBBox.histoBBox1d(data, tth, dtth, bins=bins)
t1 = time.time()
ref_time = 1000 * (t1 - t0)
print("ref time: %.2fms" % ref_time)


try:
    from pyFAI import ocl_azim
开发者ID:GiannisA,项目名称:pyFAI,代码行数:31,代码来源:test_splitBBox.py


示例20: calibration

def calibration(json: str, params: Calibration) -> None:
    """Do a calibration with a bunch of images"""

    # Definition of the geometry refinement: the parameter order is
    # the same as the param_names
    calibrant = get_calibrant(params.calibrant,
                              params.wavelength)
    detector = get_detector(params.detector)

    parameters = {p.name: p.value for p in params.initial_parameters}
    bounds = {p.name: p.bounds for p in params.initial_parameters}
    param_names = [p.name for p in params.initial_parameters]

    # Let's refine poni1 and poni2 also as function of the distance:

    trans_function = GeometryTransformation(param_names=param_names,
                                            pos_names=["delta"],
                                            dist_expr="dist",
                                            poni1_expr="poni1",  # noqa
                                            poni2_expr="poni2",  # noqa
                                            rot1_expr="rot1",
                                            rot2_expr="rot2_scale * delta + rot2_offset",  # noqa
                                            rot3_expr="rot3")

    def pos_function(frame: CalibrationFrame) -> Tuple[float]:
        """Definition of the function reading the detector position from the
        header of the image."""
        return (frame.delta,)

    gonioref = GoniometerRefinement(parameters,  # initial guess
                                    bounds=bounds,
                                    pos_function=pos_function,
                                    trans_function=trans_function,
                                    detector=detector,
                                    wavelength=params.wavelength)

    print("Empty refinement object:")
    print(gonioref)

    # Let's populate the goniometer refinement object with the know poni

    with File(params.filename, mode='r') as h5file:
        for frame in gen_metadata_idx(h5file, params):
            base = os.path.splitext(os.path.basename(params.filename))[0]

            label = base + "_%d" % (frame.idx,)
            control_points = params.filename + "_{:02d}.npt".format(frame.idx)
            ai = pyFAI.load(params.filename + "_{:02d}.poni".format(frame.idx))
            print(ai)

            gonioref.new_geometry(label, frame.image, frame,
                                  control_points, calibrant, ai)

        print("Filled refinement object:")
        print(gonioref)
        print(os.linesep + "\tlabel \t tx")
        for k, v in gonioref.single_geometries.items():
            print(k, v.get_position())

        for g in gonioref.single_geometries.values():
            ai = gonioref.get_ai(g.get_position())
            print(ai)

        for sg in gonioref.single_geometries.values():
            jupyter.display(sg=sg)

        gonioref.refine2()

    for multi in [params]:
        with File(multi.filename, mode='r') as h5file:
            optimize_with_new_images(h5file, multi, gonioref, calibrant)

    for idx, sg in enumerate(gonioref.single_geometries.values()):
        sg.geometry_refinement.set_param(gonioref.get_ai(sg.get_position()).param)  # noqa
        jupyter.display(sg=sg)

    gonioref.save(json)
开发者ID:vallsv,项目名称:pyFAI,代码行数:77,代码来源:soleil.py



注:本文中的pyFAI.load函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python azimuthalIntegrator.AzimuthalIntegrator类代码示例发布时间:2022-05-25
下一篇:
Python pyEQL.unit函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap