예제 #1
0
 def mkGalPhot(self):
     ifh = open(self.mfile)
     lnum = 0
     k = None
     for l in ifh:
         flds = l.rstrip().split()
         if l.startswith("Opsim_filter"):
             self.filter = self.filtmap[int(flds[1])]
             k = self.filter
     ifh.close()
     ifh = open(self.tfile)
     for l in ifh:
         flds = l.rstrip().split()
         if not flds[0] == "object":
             continue
         otype = flds[12]
         if otype != "sersic2D":
             continue
         id = float(flds[1])
         if not self.centdata.has_key(id):
             continue
         magNorm = float(flds[4])
         spec = flds[5]
         redshift = float(flds[6])
         ind = float(flds[16])
         mwav = float(flds[21])
         av = float(flds[18])
         sed = Sed()
         sed.readSED_flambda(self.spath+"/"+spec)
         a_int, b_int = sed.setupCCMab()
         self.outdata['id'].append(id)
         if lnum > self.donum and self.donum is not None:
             break
         if lnum%10000 == 0:
             print id
         fluxNorm = sed.calcFluxNorm(magNorm, self.imsimband)
         sed.multiplyFluxNorm(fluxNorm/(1+redshift))
         sed.addCCMDust(a_int, b_int, A_v=av)
         sed.redshiftSED(redshift, dimming=False)
         a_mw, b_mw = sed.setupCCMab()
         sed.addCCMDust(a_mw, b_mw, A_v=mwav)
         line = {'flux':None, 'mag':None}
         mag = sed.calcMag(self.bands[k])
         flux = sed.calcADU(self.bands[k], gain=1.0)
         line['mag'] = mag
         line['flux'] = flux
         self.outdata[k].append(line)
         lnum += 1
     ifh.close()
예제 #2
0
 def mkStarPhot(self):
     ifh = open(self.mfile)
     lnum = 0
     k = None
     for l in ifh:
         flds = l.rstrip().split()
         if l.startswith("Opsim_filter"):
             self.filter = self.filtmap[int(flds[1])]
             k = self.filter
     ifh.close()
     ifh = open(self.tfile)
     for l in ifh:
         flds = l.rstrip().split()
         if not flds[0] == "object":
             continue
         otype = flds[12]
         if otype != "point":
             continue
         id = float(flds[1])
         if not self.centdata.has_key(id):
             continue
         magNorm = float(flds[4])
         spec = flds[5]
         av = float(flds[14])
         sed = Sed()
         self.outdata['id'].append(id)
         if re.search("kurucz", spec):
           sed.readSED_flambda(self.spath+"/"+spec)
         else:
           sed.readSED_flambda(self.spath+"/"+spec)
         fluxNorm = sed.calcFluxNorm(magNorm, self.imsimband)
         sed.multiplyFluxNorm(fluxNorm)
         a, b = sed.setupCCMab()
         sed.addCCMDust(a, b, A_v=av)
         line = {'flux':None, 'mag':None}
         mag = sed.calcMag(self.bands[k])
         flux = sed.calcADU(self.bands[k], gain=1.)
         line['mag'] = mag
         line['flux'] = flux
         self.outdata[k].append(line)
         lnum += 1
     ifh.close()