Coverage for python/lsst/sims/maf/stackers/snStacker.py : 29%

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
""" Stacker to estimate m5 "coadded" per band and par night
Parameters ---------- list : str, opt Name of the columns used. Default : 'observationStartMJD', 'fieldRA', 'fieldDec','filter','fiveSigmaDepth','visitExposureTime','night','observationId', 'numExposures','visitTime'
"""
numExposuresCol, visitTimeCol, visitExposureTimeCol]
"""
Parameters --------------- simData : simulation data cols_present: to check whether the field has already been estimated
Returns ----------- numpy array of initial fields plus modified fields: - m5Col: "coadded" m5 - numExposuresCol: sum of numExposuresCol - visitTimeCol: sum of visitTimeCol - visitExposureTimeCol: sum of visitExposureTimeCol - all other input fields except band (Ra, Dec, night) : median(field)
"""
if cols_present: # Column already present in data; assume it is correct and does not need recalculating. return simData self.dtype = simData.dtype r = [] for ra, dec, band in np.unique(simData[[self.RaCol, self.DecCol, self.filterCol]]): idx = np.abs(simData[self.RaCol]-ra) < 1.e-5 idx &= np.abs(simData[self.DecCol]-dec) < 1.e-5 idx &= simData[self.filterCol] == band
sel = simData[idx] for night in np.unique(sel[self.nightCol]): idxb = sel[self.nightCol] == night r.append(tuple(self.fill(sel[idxb])))
myarray = np.array(r, dtype=self.dtype) return myarray
""" Estimation of new fields (m5 "coadded" values, ...)
Parameters --------------- tab : array of (initial) data
Returns ----------- tuple with modified field values: - m5Col: "coadded" m5 - numExposuresCol: sum of numExposuresCol - visitTimeCol: sum of visitTimeCol - visitExposureTimeCol: sum of visitExposureTimeCol - all other input fields except band (Ra, Dec, night) : median(field) """
r = []
for colname in self.dtype.names: if colname not in [self.m5Col, self.numExposuresCol, self.visitTimeCol, self.visitExposureTimeCol, self.filterCol]: if colname == 'coadd': r.append(1) else: r.append(np.median(tab[colname])) if colname == self.m5Col: r.append(self.m5_coadd(tab[self.m5Col])) if colname in [self.numExposuresCol, self.visitTimeCol, self.visitExposureTimeCol]: r.append(np.sum(tab[colname])) if colname == self.filterCol: r.append(np.unique(tab[self.filterCol])[0])
return r
""" Estimation of "coadded" m5 values based on: flux_5sigma = 10**(-0.4*m5) sigmas = flux_5sigma/5. sigma_tot = 1./sqrt(np.sum(1/sigmas**2)) flux_tot = 5.*sigma_tot
Parameters --------------- m5 : set of m5 (five-sigma depths) values
Returns ----------- "coadded" m5 value """
fluxes = 10**(-0.4*m5) sigmas = fluxes/5. sigma_tot = 1./np.sqrt(np.sum(1./sigmas**2)) flux_tot = 5.*sigma_tot
return -2.5*np.log10(flux_tot) |