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

Conversation

javierggt
Copy link
Contributor

@javierggt javierggt commented Aug 30, 2023

Description

To determine that an observation already happened, I use kadi.events.dwells. I only consider observations before the last dwell in kadi.events. This avoids the No level 0 data in weekly processing.

Interface impacts

None

Testing

Unit tests

  • No unit tests
  • Mac
  • Linux
  • Windows

Independent check of unit tests by Jean

  • Linux

Functional tests

As a quick test that this PR does "something", I did the following, which succeeds on this branch, but fails in current master (and is the cause of the No level 0 data error):

from mica.archive import aca_l0
from agasc.supplement.magnitudes import star_obs_catalogs as soc
from cxotime import CxoTime
soc.load()
i = np.argmax(CxoTime(soc.STARS_OBS['obs_start']))
aca_l0.get_files(soc.STARS_OBS['obsid'][i])

@jeanconn
Copy link
Contributor

jeanconn commented Sep 6, 2023

I suppose the race condition I was thinking about (during our tagup) was if the CXCDS archive is still actively ingesting / processing level 0 image data at the time of the mica update, the kadi update and events may be more up-to-date than than the mica level 0 data. But this is unlikely with the current cron job processing timing (kadi events done 30 minutes before mica update).

@@ -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.

@javierggt javierggt merged commit 689c53d into master Sep 13, 2023
This was referenced Sep 18, 2023
@jeanconn jeanconn deleted the no-level0-data branch October 3, 2023 14:33
@javierggt javierggt mentioned this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants