Skip to content

Commit

Permalink
comments in code
Browse files Browse the repository at this point in the history
  • Loading branch information
djones1040 committed May 22, 2021
1 parent 5db4822 commit 725a8b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sncosmo/models.py
Expand Up @@ -1129,6 +1129,8 @@ def _bandflux_rvar_single(self, band, phase):
m0 = self._model['M0'](phase, wave)
m1 = self._model['M1'](phase, wave)
tmp = trans * wave

# evaluate avg M0 + x1*M1 across a bandpass
f0 = np.sum(m0 * tmp, axis=1)/tmp.sum()
m1int = np.sum(m1 * tmp, axis=1)/tmp.sum()
ftot = f0 + x1 * m1int
Expand All @@ -1139,6 +1141,8 @@ def _bandflux_rvar_single(self, band, phase):
lcrv11 = self._model['LCRV11'](phase, band.wave_eff)[:, 0]
lcrv01 = self._model['LCRV01'](phase, band.wave_eff)[:, 0]

# variance in M0 + x1*M1 at the effective wavelength
# of a bandpass
v = (lcrv00 + 2.0 * x1 * lcrv01 + x1 * x1 * lcrv11)

# v is supposed to be variance but can go negative
Expand All @@ -1149,7 +1153,7 @@ def _bandflux_rvar_single(self, band, phase):

# avoid warnings due to evaluating 0. / 0. in f0 / ftot
with np.errstate(invalid='ignore'):
# new SALT3 error prescription
# turn M0+x1*M1 error into a relative error
result = v/ftot**2.

# treat cases where ftot is negative the same as snfit
Expand Down

0 comments on commit 725a8b5

Please sign in to comment.