Skip to content

Commit

Permalink
Update Bandpass.sb_tophi to work with arbitrary wavelength spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
yoachim committed May 16, 2023
1 parent b920c0b commit 8389c9f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions rubin_sim/phot_utils/bandpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,17 +347,12 @@ def sb_tophi(self):
"""
Calculate and set phi - the normalized system response.
This function only pdates self.phi.
This function only updates self.phi.
"""
# The definition of phi = (Sb/wavelength)/\int(Sb/wavelength)dlambda.
# XXX--might want to test here what happens if un-equal grid
dlambda = self.wavelen[1] - self.wavelen[0]
self.phi = self.sb / self.wavelen
# Normalize phi so that the integral of phi is 1.
phisum = self.phi.sum()
if phisum < 1e-300:
raise Exception("Phi is poorly defined (nearly 0) over bandpass range.")
norm = phisum * dlambda
norm = numpy.trapz(self.phi, x=self.wavelen)
self.phi = self.phi / norm
return

Expand Down

0 comments on commit 8389c9f

Please sign in to comment.