当前位置: 首页>>代码示例>>Python>>正文


Python larch.Group类代码示例

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


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

示例1: __init__

    def __init__(self, filename=None, _larch=None,
                 label=None, s02=None, degen=None, e0=None,
                 ei=None, deltar=None, sigma2=None,
                 third=None, fourth=None,  **kws):

        kwargs = dict(name='FeffPath: %s' % filename)
        kwargs.update(kws)
        Group.__init__(self, **kwargs)
        self._larch = _larch
        self.filename = filename
        def_degen = 1
        if filename is not None:
            self._feffdat = FeffDatFile(filename=filename, _larch=_larch)
            self.geom  = self._feffdat.geom
            def_degen  = self._feffdat.degen
        self.degen = degen if degen is not None else def_degen
        self.label = label if label is not None else filename
        self.s02    = 1 if s02    is None else s02
        self.e0     = 0 if e0     is None else e0
        self.ei     = 0 if ei     is None else ei
        self.deltar = 0 if deltar is None else deltar
        self.sigma2 = 0 if sigma2 is None else sigma2
        self.third  = 0 if third  is None else third
        self.fourth = 0 if fourth is None else fourth
        self.k = None
        self.chi = None
开发者ID:bruceravel,项目名称:xraylarch,代码行数:26,代码来源:feffdat.py

示例2: __init__

    def __init__(self, kmin=0, kmax=20, kweight=2, dk=4, dk2=None,
                 window='kaiser', nfft=2048, kstep=0.05,
                 rmin = 0, rmax=10, dr=0, dr2=None, rwindow='hanning',
                 fitspace='r', wavelet_mask=None, _larch=None, **kws):
        Group.__init__(self, **kws)
        self.kmin = kmin
        self.kmax = kmax
        self.kweight = kweight
        if 'kw' in kws:
            self.kweight = kws['kw']

        self.dk = dk
        self.dk2 = dk2
        self.window = window
        self.rmin = rmin
        self.rmax = rmax
        self.dr = dr
        self.dr2 = dr2
        if dr2 is None: self.dr2 = self.dr
        self.rwindow = rwindow
        self.__nfft = 0
        self.__kstep = None
        self.nfft  = nfft
        self.kstep = kstep
        self.rstep = pi/(self.kstep*self.nfft)

        self.fitspace = fitspace
        self.wavelet_mask = wavelet_mask
        self._cauchymask = None

        self._larch = _larch

        self.kwin = None
        self.rwin = None
        self.make_karrays()
开发者ID:xraypy,项目名称:xraylarch,代码行数:35,代码来源:feffit.py

示例3: __init__

 def __init__(self, folder=None, _larch=None, **kws):
     kwargs = dict(name='Feff85exafs unit test: %s' % folder)
     kwargs.update(kws)
     Group.__init__(self,  **kwargs)
     self._larch     = Interpreter()
     self.doplot     = True  
     self.doscf      = False # True = use self-consistency
     self.verbose    = True  # True = print Feff's screen messages and other screenmessages
     self.feffran    = False # True = Feff calculation has been run
     self.count      = 0
     self.feffcount  = 0
     self.datacount  = 0
     self.failed     = list()
     self.folder     = folder
     if self.folder[-1] == '/': self.folder = self.folder[:-1]
     self.testrun    = realpath(join(self.folder, 'testrun'))
     self.testpaths()
     if not isdir(folder):
         print colored(folder + " is not one of the available tests", 'magenta', attrs=['bold'])
         return None
     self.path       = realpath(folder)
     self.repotop    = realpath(join('..','..'))
     # the f85e shell script emulates the behavior of the monolithic Feff application
     self.f85escript = join(self.repotop, 'bin', 'f85e')
     self.epsilon    = 0.00001
     self.epsfit     = 0.001
     self.wrapper_available = wrapper_available
     if wrapper_available:
         self.sp = scatpath()
开发者ID:bruceravel,项目名称:feff85exafs,代码行数:29,代码来源:f85ut.py

