def _run(self, simData): # find the seasons associated with each visit. seasons = calcSeason(simData[self.raCol], simData[self.expMJDCol]) # check how many entries in the >10 season ind = np.where(seasons > 9)[0] # should be only 1 extra seasons .. if len(np.unique(seasons[ind])) > 1: raise ValueError( 'Too many seasons (more than 11). Check SeasonStacker.') if self.wrapLastSeason: print('Seasons to wrap ', np.unique(seasons[ind])) # wrap the season around: 10th == 0th seasons[ind] = seasons[ind] % 10 # Generate the spiral offset vertices. self._generateSpiralOffsets() # Add to RA and dec values. vertexID = 0 for s in np.unique(seasons): match = np.where(seasons == s)[0] vertexID = vertexID % self.numPoints simData['spiralDitherPerSeasonRa'][match] = simData[self.raCol][match] \ + self.xOff[vertexID]/np.cos(simData[self.decCol][match]) simData['spiralDitherPerSeasonDec'][match] = simData[ self.decCol][match] + self.yOff[vertexID] vertexID += 1 # Wrap into expected range. simData['spiralDitherPerSeasonRa'], simData['spiralDitherPerSeasonDec'] = \ wrapRADec(simData['spiralDitherPerSeasonRa'], simData['spiralDitherPerSeasonDec']) return simData
def _run(self, simData): # find the seasons associated with each visit. seasons = calcSeason(simData[self.raCol], simdata[self.expMJDCol]) # check how many entries in the >10 season ind = np.where(seasons > 9)[0] # should be only 1 extra seasons .. if len(np.unique(seasons[ind])) > 1: raise ValueError( 'Too many seasons (more than 11). Check SeasonStacker.') if self.wrapLastSeason: print('Seasons to wrap ', np.unique(seasons[ind])) # wrap the season around: 10th == 0th seasons[ind] = seasons[ind] % 10 # Generate the spiral offset vertices. self._generatePentagonOffsets() # Now apply to observations. for fieldid in np.unique(simData[self.fieldIdCol]): match = np.where(simData[self.fieldIdCol] == fieldid)[0] seasonsVisited = seasons[match] # Apply sequential dithers, increasing with each season. vertexIdxs = np.searchsorted(np.unique(seasonsVisited), seasonsVisited) vertexIdxs = vertexIdxs % len(self.xOff) simData['pentagonDitherFieldPerSeasonRa'][match] = simData[self.raCol][match] + \ self.xOff[vertexIdxs]/np.cos(simData[self.decCol][match]) simData['pentagonDitherFieldPerSeasonDec'][match] = simData[self.decCol][match] \ + self.yOff[vertexIdxs] # Wrap into expected range. simData['pentagonDitherFieldPerSeasonRa'], simData['pentagonDitherFieldPerSeasonDec'] = \ wrapRADec(simData['pentagonDitherFieldPerSeasonRa'], simData['pentagonDitherFieldPerSeasonDec']) return simData
def _run(self, simData): # find the seasons associated with each visit. seasons = calcSeason(simData[self.raCol], simData[self.expMJDCol]) years = simData[self.nightCol] % 365.25 # check how many entries in the >10 season ind = np.where(seasons > 9)[0] # should be only 1 extra seasons .. if len(np.unique(seasons[ind])) > 1: raise ValueError( 'Too many seasons (more than 11). Check SeasonStacker.') if self.wrapLastSeason: # check how many entries in the >10 season print('Seasons to wrap ', np.unique(seasons[ind]), 'with total entries: ', len(seasons[ind])) seasons[ind] = seasons[ind] % 10 # Generate the spiral offset vertices. self._generatePentagonOffsets() # print details print('Total visits for all fields:', len(seasons)) print('') # Add to RA and dec values. vertexID = 0 for s in np.unique(seasons): match = np.where(seasons == s)[0] # print details print('season', s) print('numEntries ', len(match), '; ', float(len(match)) / len(seasons) * 100, '% of total') matchYears = np.unique(years[match]) print('Corresponding years: ', matchYears) for i in matchYears: print(' Entries in year', i, ': ', len(np.where(i == years[match])[0])) print('') vertexID = vertexID % len(self.xOff) simData['pentagonDitherPerSeasonRa'][match] = simData[self.raCol][match] + self.xOff[vertexID]\ /np.cos(simData[self.decCol][match]) simData['pentagonDitherPerSeasonDec'][match] = simData[ self.decCol][match] + self.yOff[vertexID] vertexID += 1 # Wrap into expected range. simData['pentagonDitherPerSeasonRa'], simData['pentagonDitherPerSeasonDec'] = \ wrapRADec(simData['pentagonDitherPerSeasonRa'], simData['pentagonDitherPerSeasonDec']) return simData