Skip to content

Commit

Permalink
calculateSensitivity(): don't add datapoints to sensitivity function …
Browse files Browse the repository at this point in the history
…if there are zero or negative counts
  • Loading branch information
chris-simpson committed Aug 13, 2020
1 parent 8ba5aa9 commit ac66df6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions geminidr/core/primitives_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ def calculateSensitivity(self, adinputs=None, **params):
# Regardless of whether FLUX column is f_nu or f_lambda
flux = fluxdens.to(u.Unit('erg cm-2 s-1 nm-1'),
equivalencies=u.spectral_density(w0)) * dw.to(u.nm)
wave.append(w0)
# This is (counts/s) / (erg/cm^2/s), in magnitudes (like IRAF)
zpt.append(u.Magnitude(data / flux))
zpt_err.append(u.Magnitude(1 + np.sqrt(variance) / data))
if data > 0:
wave.append(w0)
# This is (counts/s) / (erg/cm^2/s), in magnitudes (like IRAF)
zpt.append(u.Magnitude(data / flux))
zpt_err.append(u.Magnitude(1 + np.sqrt(variance) / data))

# TODO: Abstract to interactive fitting
wave = array_from_list(wave, unit=u.nm)
Expand Down

0 comments on commit ac66df6

Please sign in to comment.