示例4: copy_group

    def copy_group(self, filename, new_filename=None):
        """copy XAS group (by filename) to new group"""
        groupname = self.file_groups[filename]
        if not hasattr(self.larch.symtable, groupname):
            return

        ogroup = self.get_group(groupname)

        ngroup = Group(datatype=ogroup.datatype,
                       copied_from=groupname)

        for attr in dir(ogroup):
            do_copy = True
            if attr in ('xdat', 'ydat', 'i0', 'data' 'yerr',
                        'energy', 'mu'):
                val = getattr(ogroup, attr)*1.0
            elif attr in ('norm', 'flat', 'deriv', 'deconv',
                          'post_edge', 'pre_edge', 'norm_mback',
                          'norm_vict', 'norm_poly'):
                do_copy = False
            else:
                try:
                    val = copy.deepcopy(getattr(ogroup, attr))
                except ValueError:
                    do_copy = False
            if do_copy:
                setattr(ngroup, attr, val)

        if new_filename is None:
            new_filename = filename + '_1'
        ngroup.filename = unique_name(new_filename, self.file_groups.keys())
        ngroup.groupname = unique_name(groupname, self.file_groups.values())
        setattr(self.larch.symtable, ngroup.groupname, ngroup)
        return ngroup
开发者ID:xraypy,项目名称:xraylarch,代码行数:34,代码来源:xasgui.py

示例5: as_group

    def as_group(self):
        """convert AthenaProect to Larch group"""
        out = Group()
        out.__doc__ = """XAFS Data from Athena Project File %s""" % (self.filename)
        out._athena_journal = self.journal
        out._athena_header = self.header

        for name, group in self.groups.items():
            setattr(out, name, group)
        return out
开发者ID:xraypy,项目名称:xraylarch,代码行数:10,代码来源:athena_project.py

示例6: __init__

 def __init__(self, folder=None, _larch=None, **kws):
     kwargs = dict(name='FeffPath wrapper')
     kwargs.update(kws)
     Group.__init__(self,  **kwargs)
     self._larch     = Interpreter()
     self.wrapper    = feffpathwrapper.FEFFPATH()
     feffpathwrapper.create_path(self.wrapper)
     self.wrapper.phpad = ''
     self.ipot = []
     self.rat  = []
     self.geom = []
开发者ID:ryanspletzer,项目名称:feff85exafs,代码行数:11,代码来源:scatteringpath.py

示例7: read_stepscan

def read_stepscan(fname, _larch=None, **kws):
    """read Epics Step Scan file to larch Group"""

    scan = EpicsScanData(fname)
    group = Group()
    group.__name__ ='Epics Step Sscan Data file %s' % fname
    for key, val in scan.__dict__.items():
        if not key.startswith('_'):
            setattr(group, key, val)

    group.get_data = scan.get_data
    return group
开发者ID:maurov,项目名称:xraylarch,代码行数:12,代码来源:stepscan_file.py

示例8: __init__

 def __init__(self, name=None, shape='gaussian',
              amplitude=1, center=0, sigma=1,
              sigma_params=None, **kws):
     kwargs = {'name': name}
     kwargs.update(kws)
     self.amplitude = amplitude
     self.center   = center
     self.sigma = sigma
     Group.__init__(self)
     self.name = name
     if name is not None:
         self._define(name, shape=shape,
                      sigma_params=sigma_params)
开发者ID:xraypy,项目名称:xraylarch,代码行数:13,代码来源:xrf_peak.py

示例9: parse_jsonathena

def parse_jsonathena(text, filename):
    """parse a JSON-style athena file"""
    jsdict = json.loads(text)

    out = Group()
    out.__doc__ = """XAFS Data from Athena Project File %s""" % (filename)

    header = []
    athena_names = []
    for key, val in jsdict.items():
        if key.startswith('_____head'):
            header.append(val)
        elif key.startswith('_____journ'):
            journal = val
        elif key.startswith('_____order'):
            athena_names = val

    out.journal = journal
    out.header = '\n'.join(header)
    out.group_names  = []
    for name in athena_names:
        label = name
        dat = jsdict[name]
        x = np.array(dat['x'], dtype='float64')
        y = np.array(dat['y'], dtype='float64')
        this = Group(athena_id=name, energy=x, mu=y,
                     bkg_params=Group(), fft_params=Group(),
                     athena_params=Group())
        if 'i0' in dat:
            this.i0 = np.array(dat['i0'], dtype='float64')
        if 'signal' in dat:
            this.signal = np.array(dat['signal'], dtype='float64')
        if 'stddev' in dat:
            this.stddev = np.array(dat['stddev'], dtype='float64')
        if 'args' in dat:
            for key, val in dat['args'].items():
                if key.startswith('bkg_'):
                    setattr(this.bkg_params, key[4:], asfloat(val))
                elif key.startswith('fft_'):
                    setattr(this.fft_params, key[4:], asfloat(val))
                elif key == 'label':
                    label = this.label = val
                else:
                    setattr(this.athena_params, key, asfloat(val))
        this.__doc__ = """Athena Group Name %s (key='%s')""" % (label, name)
        name = fix_varname(label)
        if name.startswith('_'):
            name = 'd' + name
        setattr(out, name, this)
        out.group_names.append(name)
    return out
