本文整理汇总了Python中lsst.sims.photUtils.BandpassDict.values方法的典型用法代码示例。如果您正苦于以下问题:Python BandpassDict.values方法的具体用法?Python BandpassDict.values怎么用?Python BandpassDict.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lsst.sims.photUtils.BandpassDict
的用法示例。
在下文中一共展示了BandpassDict.values方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWavelenMatch
# 需要导入模块: from lsst.sims.photUtils import BandpassDict [as 别名]
# 或者: from lsst.sims.photUtils.BandpassDict import values [as 别名]
def testWavelenMatch(self):
"""
Test that when you load bandpasses sampled over different
wavelength grids, they all get sampled to the same wavelength
grid.
"""
dwavList = numpy.arange(5.0,25.0,5.0)
bpList = []
bpNameList = []
for ix, dwav in enumerate(dwavList):
name = 'bp_%d' % ix
wavelen = numpy.arange(10.0, 1500.0, dwav)
sb = numpy.exp(-0.5*(numpy.power((wavelen-100.0*ix)/100.0,2)))
bp = Bandpass(wavelen=wavelen, sb=sb)
bpList.append(bp)
bpNameList.append(name)
# First make sure that we have created distinct wavelength grids
for ix in range(len(bpList)):
for iy in range(ix+1,len(bpList)):
self.assertTrue(len(bpList[ix].wavelen)!=len(bpList[iy].wavelen))
testDict = BandpassDict(bpList, bpNameList)
# Now make sure that the wavelength grids in the dict were resampled, but that
# the original wavelength grids were not changed
for ix in range(len(bpList)):
numpy.testing.assert_array_almost_equal(testDict.values()[ix].wavelen, testDict.wavelenMatch, 19)
if ix!=0:
self.assertTrue(len(testDict.wavelenMatch)!=len(bpList[ix].wavelen))
示例2: testInitialization
# 需要导入模块: from lsst.sims.photUtils import BandpassDict [as 别名]
# 或者: from lsst.sims.photUtils.BandpassDict import values [as 别名]
def testInitialization(self):
"""
Test that all of the member variables of BandpassDict are set
to the correct value upon construction.
"""
for nBp in range(3,10,1):
nameList, bpList = self.getListOfBandpasses(nBp)
testDict = BandpassDict(bpList, nameList)
self.assertEqual(len(testDict), nBp)
for controlName, testName in zip(nameList, testDict):
self.assertEqual(controlName, testName)
for controlName, testName in zip(nameList, testDict.keys()):
self.assertEqual(controlName, testName)
for name, bp in zip(nameList, bpList):
numpy.testing.assert_array_almost_equal(bp.wavelen, testDict[name].wavelen, 10)
numpy.testing.assert_array_almost_equal(bp.sb, testDict[name].sb, 10)
for bpControl, bpTest in zip(bpList, testDict.values()):
numpy.testing.assert_array_almost_equal(bpControl.wavelen, bpTest.wavelen, 10)
numpy.testing.assert_array_almost_equal(bpControl.sb, bpTest.sb, 10)
示例3: testFluxDictForSed
# 需要导入模块: from lsst.sims.photUtils import BandpassDict [as 别名]
# 或者: from lsst.sims.photUtils.BandpassDict import values [as 别名]
def testFluxDictForSed(self):
"""
Test that fluxDictForSed calculates the correct fluxes
"""
wavelen = numpy.arange(10.0,2000.0,1.0)
flux = (wavelen*2.0-5.0)*1.0e-6
spectrum = Sed(wavelen=wavelen, flambda=flux)
for nBp in range(3, 10, 1):
nameList, bpList = self.getListOfBandpasses(nBp)
testDict = BandpassDict(bpList, nameList)
self.assertFalse(len(testDict.values()[0].wavelen)==len(spectrum.wavelen))
fluxDict = testDict.fluxDictForSed(spectrum)
for ix, (name, bp) in enumerate(zip(nameList, bpList)):
fluxControl = spectrum.calcFlux(bp)
self.assertAlmostEqual(fluxDict[name]/fluxControl, 1.0, 2)
示例4: testMagListForSed
# 需要导入模块: from lsst.sims.photUtils import BandpassDict [as 别名]
# 或者: from lsst.sims.photUtils.BandpassDict import values [as 别名]
def testMagListForSed(self):
"""
Test that magListForSed calculates the correct magnitude
"""
wavelen = numpy.arange(10.0,2000.0,1.0)
flux = (wavelen*2.0-5.0)*1.0e-6
spectrum = Sed(wavelen=wavelen, flambda=flux)
for nBp in range(3, 10, 1):
nameList, bpList = self.getListOfBandpasses(nBp)
testDict = BandpassDict(bpList, nameList)
self.assertFalse(len(testDict.values()[0].wavelen)==len(spectrum.wavelen))
magList = testDict.magListForSed(spectrum)
for ix, (name, bp, magTest) in enumerate(zip(nameList, bpList, magList)):
magControl = spectrum.calcMag(bp)
self.assertAlmostEqual(magTest, magControl, 5)