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


Python spparser.parse_spec函数代码示例

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


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

示例1: setup2

 def setup2(self):
    try:
         self.oldpath = os.path.abspath(os.curdir)
         if os.path.isdir(os.path.join(locations.specdir, 'generic')):
             os.chdir(os.path.join(locations.specdir, 'generic'))
         else:
             os.chdir(locations.specdir)
         self.sp = spparser.parse_spec(self.spectrum)
         self.sp = spparser.parse_spec(self.spectrum)
         self.bp = S.ObsBandpass(self.obsmode)
         self.parameters = ["spectrum=%s" % self.spectrum,
                            "instrument=%s" % self.obsmode]
    except AttributeError:
        pass
开发者ID:artifex85,项目名称:pysynphot,代码行数:14,代码来源:ticket157.py

示例2: setparms

 def setparms(self):
     self.sp=parse_spec('rn(spec(Zodi.fits),band(johnson,v),22.7,vegamag)+(spec(el1215a.fits)+spec(el1302a.fits)+spec(el1356a.fits)+spec(el2471a.fits))*0.5')
     self.bp=ObsBandpass('cos,fuv,g160m,c1577')
     self.ref_rate=3.75132e-05
     self.cmd='SpecSourcerateSpec'
     self.fname='specAV56.fits'
     self.accuracy=1e-2
开发者ID:artifex85,项目名称:pysynphot,代码行数:7,代码来源:cos_fuv_cases.py

示例3: setparms

 def setparms(self):
     self.sp=parse_spec('spec(earthshine.fits)*2.0+rn(spec(Zodi.fits),band(johnson,v),22.7,vegamag)+(spec(el1215a.fits)+spec(el1302a.fits)+spec(el1356a.fits)+spec(el2471a.fits))*0.5')
     self.bp=ObsBandpass('cos,nuv,g225m,c2186')
     self.ref_rate=0.000906
     self.cmd='SpecSourcerateSpec'
     self.fname='specAV109.fits'
     self.accuracy=1e-2
开发者ID:artifex85,项目名称:pysynphot,代码行数:7,代码来源:cos_nuv_cases.py

示例4: setUp

 def setUp(self):
     fname = os.path.join('data', 'qso_template.fits')
     self.old_cwd = os.getcwd()
     os.chdir(os.path.dirname(__file__))
     self.spstring='rn(z(spec(%s),0.03),band(johnson,v),18,vegamag)' %fname
     self.sp=spparser.parse_spec(self.spstring)
     self.sp.convert('photlam')
     self.bp=S.ObsBandpass('stis,ccd,g750l,c7751,s52x02')
     self.refwave=6200
     self.refval=2.97759742e-06
开发者ID:artifex85,项目名称:pysynphot,代码行数:10,代码来源:ticket157.py

示例5: setUp

 def setUp(self):
     #Test with the discovery case
     self.rband=(1146,1213)
     bp=S.ObsBandpass('cos,fuv,g130m,c1318,psa')
     sp=parse_spec("rn(icat(k93models,44500,0.0,5.0),box(1330.000000,1.),2e-013,flam)")
     self.obs=S.Observation(sp,bp)
开发者ID:artifex85,项目名称:pysynphot,代码行数:6,代码来源:ticket174.py

示例6: testparse_iraf

 def testparse_iraf(self):
     sp = parse_spec('crcalspec$gd50_004.fits')
     self.assertTrue(self.ref == str(sp))
开发者ID:artifex85,项目名称:pysynphot,代码行数:3,代码来源:ticket52.py

示例7: setup2

    def setup2(cls):
        #Do the common setup here.
        cls.sigthresh = 0.01
        cls.thresh = 0.01
        okfile = os.path.join(cls.location,
                              cls.fname.replace('_%s.fits', '.okfile'))
        cls.tda = dict(obsmode=cls.obsmode,
                       spectrum=cls.spectrum,
                       thresh=cls.thresh,
                       sigthresh=cls.sigthresh,
                       _okfile=okfile)
        cls.tra = dict()

        cls.okset = set()  # Tracks okifying bookkeeping

        if cls.obsmode != 'None':
            kind = 'thru'
            cls.bp=S.ObsBandpass(cls.obsmode)
            tname = os.path.join(cls.location, cls.fname % kind)
            cls.bp.writefits(tname, clobber=True, trimzero=False)
            cls.tra[kind] = cls.bp.name
            cls.okset.add(kind)
        else:
            cls.bp = None


        if cls.spectrum != 'None':
            kind = 'spec'
        #All the data lives in a parallel directory, so go sit there
        #in case we need a file
            os.chdir(DATADIR)
            cls.sp = spparser.parse_spec(cls.spectrum)
            os.chdir(cls.location)
            tname = os.path.join(cls.location, cls.fname % kind)
            cls.sp.writefits(tname, clobber=True, trimzero=False)
            cls.tra[kind] = cls.sp.name
            cls.okset.add(kind)
        else:
            cls.sp = None


        if 'None' not in (cls.obsmode, cls.spectrum):
            kind = 'obs'
            try:
                cls.obs = S.Observation(cls.sp, cls.bp)
            except ValueError as e:
                #Force extrapolation in the case of partialoverlap
                try:
                    cls.obs = S.Observation(cls.sp, cls.bp, force='extrap')
                    cls.tda['extrap']=True
                except ValueError as e:
                    cls.tra['obs_error'] = str(e)
                    cls.obs = str(e)
                    return  # then the obs tests should raise errors

            cls.obs.convert('counts')
            x = dict(PSCNTRAT = (cls.obs.countrate(),'countrate'),
                     PSEFFLAM = (cls.obs.efflam(),'efflam'))
            tname = os.path.join(cls.location, cls.fname % kind)
            cls.obs.writefits(tname, hkeys=x, clobber=True, trimzero=False)
            cls.tra[kind] = cls.obs.name
            cls.okset.add(kind)
        else:
            cls.obs = None
开发者ID:artifex85,项目名称:pysynphot,代码行数:64,代码来源:conv_base.py

示例8: testparse

 def testparse(self):
     sp2=spparser.parse_spec(self.cmd)
     ratio=sp2.flux/self.sp.flux
     self.failUnless(N.all(1-abs(ratio/self.ref)<0.0001))
开发者ID:artifex85,项目名称:pysynphot,代码行数:4,代码来源:ticket150.py

示例9: testparse

 def testparse(self):
     self.spstring=spparser.parse_spec(self.spstring)
开发者ID:artifex85,项目名称:pysynphot,代码行数:2,代码来源:ticket126.py

示例10: testparse_shell

 def testparse_shell(self):
     sp = parse_spec('$PYSYN_CDBS/calspec/gd50_004.fits')
     self.assertTrue(self.ref == str(sp))
开发者ID:artifex85,项目名称:pysynphot,代码行数:3,代码来源:ticket52.py


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