Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace usages of numpy.alltrue() with numpy.all() / numpy.any(!) #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading