Skip to content

Commit 1c708ff

Browse files
authored
filter TESScut by exptime (#43)
* filter TESScut by exptime * ruff formatting * Spelling
1 parent 9236777 commit 1c708ff

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,16 @@ Please include a self-contained example that fully demonstrates your problem or
112112
113113
Changelog:
114114
==========
115+
v1.2.2
116+
- Updated the logic surrounding TESScut searches to allow only TESScut results [#32]
117+
- filter TESScut results by exposure time keyword [#43]
115118
v1.2.0
116119
- Made the catalogsearch functions case-insensitive[#38]
117120
- Added `CHECK_CACHED_FILE_SIZES` configuration parameter, which on download allows local checking of cached files without a remote file-size check[#34][#38]
118121
- Refactored `~lksearch.MastSearch.download` function to only call `~astroquery.mast.Observations.download` once
119122
- This results in a modest speedup O(N), particularly for files in the local cache when `CHECK_CACHED_FILE_SIZES` is `True`.
120123
- Updated tests, documentation for the new features
121124
- Changed the property cloud_uris(self) to cloud_uri(self) [#42]
122-
- Updated the logic surrounding TESScut searches to allow only TESScut results [#32]
123125
v1.1.1
124126
- Deprecated TESSSearch.search_sector_ffis due to changes in astroquery functionality
125127
v1.1.0

src/lksearch/TESSSearch.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def __init__(
109109
self.table = pd.DataFrame(columns=table_keys)
110110

111111
if (pipeline == None) or ("tesscut" in [p.lower() for p in pipeline]):
112-
self._add_tesscut_products(sector)
112+
self._add_tesscut_products(sector, exptime=exptime)
113+
113114
if len(self.table) == 0:
114115
raise SearchError(f"No data found for target {self.target}.")
115116
self._add_TESS_mission_product()
@@ -159,7 +160,11 @@ def _add_TESS_mission_product(self):
159160
self.table["mission_product"] = mission_product
160161
self.table["sector"] = self.table["sequence_number"]
161162

162-
def _add_tesscut_products(self, sector_list: Union[int, list[int]]):
163+
def _add_tesscut_products(
164+
self,
165+
sector_list: Union[int, list[int]],
166+
exptime: Union[int, tuple[float]],
167+
):
163168
"""Add tesscut product information to the search table
164169
165170
Parameters
@@ -175,6 +180,8 @@ def _add_tesscut_products(self, sector_list: Union[int, list[int]]):
175180
self.table = pd.concat([self.table, tesscut_info])
176181
else:
177182
self.table = tesscut_info
183+
mask = self._mask_by_exptime(exptime=exptime)
184+
self.table = self.table[mask]
178185

179186
# FFIs only available when using TESSSearch.
180187
# Use TESS WCS to just return a table of sectors and dates?

tests/test_missionsearch.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ def test_tesscut():
466466
assert len(sr) == 1
467467
assert len(sr2) == 2
468468

469+
# No 20-s data was taken so this should be empty
470+
# Previously the TESScut data was appended after the exposure time cuts
471+
# so it returned 1800s tesscut data [see issue #41]
472+
with pytest.raises(SearchError, match="No data"):
473+
TESSSearch("TOI 1161", sector=14, exptime=20)
474+
469475

470476
class TestMASTSearchFilter:
471477
results = MASTSearch("Kepler 16b")

0 commit comments

Comments
 (0)