Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tess-ephem"
version = "0.6.0"
version = "0.6.1"
description = "Where are Solar System objects located in TESS FFI data?"
license = "MIT"
authors = ["Geert Barentsen <hello@geert.io>",
Expand Down
2 changes: 1 addition & 1 deletion src/tess_ephem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

from .ephem import TessEphem, ephem # noqa: E402

__version__ = "0.6.0"
__version__ = "0.6.1"
__all__ = ["ephem", "TessEphem"]
32 changes: 20 additions & 12 deletions src/tess_ephem/ephem.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,24 +144,32 @@ def predict(self, time: Time) -> DataFrame:

sky = self.predict_sky(time)
crd = SkyCoord(sky.ra, sky.dec, unit="deg")
log.info("Started matching the ephemeris to TESS observations")

# Get sector, camera, ccd, col, row at each time.
# Determine TESS sector corresponding to each time
sectors = []
for t in time.jd:
sectors.append(
pointings["Sector"].value[
np.logical_and(t > pointings["Start"], t < pointings["End"])
]
)

log.info("Started matching the ephemeris to TESS observations")
# Get sector, camera, ccd, col, row
df = DataFrame()
for i, t in enumerate(time):
try:
result = locate.get_pixel_locations(crd[i], time=t).to_pandas()
result["time"] = t
df = concat(
[df, result[["time", "Sector", "Camera", "CCD", "Column", "Row"]]]
)
# If object is not observed by TESS at time, skip time.
except ValueError:
continue
for s in np.unique(np.hstack(sectors)):
sector_mask = [s in sublist for sublist in sectors]
result = locate.get_pixel_locations(crd[sector_mask], sector=s).to_pandas()
result["time"] = time[sector_mask][result["Target Index"]]
df = concat(
[df, result[["time", "Sector", "Camera", "CCD", "Column", "Row"]]]
)
Comment on lines +164 to +166
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure which is faster, if doing a concatenation each time in the for loop vs appending to a list and and then concatenating after the loop.

df = []
for ... in ...:
      ...
      ...
      df.append(result[...])
df = pd.concat(df, axis=0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested this and the two methods take the same time to run, so I suggest we leave the code as is.


if len(df) == 0:
log.warning("Warning: Target not observed by TESS at defined times.")
else:
# Reorder df in ascending time
df = df.sort_values(by="time", ascending=True)
# Make column names lowercase in df
df.columns = [x.lower() for x in df.columns]
# Make sector, camera, ccd integers
Expand Down