Skip to content

Commit

Permalink
Fixed 3 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nschanche committed Apr 23, 2024
1 parent 92ab4ee commit 7f44f2b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
32 changes: 16 additions & 16 deletions docs/tutorials/Example_searches.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "9f07ac77",
"metadata": {},
"outputs": [],
Expand All @@ -25,7 +25,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9f33bb08",
"id": "2ceef5dc",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,7 +36,7 @@
},
{
"cell_type": "markdown",
"id": "f3b8a69a",
"id": "8907b6f3",
"metadata": {},
"source": [
"The returned MASTSearch object has several properties to easily access specific observation characteristics. These include \n",
Expand All @@ -56,7 +56,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "2e3799d0",
"id": "8f92808d",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -86,7 +86,7 @@
},
{
"cell_type": "markdown",
"id": "da093799",
"id": "d4f50118",
"metadata": {},
"source": [
"It looks like more than 100 data proucts are available, all taken by Kepler or TESS. \n",
Expand Down Expand Up @@ -636,7 +636,7 @@
},
{
"cell_type": "markdown",
"id": "303dc1ea",
"id": "46c59ea1",
"metadata": {},
"source": [
"There are 30+ TESS data products available for this target. Note that only 10 were returned by our first MASTsearch. These 'extra' data products come from non-mission sources. The 'pipeline' column shows what pipeline was used to generate the data product. The 'mission' column simply reports if the data is a mission product or HLSP. Another addition for the TESSSearch is the 'sector' column. This column is only populated in the TESSSearch call, so is not available when using MASTSearch. \n",
Expand All @@ -647,7 +647,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "18d2ac9d",
"id": "3ac2034d",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -966,7 +966,7 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "967e29be",
"id": "fbd0c8e8",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1247,7 +1247,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "0982476a",
"id": "395682bf",
"metadata": {},
"outputs": [
{
Expand All @@ -1272,7 +1272,7 @@
},
{
"cell_type": "markdown",
"id": "789da186",
"id": "ff30459a",
"metadata": {},
"source": [
"There is a lot of data for this target. The filter_table function allows you to filter by several different parameters. These are:\n",
Expand All @@ -1286,7 +1286,7 @@
{
"cell_type": "code",
"execution_count": 8,
"id": "4b2414af",
"id": "0a52553c",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1476,7 +1476,7 @@
{
"cell_type": "code",
"execution_count": 9,
"id": "950893e8",
"id": "b341ec17",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1717,7 +1717,7 @@
{
"cell_type": "code",
"execution_count": 10,
"id": "c939033c",
"id": "d7198c41",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1801,7 +1801,7 @@
{
"cell_type": "code",
"execution_count": 11,
"id": "ab3dc721",
"id": "88a32686",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -1811,7 +1811,7 @@
{
"cell_type": "code",
"execution_count": 17,
"id": "82c540a5",
"id": "c7f533ad",
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -5798,7 +5798,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e20fd0b9",
"id": "f27bd56f",
"metadata": {},
"outputs": [],
"source": []
Expand Down
6 changes: 3 additions & 3 deletions src/newlk_search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ def _check_exact(self,target):

def _target_to_exact_name(self, target):
"parse TESS TIC to exact target name"
return f"{target.group(2).zfill(9)}"
return f"{target.group(2)}"

def _add_TESS_mission_product(self):
# Some products are HLSPs and some are mission products
Expand Down Expand Up @@ -1520,7 +1520,7 @@ def _check_exact(self,target):

def _target_to_exact_name(self, target):
"parse Kepler TIC to exact target name"
return f"kplr{target.group(2).zfill(9)}"
return f"kplr{target.group(2)}"
#
def _handle_kbonus(self):
# KBONUS times are masked as they are invalid for the quarter data
Expand Down Expand Up @@ -1766,7 +1766,7 @@ def _check_exact(self,target):

def _target_to_exact_name(self, target):
"parse K2 TIC to exact target name"
return f"ktwo{target.group(2).zfill(9)}"
return f"ktwo{target.group(2)}"

#
def _add_K2_mission_product(self):
Expand Down
17 changes: 8 additions & 9 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,13 @@ def test_collections():
# TODO: get download working
assert (
len(
MASTSearch("EPIC 205998445", mission="K2", search_radius=900, pipeline="K2").limit_results(3).download()
MASTSearch("EPIC 205998445", mission="K2", search_radius=900, pipeline="K2").filter_table(limit=3)
)
== 3
)
# if fewer targets are found than targetlimit, should still download all available
assert (
len(K2Search("EPIC 205998445", search_radius=900, pipeline="K2").cubedata.limit_results(6).table)
len(K2Search("EPIC 205998445", search_radius=900, pipeline="K2").cubedata.filter_table(limit=6).table)
== 4
)
# if download() is used when multiple files are available, should only download 1
Expand All @@ -300,7 +300,6 @@ def test_collections():
KeplerTargetPixelFile,
)'''

# TODO: These tests are failing!
#@pytest.mark.remote_data
def test_properties():
c = SkyCoord("297.5835 40.98339", unit=(u.deg, u.deg))
Expand Down Expand Up @@ -537,17 +536,17 @@ def test_split_k2_campaigns():
"""Do split K2 campaign sections appear separately in search results?"""
# Campaign 9
search_c09 = K2Search("EPIC 228162462", exptime="long", campaign=9).cubedata
assert search_c09.table["mission"][0] == "K2 - C09a"
assert search_c09.table["mission"][1] == "K2 - C09b"
assert search_c09.table["campaign"][0] == "09a"
assert search_c09.table["campaign"][1] == "09b"
# Campaign 10

search_c10 = K2Search("EPIC 228725972", exptime="long", campaign=10).cubedata
assert search_c10.table["mission"][0] == "K2 - C10a"
assert search_c10.table["mission"][1] == "K2 - C10b"
assert search_c10.table["campaign"][0] == "10a"
assert search_c10.table["campaign"][1] == "10b"
# Campaign 11
search_c11 = K2Search("EPIC 203830112", exptime="long", campaign=11).cubedata
assert search_c11.table["mission"][0] == "K2 - C11a"
assert search_c11.table["mission"][1] == "K2 - C11b"
assert search_c11.table["campaign"][0] == "11a"
assert search_c11.table["campaign"][1] == "11b"


'''Taking this test out for now...
Expand Down

0 comments on commit 7f44f2b

Please sign in to comment.