Skip to content

Commit

Permalink
replace usages of numpy.alltrue() with numpy.all() / numpy.any()
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jul 9, 2024
1 parent 54e9e2a commit 990dbbb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions commissioning/basecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def arraysigtest(self,test,ref):
tidx=N.where(tt>(self.sigthresh*tt.max()))[0]
ridx=N.where(rr>(self.sigthresh*rr.max()))[0]
#Set a flag if they're not the same set
if not (N.alltrue(tidx == ridx)):
if N.any(tidx != ridx):
self.tra['SigElemDiscrep']=True
tidx=ridx

Expand Down Expand Up @@ -152,7 +152,7 @@ def arraytest(self,test,ref):
self.tra['Outliers']=self.count_outliers(5)
if (self.tra['Discrepfrac'] > self.superthresh):
self.tra['Extreme']=True
self.failUnless(N.alltrue(abs(self.adiscrep)<self.thresh),
self.failUnless(N.all(abs(self.adiscrep)<self.thresh),
msg="Worst case %f"%abs(self.adiscrep).max())
except ZeroDivisionError:
self.tra['Discrepfrac']=0.0
Expand Down
4 changes: 2 additions & 2 deletions commissioning/convert/conv_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def arraysigtest(self,ref,test):
tidx=N.where(tt>(self.sigthresh*tt.max()))[0]
ridx=N.where(rr>(self.sigthresh*rr.max()))[0]
#Set a flag if they're not the same set
if not (N.alltrue(tidx == ridx)):
if N.any(tidx != ridx):
self.tra['SigElemDiscrep']=True
tidx=ridx

Expand All @@ -115,7 +115,7 @@ def arraytest(self,ref,test):
self.tra['Discrepmean']=self.adiscrep.mean()
self.tra['Discrepstd']=self.adiscrep.std()
self.tra['Outliers']=self.count_outliers(5)
self.failUnless(N.alltrue(abs(self.adiscrep)<self.thresh),
self.failUnless(N.all(abs(self.adiscrep)<self.thresh),
msg="Worst case %f"%abs(self.adiscrep).max())
except ZeroDivisionError:
self.tra['Discrepfrac']=0.0
Expand Down
4 changes: 2 additions & 2 deletions pysynphot/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def validate_wavetable(self):

# Now check for monotonicity & enforce ascending
sorted = N.sort(wave)
if not N.alltrue(sorted == wave):
if N.alltrue(sorted[::-1] == wave):
if N.any(sorted != wave):
if N.all(sorted[::-1] == wave):
# monotonic descending is allowed
pass
else:
Expand Down

0 comments on commit 990dbbb

Please sign in to comment.