def interpSpec(self, interpPoints, maxAM=2.5, limits=[np.radians(-5.), np.radians(-20.)]): """ interpPoints should have airmass, azRelSun, and sunAlt. """ npts = np.size(self.solarWave) result = np.zeros((np.size(interpPoints), npts), dtype=float) good = np.where((interpPoints['sunAlt'] >= np.min(limits)) & (interpPoints['sunAlt'] <= np.max(limits)) & (interpPoints['airmass'] <= maxAM) & (interpPoints['airmass'] >= 1.))[0] # Compute the expected flux in each of the filters that we have fits for fluxes = [] for filterName in self.filterNames: fluxes.append(twilightFunc(interpPoints[good], *self.fitResults[filterName])) fluxes = np.array(fluxes) # ratio of model flux to raw solar flux: yvals = fluxes.T/(10.**(-0.4*(self.solarMag-np.log10(3631.)))) # Find wavelengths bluer than cutoff blueRegion = np.where(self.solarWave < np.min(self.effWave)) for i, yval in enumerate(yvals): interpF = interp1d(self.effWave, yval, bounds_error=False, fill_value=yval[-1]) ratio = interpF(self.solarWave) interpBlue = InterpolatedUnivariateSpline(self.effWave, yval, k=1) ratio[blueRegion] = interpBlue(self.solarWave[blueRegion]) result[good[i]] = self.solarFlux*ratio return {'spec': result, 'wave': self.solarWave}
def interpMag(self, interpPoints, maxAM=2.5, limits=[np.radians(-11.), np.radians(-20.)]): npts = np.size(self.lsstEffWave) result = np.zeros((np.size(interpPoints), npts), dtype=float) good = np.where((interpPoints['sunAlt'] >= np.min(limits)) & (interpPoints['sunAlt'] <= np.max(limits)) & (interpPoints['airmass'] <= maxAM) & (interpPoints['airmass'] >= 1.))[0] for i, filterName in enumerate(self.lsstFilterNames): result[good, i] = twilightFunc(interpPoints[good], *self.lsstEquations[i, :].tolist()) return {'spec': result, 'wave': self.lsstEffWave}
def interpMag(self, interpPoints, maxAM=2.5, limits=[np.radians(-11.), np.radians(-20.)]): npts = np.size(self.lsstEffWave) result = np.zeros((np.size(interpPoints), npts), dtype=float) good = np.where((interpPoints['sunAlt'] >= np.min(limits)) & (interpPoints['sunAlt'] <= np.max(limits)) & (interpPoints['airmass'] <= maxAM) & (interpPoints['airmass'] >= 1.))[0] for i, filterName in enumerate(self.lsstFilterNames): result[good, i] = twilightFunc(interpPoints[good], *self.lsstEquations[i, :].tolist()) #mask = np.where(result == 0.) #result = 10.**(-0.4*(result-np.log10(3631.))) #result[mask] = 0. return {'spec': result, 'wave': self.lsstEffWave}
def interpMag(self, interpPoints, maxAM=2.5, limits=[np.radians(-11.), np.radians(-20.)], filterNames=['u', 'g', 'r', 'i', 'z', 'y']): npts = len(filterNames) result = np.zeros((np.size(interpPoints), npts), dtype=float) good = np.where((interpPoints['sunAlt'] >= np.min(limits)) & (interpPoints['sunAlt'] <= np.max(limits)) & (interpPoints['airmass'] <= maxAM) & (interpPoints['airmass'] >= 1.))[0] for i, filterName in enumerate(filterNames): result[good, i] = twilightFunc( interpPoints[good], *self.lsstEquations[ self.filterNameDict[filterName], :].tolist()) return {'spec': result, 'wave': self.lsstEffWave}
def interpMag(self, interpPoints, maxAM=2.5, limits=[np.radians(-5.), np.radians(-20.)], filterNames=['u', 'g', 'r', 'i', 'z', 'y']): """ Originally fit the twilight with a cutoff of sun altitude of -11 degrees. I think it can be safely extrapolated farther, but be warned you may be entering a regime where it breaks down. """ npts = len(filterNames) result = np.zeros((np.size(interpPoints), npts), dtype=float) good = np.where((interpPoints['sunAlt'] >= np.min(limits)) & (interpPoints['sunAlt'] <= np.max(limits)) & (interpPoints['airmass'] <= maxAM) & (interpPoints['airmass'] >= 1.))[0] for i, filterName in enumerate(filterNames): result[good, i] = twilightFunc(interpPoints[good], *self.lsstEquations[self.filterNameDict[filterName], :].tolist()) return {'spec': result, 'wave': self.lsstEffWave}
def interpSpec(self, interpPoints, maxAM=2.5, limits=[np.radians(-11.), np.radians(-20.)]): """ interpPoints should have airmass, azRelSun, and sunAlt. """ npts = np.size(self.solarWave) result = np.zeros((np.size(interpPoints), npts), dtype=float) good = np.where((interpPoints['sunAlt'] >= np.min(limits)) & (interpPoints['sunAlt'] <= np.max(limits)) & (interpPoints['airmass'] <= maxAM) & (interpPoints['airmass'] >= 1.))[0] # Compute the expected flux in each of the filters that we have fits for fluxes = [] for filterName in self.filterNames: fluxes.append( twilightFunc(interpPoints[good], *self.fitResults[filterName])) fluxes = np.array(fluxes) # ratio of model flux to raw solar flux: yvals = fluxes.T / (10.**(-0.4 * (self.solarMag - np.log10(3631.)))) # Find wavelengths bluer than cutoff blueRegion = np.where(self.solarWave < np.min(self.effWave)) for i, yval in enumerate(yvals): interpF = interp1d(self.effWave, yval, bounds_error=False, fill_value=yval[-1]) ratio = interpF(self.solarWave) interpBlue = InterpolatedUnivariateSpline(self.effWave, yval, k=1) ratio[blueRegion] = interpBlue(self.solarWave[blueRegion]) result[good[i]] = self.solarFlux * ratio return {'spec': result, 'wave': self.solarWave}
def interpMag(self, interpPoints, maxAM=2.5, limits=[np.radians(-5.), np.radians(-20.)], filterNames=['u', 'g', 'r', 'i', 'z', 'y']): """ Originally fit the twilight with a cutoff of sun altitude of -11 degrees. I think it can be safely extrapolated farther, but be warned you may be entering a regime where it breaks down. """ npts = len(filterNames) result = np.zeros((np.size(interpPoints), npts), dtype=float) good = np.where((interpPoints['sunAlt'] >= np.min(limits)) & (interpPoints['sunAlt'] <= np.max(limits)) & (interpPoints['airmass'] <= maxAM) & (interpPoints['airmass'] >= 1.))[0] for i, filterName in enumerate(filterNames): result[good, i] = twilightFunc( interpPoints[good], *self.lsstEquations[ self.filterNameDict[filterName], :].tolist()) return {'spec': result, 'wave': self.lsstEffWave}