Skip to content

Commit

Permalink
changed to DeprecatedError instead of Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Nschanche committed Dec 10, 2024
1 parent 7ccb1bb commit 48a3d7c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
19 changes: 9 additions & 10 deletions src/lksearch/TESSSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
from astropy.utils.decorators import deprecated
#from astropy.utils.decorators import deprecated
from astroquery.mast import Tesscut

from tqdm import tqdm
Expand All @@ -17,7 +17,7 @@

from .MASTSearch import MASTSearch
from . import conf, config, log
from .utils import SearchDeprecationWarning
from .utils import SearchDeprecationError

PREFER_CLOUD = conf.PREFER_CLOUD
DOWNLOAD_CLOUD = conf.DOWNLOAD_CLOUD
Expand Down Expand Up @@ -289,26 +289,25 @@ def _sort_TESS(self):
)
self.table = df

@deprecated(
"1.0.1",
warning_type=SearchDeprecationWarning,
message="The {func} {obj_type} has been deprecated as astroquery no longer supports querying individual FFI files.",
)

def search_sector_ffis(
self,
# tmin: Union[float, Time, tuple] = None,
# tmax: Union[float, Time, tuple] = None,
# search_radius: Union[float, u.Quantity] = 0.0001 * u.arcsec,
# exptime: Union[str, int, tuple] = (0, 9999),
# sector: Union[int, type[None]], # = None,
# **extra_query_criteria,
sector: Union[int, type[None]], # = None,
**extra_query_criteria,
):
"""
DEPRECATED
Returns a list of the FFIs available in a particular sector
"""
return None
raise SearchDeprecationError(
"The search_sector_ffis method has been deprecated as astroquery no longer supports querying individual FFI files."
)


def filter_table(
self,
Expand Down
3 changes: 2 additions & 1 deletion src/lksearch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class SearchWarning(Warning):
pass


class SearchDeprecationWarning(SearchWarning):

class SearchDeprecationError(SearchError):
"""Class for all lksearch deprecation warnings."""

pass
Expand Down
12 changes: 5 additions & 7 deletions tests/test_missionsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import pandas as pd


from lksearch.utils import SearchError, SearchWarning

from lksearch.utils import SearchError, SearchWarning, SearchDeprecationError
from lksearch import MASTSearch, TESSSearch, KeplerSearch, K2Search
from lksearch import conf
import warnings
Expand Down Expand Up @@ -432,12 +431,11 @@ def test_split_k2_campaigns():
assert search_c11.table["campaign"][1] == "11b"


@pytest.mark.skip(
reason="MAST has deprecated FFI search and retrieval through astroquery"
)
def test_FFI_retrieval():
"""Can we find TESS individual FFI's"""
assert len(TESSSearch("Kepler 16b").search_sector_ffis(14)) == 1241
"""MAST has deprecated FFI search and retrieval through astroquery, so this function is now deprecated"""
with pytest.raises(SearchDeprecationError) as exc:
results = TESSSearch("Kepler 16b").search_sector_ffis(14)
assert "deprecated" in exc.value.args[0]


def test_tesscut():
Expand Down

0 comments on commit 48a3d7c

Please sign in to comment.