Skip to content

Commit

Permalink
OptimalExtract: handle variance input with nans
Browse files Browse the repository at this point in the history
* handle similar to zeros: exclude those elements by modifying the mask
  • Loading branch information
kecnry committed Sep 2, 2022
1 parent 7e7e4a6 commit 87eaad0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions specreduce/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ def __call__(self, image=None, trace_object=None,
if np.any(variance < 0):
raise ValueError("variance must be fully positive")

if np.any(np.isnan(variance)):
# exclude these elements by editing the input mask
img.mask[np.isnan(variance)] = True

if np.any(variance == 0):
# exclude these elements by editing the input mask
img.mask[variance == 0] = True
Expand Down

0 comments on commit 87eaad0

Please sign in to comment.