Ejemplo n.º 1
0
 def run(self, dataslice, slicePoint=None):
     filters = np.unique(dataslice['filter'])
     filters = [str(f) for f in filters]
     precis = np.zeros(dataslice.size, dtype='float')
     for f in filters:
         observations = np.where(dataslice['filter'] == f)
         if np.size(observations[0]) < 2:
             precis[observations] = self.badval
         else:
             snr = mafUtils.m52snr(self.mags[f],
                                   dataslice[self.m5Col][observations])
             precis[observations] = mafUtils.astrom_precision(
                 dataslice[self.seeingCol][observations], snr)
             precis[observations] = np.sqrt(precis[observations]**2 +
                                            self.atm_err**2)
     good = np.where(precis != self.badval)
     result = mafUtils.sigma_slope(dataslice[self.mjdCol][good],
                                   precis[good])
     result = result * 365.25 * 1e3  # Convert to mas/yr
     if (self.normalize) & (good[0].size > 0):
         new_dates = dataslice[self.mjdCol][good] * 0
         nDates = new_dates.size
         new_dates[nDates // 2:] = self.baseline * 365.25
         result = (mafUtils.sigma_slope(new_dates, precis[good]) * 365.25 *
                   1e3) / result
     # Observations that are very close together can still fail
     if np.isnan(result):
         result = self.badval
     return result
Ejemplo n.º 2
0
 def run(self, dataslice, slicePoint=None):
     filters = np.unique(dataslice['filter'])
     precis = np.zeros(dataslice.size, dtype='float')
     for f in filters:
         observations = np.where(dataslice['filter'] == f)
         if np.size(observations[0]) < 2:
             precis[observations] = self.badval
         else:
             snr = mafUtils.m52snr(self.mags[f],
                dataslice[self.m5Col][observations])
             precis[observations] = mafUtils.astrom_precision(
                 dataslice[self.seeingCol][observations], snr)
             precis[observations] = np.sqrt(precis[observations]**2 + self.atm_err**2)
     good = np.where(precis != self.badval)
     result = mafUtils.sigma_slope(dataslice['expMJD'][good], precis[good])
     result = result*365.25*1e3 #convert to mas/yr
     if (self.normalize) & (good[0].size > 0):
         new_dates=dataslice['expMJD'][good]*0
         nDates = new_dates.size
         new_dates[nDates/2:] = self.baseline*365.25
         result = (mafUtils.sigma_slope(new_dates,  precis[good])*365.25*1e3)/result
     # Observations that are very close together can still fail
     if np.isnan(result):
         result = self.badval
     return result