Skip to content

Commit

Permalink
Merge pull request #31 from pllim/fix-tests
Browse files Browse the repository at this point in the history
Fix Numpy 1.12 errors
  • Loading branch information
pllim committed Feb 21, 2017
2 parents ea29c35 + b027025 commit c0f1fae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pysynphot/obsbandpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,11 @@ def wave_range(bins, cenwave, npix, round='round'):
# translate ends to wavelength
if round is None:
# translate ends directly to wavelength without regard to bin edges
f, i = frac1, int1
f, i = frac1, int(int1)

wave1 = bins[i] + frac1 * (bins[i+1] - bins[i])

f, i = frac2, int2
f, i = frac2, int(int2)

wave2 = bins[i] + frac2 * (bins[i+1] - bins[i])

Expand Down
5 changes: 4 additions & 1 deletion pysynphot/refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
PRIMARY_AREA = 45238.93416 # cm^2 - default to HST mirror


def set_default_waveset(minwave=500, maxwave=26000, num=10000.,
def set_default_waveset(minwave=500, maxwave=26000, num=10000,
delta=None, log=True):
"""Set the default wavelength set, ``pysynphot.refs._default_waveset``.
Expand All @@ -69,6 +69,9 @@ def set_default_waveset(minwave=500, maxwave=26000, num=10000.,
global _default_waveset
global _default_waveset_str

# Must be int for numpy>=1.12
num = int(num)

s = 'Min: %s, Max: %s, Num: %s, Delta: %s, Log: %s'

if log and not delta:
Expand Down
2 changes: 1 addition & 1 deletion pysynphot/test/test_ticket150.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_integrate(self):

def test_subint(self):
w = self.bp.wave
tst = self.bp.integrate(w[0:len(w)/2])
tst = self.bp.integrate(w[0:int(len(w)/2)])

# epsilon due to the nature of trapezoid integration
assert abs(self.ref / 2.0 - tst) <= 0.025
Expand Down

0 comments on commit c0f1fae

Please sign in to comment.