Coverage for tests/testPhotometry.py : 36%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
lsst.utils.tests.init()
def tearDownClass(cls): sims_clean_up()
self.obs_metadata = ObservationMetaData(mjd=52000.7, bandpassName='i', boundType='circle', pointingRA=200.0, pointingDec=-30.0, boundLength=1.0, m5 = 25.0)
del self.obs_metadata
""" This will test our ability to do photometry using non-LSST bandpasses.
It will first calculate the magnitudes using the getters in cartoonPhotometryStars.
It will then load the alternate bandpass files 'by hand' and re-calculate the magnitudes and make sure that the magnitude values agree. This is guarding against the possibility that some default value did not change and the code actually ended up loading the LSST bandpasses. """
bandpassDir = os.path.join(lsst.utils.getPackageDir('sims_photUtils'), 'tests', 'cartoonSedTestData')
cartoon_dict = BandpassDict.loadTotalBandpassesFromFiles(['u', 'g', 'r', 'i', 'z'], bandpassDir=bandpassDir, bandpassRoot='test_bandpass_')
testBandPasses = {} keys = ['u', 'g', 'r', 'i', 'z']
bplist = []
for kk in keys: testBandPasses[kk] = Bandpass() testBandPasses[kk].readThroughput(os.path.join(bandpassDir, "test_bandpass_%s.dat" % kk)) bplist.append(testBandPasses[kk])
sedObj = Sed() phiArray, waveLenStep = sedObj.setupPhiArray(bplist)
sedFileName = os.path.join(lsst.utils.getPackageDir('sims_photUtils'), 'tests/cartoonSedTestData/starSed/') sedFileName = os.path.join(sedFileName, 'kurucz', 'km20_5750.fits_g40_5790.gz') ss = Sed() ss.readSED_flambda(sedFileName)
controlBandpass = Bandpass() controlBandpass.imsimBandpass() ff = ss.calcFluxNorm(22.0, controlBandpass) ss.multiplyFluxNorm(ff)
testMags = cartoon_dict.magListForSed(ss)
ss.resampleSED(wavelen_match = bplist[0].wavelen) ss.flambdaTofnu() mags = -2.5*np.log10(np.sum(phiArray*ss.fnu, axis=1)*waveLenStep) - ss.zp self.assertEqual(len(mags), len(testMags)) self.assertGreater(len(mags), 0) for j in range(len(mags)): self.assertAlmostEqual(mags[j], testMags[j], 10)
lsst.utils.tests.init() unittest.main() |