Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In agasc supplement processing, only process observations that already happened. #154

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion agasc/supplement/magnitudes/star_obs_catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from astropy import table

from chandra_aca.transform import yagzag_to_pixels
from kadi import commands
from kadi import commands, events
from cxotime import CxoTime


STARS_OBS = None
Expand Down Expand Up @@ -43,6 +44,9 @@ def get_star_observations(start=None, stop=None, obsid=None):

star_obs.add_index(['mp_starcat_time'])

max_time = CxoTime(events.dwells.all().table[-1]['stop'])
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't play much with the django but is something like:
kadi.events.dwells.all().latest('tstart').stop
faster? Not sure if there is a kadi method for this but for the one-off it seems fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. That seems to be faster and give the same result. I made the change.

star_obs = star_obs[star_obs['obs_start'] <= max_time]

return star_obs


Expand Down