Skip to content

Commit

Permalink
Fix the mask for missing uncertainties
Browse files Browse the repository at this point in the history
  • Loading branch information
AWehrhahn committed Nov 18, 2021
1 parent b7c804e commit ffdb6c8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pysme/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,13 @@ def solve(self, sme, param_names=None, segments="all", bounds=None):
sme = self.restore_func(sme)

# Get constant data from sme structure
sme.mask[segments][sme.uncs[segments] == 0] = sme.mask_values["bad"]
for seg in segments:
sme.mask[seg, sme.uncs[seg] == 0] = sme.mask_values["bad"]
# sme.mask[segments][sme.uncs[segments] == 0] = sme.mask_values["bad"]
mask = sme.mask_good[segments]
spec = sme.spec[segments][mask]
uncs = sme.uncs[segments][mask]

# This is the expected range of the uncertainty
# if the residuals are larger, they are dampened by log(1 + z)
f_scale = 0.1 * np.nanmean(spec.ravel()) / np.nanmean(uncs.ravel())
Expand Down

0 comments on commit ffdb6c8

Please sign in to comment.