def run(self, simData): # find the seasons associated with each visit. seasonSimData = SeasonStacker().run(simData) seasons = seasonSimData['season'] years = seasonSimData['year'] # check how many entries in the >10 season ind = np.where(seasons > 9)[0] print 'Seasons to wrap ', np.unique( seasons[ind]), 'with total entries: ', len(seasons[ind]) # should be only 1 extra seasons .. #if len(np.unique(seasons[ind])) > 1: # print 'ERROR: Too many seasons' # stop # wrap the season around: 10th == 0th seasons[ind] = seasons[ind] % 10 # Add the new columns to simData. simData = self._addStackers(simData) # Generate the spiral offset vertices. self._generatePentagonOffsets() print 'Total visits for all fields:', len(seasons) print '' # for debugging; fill dithered as non-dithered #simData['PentagonDitherPerSeasonRA'] = simData[self.raCol] #simData['PentagonDitherPerSeasonDec'] = simData[self.decCol] # Add to RA and dec values. vertexID = 0 for s in np.unique(seasons): #match = np.where((seasons == s) & (years == 5))[0] # for debugging purposes; check only the first year's data. 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
def _run(self, simData): # find the seasons associated with each visit. seasonSimData = SeasonStacker().run(simData) seasons = seasonSimData['season'] years = seasonSimData['year'] # 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
def run(self, simData): # find the seasons associated with each visit. seasonSimData = SeasonStacker().run(simData) seasons = seasonSimData['season'] # check how many entries in the >10 season ind = np.where(seasons > 9)[0] print 'Seasons to wrap ', np.unique(seasons[ind]) # should be only 1 extra seasons .. if len(np.unique(seasons[ind])) > 1: print 'ERROR: Too many seasons' stop # wrap the season around: 10th == 0th seasons[ind] = seasons[ind] % 10 # Add the new columns to simData. simData = self._addStackers(simData) # Generate the spiral offset vertices. self._generateOffsets() uniqSeasons = np.unique(seasons) # Add to RA and dec values. vertexID = 0 for s in uniqSeasons: match = np.where(seasons == s)[0] vertexID = vertexID % len(self.xOff) simData['PentagonDiamondDitherPerSeasonRA'][match] = simData[ self.raCol][match] + self.xOff[vertexID] / np.cos( simData[self.decCol][match]) simData['PentagonDiamondDitherPerSeasonDec'][match] = simData[ self.decCol][match] + self.yOff[vertexID] vertexID += 1 # Wrap into expected range. simData['PentagonDiamondDitherPerSeasonRA'], simData['PentagonDiamondDitherPerSeasonDec'] = \ wrapRADec(simData['PentagonDiamondDitherPerSeasonRA'], simData['PentagonDiamondDitherPerSeasonDec']) return simData
def _run(self, simData): # find the seasons associated with each visit. seasonSimData = SeasonStacker().run(simData) seasons = seasonSimData['season'] # 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._generateOffsets() uniqSeasons = np.unique(seasons) # Add to RA and dec values. vertexID = 0 for s in uniqSeasons: match = np.where(seasons == s)[0] vertexID = vertexID % len(self.xOff) simData['pentagonDiamondDitherPerSeasonRa'][match] = simData[ self.raCol][match] + self.xOff[vertexID] / np.cos( simData[self.decCol][match]) simData['pentagonDiamondDitherPerSeasonDec'][match] = simData[ self.decCol][match] + self.yOff[vertexID] vertexID += 1 # Wrap into expected range. simData['pentagonDiamondDitherPerSeasonRa'], simData['pentagonDiamondDitherPerSeasonDec'] = \ wrapRADec(simData['pentagonDiamondDitherPerSeasonRa'], simData['pentagonDiamondDitherPerSeasonDec']) return simData
def _run(self, simData): # find the seasons associated with each visit. seasonSimData = SeasonStacker().run(simData) seasons = seasonSimData['season'] # 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._generateOffsets() # 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['pentagonDiamondDitherFieldPerSeasonRa'][match] = simData[self.raCol][match] + \ self.xOff[vertexIdxs]/np.cos(simData[self.decCol][match]) simData['pentagonDiamondDitherFieldPerSeasonDec'][match] = simData[ self.decCol][match] + self.yOff[vertexIdxs] # Wrap into expected range. simData['pentagonDiamondDitherFieldPerSeasonRa'], simData['pentagonDiamondDitherFieldPerSeasonDec'] = \ wrapRADec(simData['pentagonDiamondDitherFieldPerSeasonRa'], simData['pentagonDiamondDitherFieldPerSeasonDec']) return simData
def run(self, simData): # find the seasons associated with each visit. seasonSimData = SeasonStacker().run(simData) seasons = seasonSimData['season'] # check how many entries in the >10 season ind = np.where(seasons > 9)[0] print 'Seasons to wrap ', np.unique(seasons[ind]) # should be only 1 extra seasons .. if len(np.unique(seasons[ind])) > 1: print 'ERROR: Too many seasons' stop # wrap the season around: 10th == 0th seasons[ind] = seasons[ind] % 10 # Add the new columns to simData. simData = self._addStackers(simData) # 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