Skip to content

Commit

Permalink
trying to resolve zero division errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-neal committed Nov 5, 2017
1 parent 7418a82 commit 72a0d94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
1 change: 1 addition & 0 deletions spectrum_overload/test/test_DifferentialSpectrum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

"""Test DifferentialSpectrum Class."""
from __future__ import division, print_function

import numpy as np
import pytest
Expand Down
14 changes: 4 additions & 10 deletions spectrum_overload/test/test_overloaded_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@
from __future__ import division, print_function

import hypothesis.strategies as st
# import copy
import numpy as np
import pytest
# Test using hypothesis
from hypothesis import given

# from astropy.io import fits
# from pkg_resources import resource_filename
# import sys
# Add Spectrum location to path
# sys.path.append('../')
from spectrum_overload import Spectrum, SpectrumError


Expand Down Expand Up @@ -524,11 +517,12 @@ def test_wave_selection_with_ill_defined_xaxis():


def test_zero_division():
s = Spectrum([1, 2, 3, 4], [1, 2, 3, 4])
t = Spectrum([1, 2, 0, 4], [1, 2, 3, 4])
s = Spectrum(flux=[1, 2, 3, 4], xaxis=[1, 2, 3, 4])
t = Spectrum(flux=[1, 2, 0, 4], xaxis=[1, 2, 3, 4])

divide = s / t
print(divide)
print(divide.xaxis)
print(divide.flux)
notnan = np.invert(np.isinf(divide.flux))
print(divide.flux[2])
assert np.isinf(divide.flux[2])
Expand Down

0 comments on commit 72a0d94

Please sign in to comment.