Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Stolker committed Mar 14, 2019
1 parent d23d12b commit 3e733c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

sys.path.insert(0, os.path.abspath('../'))

autodoc_mock_imports = ['species']

# -- Project information -----------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions test/test_photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def test_magnitude_to_flux(self):
synphot = species.SyntheticPhotometry("MKO/NSFCam.J")
flux, error = synphot.magnitude_to_flux(20., 0.5)

assert np.allclose(flux, 3.104539116258e-17, rtol=self.limit, atol=0.)
assert np.allclose(error, 1.4807655772287564e-17, rtol=self.limit, atol=0.)
assert np.allclose(flux, 3.1045460194170406e-17, rtol=self.limit, atol=0.)
assert np.allclose(error, 1.4807688698141927e-17, rtol=self.limit, atol=0.)

def test_flux_to_magnitude(self):
synphot = species.SyntheticPhotometry("MKO/NSFCam.J")
app_mag, abs_mag = synphot.flux_to_magnitude(1e-10, 50.)

assert np.allclose(app_mag, 3.72999284049042, rtol=self.limit, atol=0.)
assert np.allclose(abs_mag, 0.23514281881032595, rtol=self.limit, atol=0.)
assert np.allclose(app_mag, 3.729995254697838, rtol=self.limit, atol=0.)
assert np.allclose(abs_mag, 0.23514523301774481, rtol=self.limit, atol=0.)
4 changes: 2 additions & 2 deletions test/test_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_spectral_library(self):
phot = synphot.spectrum_to_photometry(wavelength=wavelength,
flux_density=flux)

assert np.allclose(phot, 4.567475834590298e-14, rtol=self.limit, atol=0.)
assert np.allclose(phot, 4.5884422e-14, rtol=1e-8, atol=0.)

transmission = species.ReadFilter(filter_name='MKO/NSFCam.H')
wl_mean = transmission.mean_wavelength()
Expand All @@ -56,7 +56,7 @@ def test_spectral_library(self):

assert photbox.name == 'L0 dwarf'
assert np.allclose(photbox.wavelength, 1.6298258, rtol=1e-7, atol=0.)
assert np.allclose(photbox.flux, 4.567475834590298e-14, rtol=self.limit, atol=0.)
assert np.allclose(photbox.flux, 4.5884422e-14, rtol=1e-8, atol=0.)

species.plot_spectrum(boxes=(specbox, photbox),
filters=('MKO/NSFCam.H', ),
Expand Down

0 comments on commit 3e733c8

Please sign in to comment.