Skip to content

Commit

Permalink
removing tess-cloud dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemarpa committed Oct 12, 2023
1 parent 8d797a0 commit 1fcd3eb
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 88 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ numpy = "^1.23.0"
tqdm = "^4.51.1"
attrs = "^23.1.0"
tess-point = "^0.8"
tess-cloud = "^0.5"
# tess-cloud = "^0.5"

[tool.poetry.dev-dependencies]
pytest = "^6.0"
Expand Down
108 changes: 54 additions & 54 deletions src/tess_locator/tesscoord.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,37 +83,37 @@ def is_observed(self) -> bool:
"""Returns true if this coordinate has been observed."""
return len(self.list_images()) > 0

def list_images(
self,
time: Union[str, Time] = None,
author: str = "spoc",
provider: Optional[str] = None,
):
"""Returns a `TessImageList` detailing the FFI images which include the coordinate.
Parameters
----------
author : str
"spoc" or "tica"
Notes
-----
This feature will use the `tess-cloud` package to query a catalog of
TESS images.
"""
# local import to avoid circular dependency
from tess_cloud import list_images

if time is None:
time = self.time
return list_images(
sector=self.sector,
camera=self.camera,
ccd=self.ccd,
time=time,
author=author,
provider=provider,
)
# def list_images(
# self,
# time: Union[str, Time] = None,
# author: str = "spoc",
# provider: Optional[str] = None,
# ):
# """Returns a `TessImageList` detailing the FFI images which include the coordinate.
#
# Parameters
# ----------
# author : str
# "spoc" or "tica"
#
# Notes
# -----
# This feature will use the `tess-cloud` package to query a catalog of
# TESS images.
# """
# # local import to avoid circular dependency
# from tess_cloud import list_images
#
# if time is None:
# time = self.time
# return list_images(
# sector=self.sector,
# camera=self.camera,
# ccd=self.ccd,
# time=time,
# author=author,
# provider=provider,
# )


class TessCoordList(UserList):
Expand All @@ -134,29 +134,29 @@ def __eq__(self, obj):
obj.to_pandas()
)

def list_images(
self,
time: Union[str, Time] = None,
author: str = "spoc",
provider: Optional[str] = None,
):
"""Returns a `TessImageList` detailing the FFI images which include the coordinates.
Parameters
----------
author : str
"spoc" or "tica"
"""
# local import to avoid circular dependency
from tess_cloud import TessImageList

if len(self) == 0:
return TessImageList([])

result = self[0].list_images(time=time, author=author, provider=provider).copy()
for img in self[1:]:
result += img.list_images(time=time, author=author, provider=provider)
return result
# def list_images(
# self,
# time: Union[str, Time] = None,
# author: str = "spoc",
# provider: Optional[str] = None,
# ):
# """Returns a `TessImageList` detailing the FFI images which include the coordinates.
#
# Parameters
# ----------
# author : str
# "spoc" or "tica"
# """
# # local import to avoid circular dependency
# from tess_cloud import TessImageList
#
# if len(self) == 0:
# return TessImageList([])
#
# result = self[0].list_images(time=time, author=author, provider=provider).copy()
# for img in self[1:]:
# result += img.list_images(time=time, author=author, provider=provider)
# return result

def to_pandas(self) -> DataFrame:
data = {
Expand Down
66 changes: 33 additions & 33 deletions tests/test_tesscoord.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,36 @@ def test_list_from_pandas():


# @pytest.mark.skip # because TessImage has moved to tess-cloud for now
def test_list_images_twice():
"""Regression test: requesting an image list twice should not change the outcome."""
tcl = TessCoordList(
[
TessCoord(
sector=5,
camera=1,
ccd=4,
column=1553.9,
row=1103.0,
time="2018-11-21 17:35:00",
),
TessCoord(
sector=5,
camera=1,
ccd=4,
column=1553.9,
row=1103.0,
time="2018-11-22 17:35:00",
),
]
)
len1 = len(tcl.list_images())
len2 = len(tcl.list_images())
assert len1 == len2


def test_list_images():
crd = TessCoord(sector=11, camera=2, ccd=2, column=1699, row=1860)
imglist = crd.list_images()
assert len(imglist) == 1248
df = imglist.to_pandas()
assert len(df) == len(imglist)
# def test_list_images_twice():
# """Regression test: requesting an image list twice should not change the outcome."""
# tcl = TessCoordList(
# [
# TessCoord(
# sector=5,
# camera=1,
# ccd=4,
# column=1553.9,
# row=1103.0,
# time="2018-11-21 17:35:00",
# ),
# TessCoord(
# sector=5,
# camera=1,
# ccd=4,
# column=1553.9,
# row=1103.0,
# time="2018-11-22 17:35:00",
# ),
# ]
# )
# len1 = len(tcl.list_images())
# len2 = len(tcl.list_images())
# assert len1 == len2
#
#
# def test_list_images():
# crd = TessCoord(sector=11, camera=2, ccd=2, column=1699, row=1860)
# imglist = crd.list_images()
# assert len(imglist) == 1248
# df = imglist.to_pandas()
# assert len(df) == len(imglist)

0 comments on commit 1fcd3eb

Please sign in to comment.