Skip to content

Commit

Permalink
add tests and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Aug 1, 2024
1 parent 1a21012 commit 8414c30
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools docutils Sphinx
python -m pip install --upgrade pip wheel setuptools Sphinx\<8
python -m pip install sphinx-astropy
python -m pip install speclite
Expand Down
13 changes: 7 additions & 6 deletions speclite/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
## the list of packages for which version numbers are displayed when running
## the tests. Making it pass for KeyError is essential in some cases when
## the package uses other astropy affiliated packages.
# try:
# PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
# PYTEST_HEADER_MODULES['scikit-image'] = 'skimage'
# del PYTEST_HEADER_MODULES['h5py']
# except (NameError, KeyError): # NameError is needed to support Astropy < 1.0
# pass
try:
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
PYTEST_HEADER_MODULES['PIL'] = 'pillow'
del PYTEST_HEADER_MODULES['h5py']
del PYTEST_HEADER_MODULES['pandas']
except (NameError, KeyError): # NameError is needed to support Astropy < 1.0
pass

## Uncomment the following lines to display the version number of the
## package rather than the version number of Astropy in the top line when
Expand Down
15 changes: 9 additions & 6 deletions speclite/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@
import numpy as np

import scipy.interpolate
import scipy.integrate

try:
from scipy.integrate import trapezoid as trapz
from scipy.integrate import simpson as simps
except ModuleNotFoundError:
from scipy.integrate import trapz, simps

import astropy.table
import astropy.units
Expand Down Expand Up @@ -267,9 +272,7 @@
_photon_weighted_unit = default_wavelength_unit**2 / _hc_constant.unit

# Map names to integration methods allowed by the convolution methods below.
_filter_integration_methods = dict(
trapz= scipy.integrate.trapz,
simps= scipy.integrate.simps)
_filter_integration_methods = dict(trapz=trapz, simps=simps)

# Group and band names must be valid python identifiers. Although a leading
# underscore is probably not a good idea, it is simpler to stick with a
Expand Down Expand Up @@ -1806,7 +1809,7 @@ def load_filters(*names):
"""
# Replace any group wildcards with the corresponding canonical names.


filters_path = get_path_of_data_file('filters/')


Expand Down Expand Up @@ -1945,7 +1948,7 @@ def load_filter(name, load_from_cache=True, verbose=False):

def plot_filters(responses, wavelength_unit=None,
wavelength_limits=None, wavelength_scale='linear',
legend_loc='upper right', legend_ncols=1,
legend_loc='upper right', legend_ncols=1,
response_limits=None, cmap='nipy_spectral'):
"""Plot one or more filter response curves.
Expand Down
2 changes: 0 additions & 2 deletions speclite/tests/test_accumulate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function, division

from astropy.tests.helper import pytest
from ..accumulate import accumulate
import numpy as np
Expand Down
9 changes: 9 additions & 0 deletions speclite/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from ..utils.package_data import get_path_of_data_file, get_path_of_data_dir


def test_get_path_of_data_file():
pass


def test_get_path_of_data_dir():
pass

0 comments on commit 8414c30

Please sign in to comment.