开发者ID:xraypy,项目名称:xraylarch,代码行数:51,代码来源:athena_project.py

示例10: __init__

 def __init__(self, filename='spykscan.001', configfile=None,
              auto_increment=True, _larch=None, **kwargs):
     Group.__init__(self, **kwargs)
     self.motors  = {}
     self.detectors = []
     self.bare_counters = []
     self._scan = LarchStepScan(filename=filename,
                                auto_increment=auto_increment,
                                _larch=_larch)
     self.datafilename = filename
     if configfile is not None:
         self.configfile = configfile
     self.read_config(filename=configfile)
     self.lup = self.dscan
开发者ID:xraypy,项目名称:xraylarch,代码行数:14,代码来源:spyk.py

示例11: __init__

    def __init__(self, filename=None, bad=None, **kws):

        kwargs = {'name': 'GSE MCA File: %s' % filename}
        kwargs.update(kws)
        Group.__init__(self,  **kwargs)
        self.mcas   = []
        self.__mca0 = None
        self.bad    = bad
        if bad is None:
            self.bad = []

        self.filename = filename
        if filename:
            self.read(filename=filename)
开发者ID:bruceravel,项目名称:xraylarch,代码行数:14,代码来源:gse_mcafile.py

示例12: __init__

    def __init__(self, energy=None, mu=None, z=None, edge='K', mback_kws=None, _larch=None, **kws):
        kwargs = dict(name='diffKK')
        kwargs.update(kws)
        Group.__init__(self,  **kwargs)
        self.energy     = energy
        self.mu         = mu
        self.z          = z
        self.edge       = edge
        self.mback_kws  = mback_kws

        if _larch == None:
            self._larch   = Interpreter()
        else:
            self._larch = _larch
开发者ID:xraypy,项目名称:xraylarch,代码行数:14,代码来源:diffkk.py

示例13: __init__

 def __init__(self, feffinp=None, verbose=True, repo=None, _larch=None, **kws):
     kwargs = dict(name='Feff runner')
     kwargs.update(kws)
     Group.__init__(self,  **kwargs)
     if _larch == None:
         self._larch   = Interpreter()
     else:
         self._larch = _larch
     self.feffinp  = feffinp
     self.verbose  = verbose
     self.mpse     = False
     self.repo     = repo
     self.resolved = None
     self.threshold = []
     self.chargetransfer = []
开发者ID:Henry0422,项目名称:xraylarch,代码行数:15,代码来源:feffrunner.py

示例14: __init__

    def __init__(self, feffinp='feff.inp', folder=None, verbose=True,
                 repo=None, _larch=None, **kws):
        kwargs = dict(name='Feff runner')
        kwargs.update(kws)
        Group.__init__(self,  **kwargs)
        self._larch = _larch

        self.folder   = folder or '.'
        self.feffinp  = feffinp
        self.verbose  = verbose
        self.mpse     = False
        self.repo     = repo
        self.resolved = None
        self.threshold = []
        self.chargetransfer = []
开发者ID:xraypy,项目名称:xraylarch,代码行数:15,代码来源:feffrunner.py

示例15: __init__

    def __init__(self, data=None, pathlist=None, transform=None,
                 _larch=None, **kws):
        self._larch = _larch
        Group.__init__(self, **kws)

        self.pathlist = pathlist

        self.data = data
        if transform is None:
            transform = TransformGroup()
        self.transform = transform
        self.model = Group()
        self.model.k = None
        self.__chi = None
        self.__prepared = False
开发者ID:NEWille,项目名称:xraylarch,代码行数:15,代码来源:feffit.py


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