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


Python Bandpass.readThroughputList方法代码示例

本文整理汇总了Python中lsst.sims.photUtils.Bandpass.readThroughputList方法的典型用法代码示例。如果您正苦于以下问题:Python Bandpass.readThroughputList方法的具体用法?Python Bandpass.readThroughputList怎么用?Python Bandpass.readThroughputList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lsst.sims.photUtils.Bandpass的用法示例。


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

示例1: setUp

# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import readThroughputList [as 别名]
    def setUp(self):

        starFileName = os.path.join(lsst.utils.getPackageDir("sims_sed_library"), "starSED")
        starFileName = os.path.join(starFileName, "kurucz", "km20_5750.fits_g40_5790.gz")
        starName = os.path.join(lsst.utils.getPackageDir("sims_sed_library"), starFileName)
        self.starSED = Sed()
        self.starSED.readSED_flambda(starName)
        imsimband = Bandpass()
        imsimband.imsimBandpass()
        fNorm = self.starSED.calcFluxNorm(22.0, imsimband)
        self.starSED.multiplyFluxNorm(fNorm)

        hardwareDir = os.path.join(lsst.utils.getPackageDir("throughputs"), "baseline")
        componentList = ["detector.dat", "m1.dat", "m2.dat", "m3.dat", "lens1.dat", "lens2.dat", "lens3.dat"]
        self.skySed = Sed()
        self.skySed.readSED_flambda(os.path.join(hardwareDir, "darksky.dat"))

        totalNameList = ["total_u.dat", "total_g.dat", "total_r.dat", "total_i.dat", "total_z.dat", "total_y.dat"]

        self.bpList = []
        self.hardwareList = []
        for name in totalNameList:
            dummy = Bandpass()
            dummy.readThroughput(os.path.join(hardwareDir, name))
            self.bpList.append(dummy)

            dummy = Bandpass()
            hardwareNameList = [os.path.join(hardwareDir, name)]
            for component in componentList:
                hardwareNameList.append(os.path.join(hardwareDir, component))
            dummy.readThroughputList(hardwareNameList)
            self.hardwareList.append(dummy)

        self.filterNameList = ["u", "g", "r", "i", "z", "y"]
开发者ID:mpwiesner,项目名称:sims_photUtils,代码行数:36,代码来源:testSNR.py

示例2: testLoadBandpassesFromFiles

# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import readThroughputList [as 别名]
    def testLoadBandpassesFromFiles(self):
        """
        Test that running the classmethod loadBandpassesFromFiles produces
        expected result
        """

        fileDir = os.path.join(getPackageDir('sims_photUtils'),
                               'tests', 'cartoonSedTestData')
        bandpassNames = ['g', 'z', 'i']
        bandpassRoot = 'test_bandpass_'
        componentList = ['toy_mirror.dat']
        atmo = os.path.join(fileDir, 'toy_atmo.dat')

        bandpassDict, hardwareDict = BandpassDict.loadBandpassesFromFiles(bandpassNames=bandpassNames,
                                                                          filedir=fileDir,
                                                                          bandpassRoot=bandpassRoot,
                                                                          componentList=componentList,
                                                                          atmoTransmission=atmo)

        controlBandpassList = []
        controlHardwareList = []

        for bpn in bandpassNames:
            componentList = [os.path.join(fileDir, bandpassRoot+bpn+'.dat'),
                             os.path.join(fileDir, 'toy_mirror.dat')]

            dummyBp = Bandpass()
            dummyBp.readThroughputList(componentList)
            controlHardwareList.append(dummyBp)

            componentList = [os.path.join(fileDir, bandpassRoot+bpn+'.dat'),
                             os.path.join(fileDir, 'toy_mirror.dat'),
                             os.path.join(fileDir, 'toy_atmo.dat')]

            dummyBp = Bandpass()
            dummyBp.readThroughputList(componentList)
            controlBandpassList.append(dummyBp)

        wMin = controlBandpassList[0].wavelen[0]
        wMax = controlBandpassList[0].wavelen[-1]
        wStep = controlBandpassList[0].wavelen[1]-controlBandpassList[0].wavelen[0]

        for bp, hh in zip(controlBandpassList, controlHardwareList):
            bp.resampleBandpass(wavelen_min=wMin, wavelen_max=wMax,
                                wavelen_step=wStep)
            hh.resampleBandpass(wavelen_min=wMin, wavelen_max=wMax,
                                wavelen_step=wStep)

        for test, control in zip(bandpassDict.values(), controlBandpassList):
            np.testing.assert_array_almost_equal(test.wavelen,
                                                 control.wavelen, 19)
            np.testing.assert_array_almost_equal(test.sb, control.sb, 19)

        for test, control in zip(hardwareDict.values(), controlHardwareList):
            np.testing.assert_array_almost_equal(test.wavelen,
                                                 control.wavelen, 19)
            np.testing.assert_array_almost_equal(test.sb, control.sb, 19)
开发者ID:lsst,项目名称:sims_photUtils,代码行数:59,代码来源:testBandpassDict.py

示例3: setUpClass

# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import readThroughputList [as 别名]
    def setUpClass(cls):
        lsstDefaults=LSSTdefaults()
        cls.dbName = 'uncertaintyTestDB.db'
        if os.path.exists(cls.dbName):
            os.unlink(cls.dbName)

        default_obs_metadata = makePhoSimTestDB(filename=cls.dbName, size=10, radius = 5.0)
        bandpass = ['u', 'g', 'r', 'i', 'z', 'y']
        m5 = lsstDefaults._m5.values()

        cls.obs_metadata = ObservationMetaData(
                                              pointingRA = default_obs_metadata.pointingRA,
                                              pointingDec = default_obs_metadata.pointingDec,
                                              rotSkyPos = default_obs_metadata.rotSkyPos,
                                              bandpassName = bandpass,
                                              m5 = m5
                                              )

        cls.obs_metadata.setBandpassM5andSeeing(bandpassName=bandpass, m5=m5)
        cls.driver = 'sqlite'
        cls.host = ''

        cls.skySeds = []
        cls.hardwareBandpasses = []
        cls.totalBandpasses = []
        cls.bandpasses = ['u', 'g', 'r', 'i', 'z', 'y']

        components = ['detector.dat', 'm1.dat', 'm2.dat', 'm3.dat',
                      'lens1.dat', 'lens2.dat', 'lens3.dat']

        for b in cls.bandpasses:
            bandpassDummy = Bandpass()
            bandpassDummy.readThroughput(os.path.join(lsst.utils.getPackageDir('throughputs'),
                                                      'baseline', 'total_%s.dat' % b))
            cls.totalBandpasses.append(bandpassDummy)

        for b in cls.bandpasses:
            finalComponents = []
            for c in components:
                finalComponents.append(os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline', c))
            finalComponents.append(os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline', 'filter_%s.dat' %b))
            bandpassDummy = Bandpass()
            bandpassDummy.readThroughputList(finalComponents)
            cls.hardwareBandpasses.append(bandpassDummy)

        for i in range(len(cls.bandpasses)):
            sedDummy = Sed()
            sedDummy.readSED_flambda(os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline', 'darksky.dat'))
            normalizedSedDummy = setM5(cls.obs_metadata.m5[cls.bandpasses[i]], sedDummy,
                                       cls.totalBandpasses[i], cls.hardwareBandpasses[i],
                                       FWHMeff=lsstDefaults.FWHMeff(cls.bandpasses[i]),
                                       photParams=PhotometricParameters())

            cls.skySeds.append(normalizedSedDummy)
开发者ID:jonathansick-shadow,项目名称:sims_catUtils,代码行数:56,代码来源:testGetters.py

示例4: setUp

# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import readThroughputList [as 别名]
    def setUp(self):

        starName = os.path.join(lsst.utils.getPackageDir('sims_photUtils'),
                                'tests/cartoonSedTestData/starSed/')
        starName = os.path.join(starName, 'kurucz', 'km20_5750.fits_g40_5790.gz')
        self.starSED = Sed()
        self.starSED.readSED_flambda(starName)
        imsimband = Bandpass()
        imsimband.imsimBandpass()
        fNorm = self.starSED.calcFluxNorm(22.0, imsimband)
        self.starSED.multiplyFluxNorm(fNorm)

        hardwareDir = os.path.join(lsst.utils.getPackageDir('throughputs'), 'baseline')
        componentList = ['detector.dat', 'm1.dat', 'm2.dat', 'm3.dat',
                         'lens1.dat', 'lens2.dat', 'lens3.dat']
        self.skySed = Sed()
        self.skySed.readSED_flambda(os.path.join(hardwareDir, 'darksky.dat'))

        totalNameList = ['total_u.dat', 'total_g.dat', 'total_r.dat', 'total_i.dat',
                         'total_z.dat', 'total_y.dat']

        self.bpList = []
        self.hardwareList = []
        for name in totalNameList:
            dummy = Bandpass()
            dummy.readThroughput(os.path.join(hardwareDir, name))
            self.bpList.append(dummy)

            dummy = Bandpass()
            hardwareNameList = [os.path.join(hardwareDir, name)]
            for component in componentList:
                hardwareNameList.append(os.path.join(hardwareDir, component))
            dummy.readThroughputList(hardwareNameList)
            self.hardwareList.append(dummy)

        self.filterNameList = ['u', 'g', 'r', 'i', 'z', 'y']
开发者ID:lsst,项目名称:sims_photUtils,代码行数:38,代码来源:testSNR.py

示例5: _readCoatings

# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import readThroughputList [as 别名]
def _readCoatings(componentDir):
    """
    Read and combine the coatings in all files from a _Coatings subdirectory in componentDir.
    Return a bandpass object with all coating throughputs combined.
    """
    coatingDir = glob(os.path.join(componentDir, '*_Coatings'))
    if len(coatingDir) > 1:
        errmsg = 'Expect a single *_Coatings subdirectory for component %s.'%(componentDir)
        errmsg += ' Found %s.' %(coatingDir)
        raise ValueError(errmsg)
    coatingDir = coatingDir[0]
    if not os.path.isdir(coatingDir):
        errmsg = 'Expect %s to be a subdirectory containing coating files for component %s.' \
          %(coatingDir, componentDir)
        raise ValueError(errmsg)
    coatingfiles = glob(os.path.join(coatingDir, '*.dat'))
    if len(coatingfiles) == 0:
        errmsg = 'Expect to find at least one coating file in %s for component %s.'\
          %(coatingDir, componentDir)
        errmsg += ' Found no coating files.'
        raise ValueError(errmsg)
    coatings = Bandpass()
    coatings.readThroughputList(coatingfiles)
    return coatings
开发者ID:krvikassingh,项目名称:syseng_throughputs,代码行数:26,代码来源:bandpassUtils.py

示例6: _readLosses

# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import readThroughputList [as 别名]
def _readLosses(componentDir):
    """
    Read and combine the losses in all files from a _Losses subdirectory in componentDir.
    Return a bandpass object with all losses combined.
    """
    lossDir = glob(os.path.join(componentDir, '*_Losses'))
    if len(lossDir) > 1:
        errmsg = 'Expect a single *_Losses subdirectory for component %s.'%(componentDir)
        errmsg += ' Found %s.' %(lossDir)
        raise ValueError(errmsg)
    lossDir = lossDir[0]
    if not os.path.isdir(lossDir):
        errmsg = 'Expect %s to be a subdirectory containing loss files for component %s.' \
          %(lossDir, componentDir)
        raise ValueError(errmsg)
    lossfiles = glob(os.path.join(lossDir, '*.dat'))
    if len(lossfiles) == 0:
        errmsg = 'Expect to find at least one loss file in %s for component %s.'\
          %(lossDir, componentDir)
        errmsg += ' Found no loss files.'
        raise ValueError(errmsg)
    loss = Bandpass()
    loss.readThroughputList(lossfiles)
    return loss
开发者ID:krvikassingh,项目名称:syseng_throughputs,代码行数:26,代码来源:bandpassUtils.py

示例7: loadBandpassesFromFiles

# 需要导入模块: from lsst.sims.photUtils import Bandpass [as 别名]
# 或者: from lsst.sims.photUtils.Bandpass import readThroughputList [as 别名]
    def loadBandpassesFromFiles(cls,
                                bandpassNames=['u', 'g', 'r', 'i', 'z', 'y'],
                                filedir = os.path.join(getPackageDir('throughputs'), 'baseline'),
                                bandpassRoot = 'filter_',
                                componentList = ['detector.dat', 'm1.dat', 'm2.dat', 'm3.dat',
                                                 'lens1.dat', 'lens2.dat', 'lens3.dat'],
                                atmoTransmission=os.path.join(getPackageDir('throughputs'),
                                                              'baseline','atmos.dat')):
        """
        Load bandpass information from files into BandpassDicts.
        This method will separate the bandpasses into contributions due to instrumentations
        and contributions due to the atmosphere.

        @param [in] bandpassNames is a list of strings labeling the bandpasses
        (e.g. ['u', 'g', 'r', 'i', 'z', 'y'])

        @param [in] filedir is a string indicating the name of the directory containing the
        bandpass files

        @param [in] bandpassRoot is the root of the names of the files associated with the
        bandpasses.  This method assumes that bandpasses are stored in
        filedir/bandpassRoot_bandpassNames[i].dat

        @param [in] componentList lists the files associated with bandpasses representing
        hardware components shared by all filters
        (defaults to ['detector.dat', 'm1.dat', 'm2.dat', 'm3.dat', 'lens1.dat',
                      'lense2.dat', 'lenst3.dat']
        for LSST).  These files are also expected to be stored in filedir

        @param [in] atmoTransmission is the absolute path to the file representing the
        transmissivity of the atmosphere (defaults to baseline/atmos.dat in the LSST
        'throughputs' package).

        @param [out] bandpassDict is a BandpassDict containing the total
        throughput (instrumentation + atmosphere)

        @param [out] hardwareBandpassDict is a BandpassDict containing
        the throughput due to instrumentation only
        """

        commonComponents = []
        for cc in componentList:
            commonComponents.append(os.path.join(filedir,cc))

        bandpassList = []
        hardwareBandpassList = []

        for w in bandpassNames:
            components = commonComponents + [os.path.join(filedir,"%s.dat" % (bandpassRoot +w))]
            bandpassDummy = Bandpass()
            bandpassDummy.readThroughputList(components)
            hardwareBandpassList.append(bandpassDummy)

            components += [atmoTransmission]
            bandpassDummy = Bandpass()
            bandpassDummy.readThroughputList(components)
            bandpassList.append(bandpassDummy)


        bandpassDict = cls(bandpassList, bandpassNames)
        hardwareBandpassDict = cls(hardwareBandpassList, bandpassNames)

        return bandpassDict, hardwareBandpassDict
开发者ID:mpwiesner,项目名称:sims_photUtils,代码行数:65,代码来源:BandpassDict.py


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