From e1ad66bc907b6ecba4362245a5108e79d1384fbd Mon Sep 17 00:00:00 2001 From: Tyler Pritchard Date: Fri, 2 Feb 2024 09:51:19 -0500 Subject: [PATCH 1/2] fixed exptime syntax error --- src/newlk_search/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/newlk_search/search.py b/src/newlk_search/search.py index 2d291aa..9e9b4ce 100644 --- a/src/newlk_search/search.py +++ b/src/newlk_search/search.py @@ -1179,7 +1179,7 @@ def _query_mast( # astroquery does not report distance when querying by `target_name`; # we add it here so that the table returned always has this column. obs["distance"] = 0.0 - return obs + return(obs) else: log.debug(f"No observations found. Now performing a cone search instead.") From fee115d0e8e44a057b645d6b1b085649aa4f5f3c Mon Sep 17 00:00:00 2001 From: Nschanche Date: Fri, 2 Feb 2024 10:00:20 -0500 Subject: [PATCH 2/2] added minimal tests --- src/newlk_search/search.py | 4 +++- tests/test_search.py | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/newlk_search/search.py b/src/newlk_search/search.py index 1224a4c..af53875 100644 --- a/src/newlk_search/search.py +++ b/src/newlk_search/search.py @@ -971,6 +971,7 @@ def _search_products( joint_table = joint_table.to_pandas() + # Add the user-friendly 'author' column (synonym for 'provenance_name') joint_table["author"] = joint_table["provenance_name"] # Add the user-friendly 'mission' column @@ -992,7 +993,7 @@ def _search_products( # K2 campaigns 9, 10, and 11 were split into two sections, which are # listed separately in the table with suffixes "a" and "b" mask = ((joint_table["project"] == "K2") & - (joint_table["sequence_number"].values in [9, 10, 11])) + (joint_table["sequence_number"].isin([9, 10, 11]))) for index, row in joint_table[mask].iterrows(): for half, letter in zip([1,2],["a","b"]): @@ -1067,6 +1068,7 @@ def _search_products( if query_result is not None: query_result["start_time"] = pd.to_datetime([Time(x + 2400000.5, format="jd").iso for x in query_result['t_min']]) query_result["end_time"] = pd.to_datetime([Time(x + 2400000.5, format="jd").iso for x in query_result['t_max']]) + return(SearchResult(query_result)) def _query_mast( diff --git a/tests/test_search.py b/tests/test_search.py index 10c9f77..46d90dd 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -627,4 +627,14 @@ def test_customize_search_result_display_case_nonexistent_column(): search = search_lightcurve("TIC390021728") search.display_extra_columns = ['foo_col'] - assert 'foo_col' not in search.__repr__() \ No newline at end of file + assert 'foo_col' not in search.__repr__() + + + +# Putting the tests I ran while debugging here. We can use or not use these as we see fit +# @pytest.mark.remote_data +#sr = search.search_timeseries('TIC 150428135') # TOI-700 + +# Should return the same results if searching by TIC or TOI number +# (Note this is not true for objects with neighbors within .0001 arcsec) +assert len(search.search_timeseries('TOI 700').table) == len(search.search_timeseries('TIC 150428135').table)