Skip to content

Commit e3f6049

Browse files
committed
Add Sector/Quarter/Campaign properties
1 parent 1c708ff commit e3f6049

4 files changed

Lines changed: 36 additions & 1 deletion

File tree

src/lksearch/K2Search.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ def __init__(
9090
self._fix_K2_sequence()
9191
self._sort_K2()
9292

93+
@property
94+
def campaign(self):
95+
"""K2 Observing campaign for each data product found."""
96+
return self.table["campaign"].values
97+
9398
@property
9499
def HLSPs(self):
95100
"""return a MASTSearch object with self.table only containing High Level Science Products"""

src/lksearch/KeplerSearch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ def __init__(
9595
self._sort_Kepler()
9696
# Can't search mast with quarter/month directly, so filter on that after the fact.
9797
self.table = self.table[self._filter_kepler(quarter, month)]
98-
98+
@property
99+
def quarter(self):
100+
"""Kepler Observing quarter for each data product found."""
101+
return self.table["quarter"].values
102+
99103
@property
100104
def HLSPs(self):
101105
"""return a MASTSearch object with self.table only containing High Level Science Products"""

src/lksearch/TESSSearch.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ def __init__(
117117

118118
self._sort_TESS()
119119

120+
@property
121+
def sector(self):
122+
"""TESS Observing sector for each data product found."""
123+
return self.table["sector"].values
124+
120125
@property
121126
def HLSPs(self):
122127
"""return a MASTSearch object with self.table only containing High Level Science Products"""

tests/test_missionsearch.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,32 @@ def test_collections():
229229

230230

231231
def test_properties():
232+
"""Test an assortment of class properties"""
232233
c = SkyCoord("297.5835 40.98339", unit=(u.deg, u.deg))
233234
assert_almost_equal(KeplerSearch(c, quarter=6).cubedata.ra[0], 297.5835)
234235
assert_almost_equal(KeplerSearch(c, quarter=6).cubedata.dec[0], 40.98339)
235236
assert len(KeplerSearch(c, quarter=6).cubedata.target_name) == 1
236237

238+
result = K2Search("EPIC 205998445", search_radius=900, campaign=3).cubedata
239+
assert len(result) == 4
240+
assert len(result.cloud_uri) == 4
241+
assert (result.campaign == '3').all()
242+
243+
result = KeplerSearch("KIC 11904151", exptime="short", quarter=[2,3,4]).cubedata
244+
assert len(result) == 5
245+
assert all([r in [2,3,4] for r in result.quarter])
246+
247+
result = TESSSearch(tic, pipeline="spoc", sector=1, search_radius=100).timeseries
248+
assert len(result) == 2
249+
assert len(result.sector) == 2
250+
assert (result.campaign == '1').all()
251+
assert (result.mission == "TESS").all()
252+
assert (result.pipeline == "SPOC").all()
253+
254+
255+
with pytest.raises(AttributeError, match="no attibute"):
256+
result = MASTSearch("EPIC 205998445", search_radius=900).cubedata
257+
237258

238259
def test_source_confusion():
239260
# Regression test for issue #148.

0 commit comments

Comments
 (0)