當前位置: 首頁>>代碼示例>>Python>>正文


Python Group.delr方法代碼示例

本文整理匯總了Python中larch.Group.delr方法的典型用法代碼示例。如果您正苦於以下問題:Python Group.delr方法的具體用法?Python Group.delr怎麽用?Python Group.delr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在larch.Group的用法示例。


在下文中一共展示了Group.delr方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: do_fit

# 需要導入模塊: from larch import Group [as 別名]
# 或者: from larch.Group import delr [as 別名]
def do_fit(self, which, firstshell=False, fittest='baseline'):

    if which == 'testrun':
        folder = self.testrun
    elif which == 'baseline':
        folder = self.baseline
    else:
        folder = realpath(join(self.folder, fittest, which))
    #endif

    data = read_xdi(join(self.path, 'BaZrO3.chik'), _larch=self._larch)

    gds = Group(amp    = Parameter(0.95,    vary=True,  _larch=self._larch),
                enot   = Parameter(1e-7,    vary=True,  _larch=self._larch),
                sso    = Parameter(0.003,   vary=True,  _larch=self._larch),
                czr    = Parameter(0.,      vary=False, _larch=self._larch), _larch=self._larch  )

    if firstshell:
        gds.delr   = Parameter(1e-7,    vary=True,  _larch=self._larch)
        dr1param   = 'delr'
    else:
        gds.alpha  = Parameter(0.00001, vary=True,  _larch=self._larch)
        gds.ssba   = Parameter(0.003,   vary=True,  _larch=self._larch)
        gds.sszr   = Parameter(0.003,   vary=True,  _larch=self._larch)
        gds.eba    = Parameter(1e-7,    vary=True,  _larch=self._larch)
        gds.ezr    = Parameter(1e-7,    vary=True,  _larch=self._larch)
        #gds.eba    = Parameter(expr='enot',          _larch=self._larch)
        #gdsezr    = Parameter(expr='enot',         _larch=self._larch)
        gds.sso2   = Parameter(0.003,   vary=True,  _larch=self._larch)
        dr1param   = 'alpha*reff'

    paths = list()
    paths.append(feffpath(realpath(join(folder, "feff0001.dat")),
                          s02    = 'amp',
                          deltar = dr1param,
                          e0     = 'enot',
                          sigma2 = 'sso',
                          _larch=self._larch))
    if not firstshell:
        paths.append(feffpath(realpath(join(folder, "feff0002.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = 'enot',
                              sigma2 = 'sso*1.5',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0003.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = 'eba',
                              sigma2 = 'ssba',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0004.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = 'ezr',
                              sigma2 = 'sszr',
                              third  = 'czr',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0005.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = 'enot',
                              sigma2 = 'sso*2',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0006.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = '(enot+ezr)/2',
                              sigma2 = 'sszr',
                              third  = 'czr',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0007.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = 'enot',
                              sigma2 = 'sso*2',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0009.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = '(2*enot+ezr)/3',
                              sigma2 = 'sszr',
                              third  = 'czr',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0008.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = 'enot',
                              sigma2 = 'sso*4',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0011.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = '(enot+eba)/2',
                              sigma2 = 'ssba+sso',
                              _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0012.dat")),
                              s02    = 'amp',
                              deltar = 'alpha*reff',
                              e0     = 'enot',
#.........這裏部分代碼省略.........
開發者ID:bruceravel,項目名稱:SCFtests,代碼行數:103,代碼來源:BaZrO3.py

示例2: do_fit

# 需要導入模塊: from larch import Group [as 別名]
# 或者: from larch.Group import delr [as 別名]
def do_fit(self, which, firstshell=False, fittest='baseline'):

    if which == 'testrun':
        folder = self.testrun
    elif which == 'baseline':
        folder = self.baseline
    else:
        folder = realpath(join(self.folder, fittest, which))
    #endif

    data = read_xdi(join(self.path, 'NiO.chik'), _larch=self._larch)
    if hasattr(data, 'wavenumber'):
        data.k = data.wavenumber

    gds = Group(amp    = Parameter(1,      vary=True, _larch=self._larch),
                enot   = Parameter(1e-7,   vary=True, _larch=self._larch),
                sso    = Parameter(0.003,  vary=True, _larch=self._larch), _larch=self._larch  )

    if firstshell:
        gds.delr   = Parameter(1e-7,   vary=True, _larch=self._larch)
        dr1param   = 'delr'
    else:
        gds.alpha  = Parameter(1e-7,   vary=True, _larch=self._larch)
        gds.ssni   = Parameter(0.003,  vary=True, _larch=self._larch)
        gds.sso2   = Parameter(0.003,  vary=True, _larch=self._larch)
        #gds.sso3   = Parameter(0.003,  vary=True, _larch=self._larch)
        gds.ssni2  = Parameter(0.003,  vary=True, _larch=self._larch)
        #gds.ssni3  = Parameter(0.003,  vary=True, _larch=self._larch)
        #gds.ssni4  = Parameter(0.003,  vary=True, _larch=self._larch)
        dr1param   = 'alpha*reff'

    paths = list() 
    paths.append(feffpath(realpath(join(folder, "feff0001.dat")), # 1st shell O SS
                          s02    = 'amp',
                          e0     = 'enot',
                          sigma2 = 'sso',
                          deltar = dr1param, _larch=self._larch))
    if not firstshell:
        paths.append(feffpath(realpath(join(folder, "feff0002.dat")), # 2nd shell Ni SS
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'ssni',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0003.dat")), # O-O triangle
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = '1.5*sso',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0004.dat")), # O-Ni triangle
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'sso+ssni/2',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0005.dat")), # 3rd shell O SS
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'sso2',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0006.dat")), # 4th shell Ni SS
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'ssni2',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0007.dat")), # O-O non-forward linear
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'sso*2',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0008.dat")), # O-Ni forward scattering
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'ssni2',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0009.dat")), # O-O forward through absorber
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'sso*2',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0011.dat")), # O-Ni-O double forward
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'ssni2',
                              deltar = 'alpha*reff', _larch=self._larch))
        paths.append(feffpath(realpath(join(folder, "feff0010.dat")), # O-O rattle (the order of 10 and 11 is different in Demeter's pathfinder!)
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = 'sso*4',
                              deltar = 'alpha*reff', _larch=self._larch))

    rx  = 4.2
    if firstshell: rx  = 1.95

    trans = feffit_transform(kmin=3, kmax=15.938, kw=(2,1,3), dk=1, window='hanning', rmin=1.0, rmax=rx, _larch=self._larch)
    dset  = feffit_dataset(data=data, pathlist=paths, transform=trans, _larch=self._larch)
    fit   = feffit(gds, dset, _larch=self._larch)

    if self.doplot:
        offset = 0.6*max(dset.data.chir_mag)
        _newplot(dset.data.r,  dset.data.chir_mag+offset, xmax=8,
              xlabel=r'$R \rm\,(\AA)$', label='data',
#.........這裏部分代碼省略.........
開發者ID:bruceravel,項目名稱:SCFtests,代碼行數:103,代碼來源:NiO.py

示例3: do_fit

# 需要導入模塊: from larch import Group [as 別名]
# 或者: from larch.Group import delr [as 別名]
def do_fit(self, which, firstshell=False, fittest='baseline'):

    if which == 'testrun':
        folder = self.testrun
    elif which == 'baseline':
        folder = self.baseline
    else:
        folder = realpath(join(self.folder, fittest, which))
    #endif

    data = read_xdi(join(self.path, 'Copper.chik'), _larch=self._larch)

    gds = Group(amp    = Parameter(1,     vary=True,  _larch=self._larch),
                enot   = Parameter(1e-7,  vary=True,  _larch=self._larch),
                ss1    = Parameter(0.003, vary=True,  _larch=self._larch), _larch=self._larch  )

    if firstshell:
        gds.delr   = Parameter(1e-7,   vary=True, _larch=self._larch)
        dr1param   = 'delr'
    else:
        gds.thetad = Parameter(500,   vary=True,  _larch=self._larch)
        gds.temp   = Parameter(10,    vary=False, _larch=self._larch)
        gds.alpha  = Parameter(1e-7,  vary=True,  _larch=self._larch)
        dr1param   = 'alpha*reff'

    imax = 16
    if firstshell: imax = 2
    paths = list()
    for index in range(1,imax):
        nnnn = realpath(join(folder, "feff%4.4d.dat" % index))
        if not exists(nnnn):
            continue
        #end if
        if index > 1:
            sigsqr = 'sigma2_debye(temp, thetad)' 
        else:
            sigsqr = 'ss1'
        #end if
        paths.append(feffpath(nnnn,
                              s02    = 'amp',
                              e0     = 'enot',
                              sigma2 = sigsqr,
                              deltar = dr1param, _larch=self._larch))
    #end for

    rx  = 5.0
    if firstshell: rx  = 2.8

    trans = feffit_transform(kmin=3, kmax=15, kw=(2,1,3), dk=1, window='hanning', rmin=1, rmax=rx, _larch=self._larch)
    dset  = feffit_dataset(data=data, pathlist=paths, transform=trans, _larch=self._larch)
    fit   = feffit(gds, dset, _larch=self._larch)

    if self.doplot:
        offset = max(dset.data.chir_mag)
        _newplot(dset.data.r,  dset.data.chir_mag+offset, xmax=8,
              xlabel=r'$R \rm\,(\AA)$', label='data',
              ylabel=r'$|\chi(R)| \rm\,(\AA^{-3})$',
              title='Fit to '+self.folder, show_legend=True, _larch=self._larch)
        _plot(dset.model.r, dset.model.chir_mag+offset, label='fit', _larch=self._larch)
        _plot(dset.data.r,  dset.data.chir_re, label='data', _larch=self._larch)
        _plot(dset.model.r, dset.model.chir_re, label='fit', _larch=self._larch)
    #end if
    
    if self.verbose:
        print feffit_report(fit, _larch=self._larch)
    #end if

    shells = ''
    if firstshell: shells='_1st'

    write_ascii(join(self.folder, fittest, "fit_"+which+shells+".k"), dset.data.k, dset.data.chi, dset.model.chi,
                labels="r data_mag fit_mag data_re fit_re", _larch=self._larch)
    write_ascii(join(self.folder, fittest, "fit_"+which+shells+".r"), dset.data.r, dset.data.chir_mag, dset.model.chir_mag,
                dset.data.chir_re, dset.model.chir_re, labels="r data_mag fit_mag data_re fit_re", _larch=self._larch)

    renderer = pystache.Renderer()
    with open(join(self.folder, fittest, 'fit_'+which+shells+'.gp'), 'w') as inp:
        inp.write(renderer.render_path( 'plot.mustache', # gnuplot mustache file
                                        {'material': 'Copper',
                                         'model': which,
                                         'fittest': fittest,
                                         'shells': shells,
                                         'kmin': 3,
                                         'kmax': 15,
                                         'rmin': 1,
                                         'rmax': rx,
                                         'offset': 2,
                                     } ))

    return fit
開發者ID:bruceravel,項目名稱:SCFtests,代碼行數:92,代碼來源:Copper.py


注:本文中的larch.Group.delr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。