self.cmd='SpecSourcerateSpec' self.fname='specAV107.fits' self.accuracy=1e-2 class C25(etctest_base_class.ETCTestCase): def setparms(self): self.sp=parse_spec('spec(earthshine.fits)+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.000899 self.cmd='SpecSourcerateSpec' self.fname='specAV108.fits' self.accuracy=1e-2 class C26(etctest_base_class.ETCTestCase): 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 if __name__ == '__main__': if 'debug' in sys.argv: testutil.debug(__name__) else: if 'verbose' in sys.argv: testutil.testall(__name__,2) else: testutil.testall(__name__)
def testkeepmin(self): self.sp = S.FileSpectrum(self.fname, keepneg=True) self.obs = Observation(self.sp, self.bp) self.assertTrue(self.obs.flux.min() < 0) def testarray(self): waves = N.arange(1000, 6000, 1000) flux = N.array([1.0, 0.5, -0.5, 0.75, 1.0]) self.sp = S.ArraySpectrum(wave=waves, flux=flux) self.assertEqual(self.sp.flux[2], 0.0) def testarraykeep(self): waves = N.arange(1000, 6000, 1000) flux = N.array([1.0, 0.5, -0.5, 0.75, 1.0]) self.sp = S.ArraySpectrum(wave=waves, flux=flux, keepneg=True) self.assertEqual(self.sp.flux[2], -0.5) def testmagarray(self): waves = N.arange(1000, 6000, 1000) flux = N.array([1.0, 0.5, -0.5, 0.75, 1.0]) self.sp = S.ArraySpectrum(wave=waves, flux=flux, fluxunits='ABMag') self.assertAlmostEqual(self.sp.flux[2], -0.5, 4) if __name__ == '__main__': if 'debug' in sys.argv: testutil.debug(__name__) else: testutil.testall(__name__, 2)
class PowerLawTest(SpecTestCase): def setUp(self): self.sp = spectrum.Powerlaw(6000, 3) class BlackBodyTest(SpecTestCase): def setUp(self): self.sp = S.BlackBody(60000) class CompositeAnalTest(SpecTestCase): def setUp(self): self.sp = S.BlackBody(60000) + S.GaussianSource(1e-12, 5000, 30) class CompositeFileTest(SpecTestCase): def setUp(self): self.comp1 = S.FileSpectrum( os.path.join(os.environ['PYSYN_CDBS'], 'calspec', 'alpha_lyr_stis_003.fits')) self.comp2 = S.FlatSpectrum(10) self.sp = self.comp1 + self.comp2 if __name__ == '__main__': if 'debug' in sys.argv: testutil.debug(__name__, 2) else: testutil.testall(__name__, 2)