Skip to content

Commit

Permalink
Removing filter warning for mpl-scatter-density (spacetelescope#3327)
Browse files Browse the repository at this point in the history
* removing filter warning for mpl-scatter-density

* replace deprecated pkg_resources call in linelists
  • Loading branch information
bmorris3 authored Dec 3, 2024
1 parent 81e940d commit 3f1abf7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 3 additions & 5 deletions jdaviz/core/linelists.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pkg_resources
from importlib import resources
import json

from astropy.table import QTable
Expand All @@ -8,8 +8,7 @@

def get_linelist_metadata():
"""Return metadata for line lists."""
metadata_file = pkg_resources.resource_filename("jdaviz",
"data/linelists/linelist_metadata.json")
metadata_file = resources.files("jdaviz").joinpath("data/linelists/linelist_metadata.json")
with open(metadata_file) as f:
metadata = json.load(f)
return metadata
Expand All @@ -34,8 +33,7 @@ def load_preset_linelist(name):
raise ValueError("Line name not in available set of line lists. " +
"Valid list names are: {}".format(list(metadata.keys())))
fname_base = metadata[name]["filename_base"]
fname = pkg_resources.resource_filename("jdaviz",
"data/linelists/{}.csv".format(fname_base))
fname = resources.files("jdaviz").joinpath("data/linelists/{}.csv".format(fname_base))
units = metadata[name]["units"]
linetable = QTable.read(fname)

Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ filterwarnings = [
"ignore::DeprecationWarning:glue",
"ignore::DeprecationWarning:asteval",
"ignore:::specutils.spectra.spectrum1d",
# Remove the following line once https://github.com/astrofrog/mpl-scatter-density/issues/46 is addressed
"ignore:pkg_resources is deprecated as an API:DeprecationWarning:mpl_scatter_density",
# Ignore numpy 2.0 warning, see https://github.com/astropy/astropy/pull/15495
# and https://github.com/scipy/scipy/pull/19275
"ignore:.*numpy\\.core.*:DeprecationWarning",
Expand Down

0 comments on commit 3f1abf7

Please sign in to comment.