def exposure(band,trange,verbose=0,retries=20): """Compute the effective exposure time for a time range.""" rawexpt = trange[1]-trange[0] if rawexpt<=0: return 0. shutdead = gQuery.getArray(gQuery.shutdead(band,trange[0],trange[1]), verbose=verbose,retries=retries) # NOTE: The deadtime correction in shutdead does not work properly in FUV # so we're doing it separately for now. deadtime = gQuery.getValue(gQuery.deadtime(band,trange[0],trange[1]), verbose=verbose,retries=retries) #return (rawexpt-shutdead[0][0])*(1.-shutdead[1][0]) return (rawexpt-shutdead[0][0])*(1.-deadtime)
def test_shutdead(self): self.assertEqual(gq.shutdead(self.NUV,self.t0,self.t1),'http://masttest.stsci.edu/portal/Mashup/MashupQuery.asmx/GalexPhotonListQueryTest?query=SELECT shutter*0.05 FROM fGetNUVShutter(766525332995,866526576995) AS time UNION ALL SELECT SUM(dt) * 0.0000057142857142857145 / (866526576.995-766525332.995) AS dead FROM(SELECT count(*) AS dt FROM NUVPhotonsNULLV WHERE time BETWEEN 766525332995 AND 866526576995 UNION ALL SELECT count(*) AS dt FROM NUVPhotonsV WHERE time BETWEEN 766525332995 AND 866526576995) x&format=json&timeout={}')