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
Add function to add calibration exposures #55
Conversation
py/surveysim/util.py
Outdated
for j in range(arcs_per_night): | ||
output.add_row([expid, -1, -1, 0.0, 0.0, 0.0, night, | ||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, | ||
'NONE', 'arc']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This add_row
logic makes me nervous because it is fragilely dependent upon exactly which columns exist and in what order they appear in the input exposures table, thus creating a tight coupling with desisurvey.progress.Progress.get_exposures()
and making it harder to use outside of that context. How about calling add_row
with a dict, where you have filled in the keys of the dict only for columns that actually exist in the input exposures
table? If that suggestion doesn't make sense, ping me and I'll put together a code example that might be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure I understand what you mean here, & that's reasonable.
I made one minor change to use
One more request: In the future we'll want the flexibility to have arcs and flats with different exposure times (even if they both default to 10 sec for now). Darks will have exposure times >>10 sec (e.g. 1000 sec) and zero will have 0. Otherwise looks good. Thanks. |
One more thing:
I'm fine with either one as long as it is documented. If you prefer (2), I'll note that the implementation could be made much faster by directly adding calibration rows to the input exposures table with dummy EXPID values, sorting by MJD at the end, and then do the final update with meaningful EXPIDs in order. The current runtime of 2 minutes for the full survey isn't too bad, so that shouldn't be the motivating factor for choosing (1) vs. (2). I'm testing desihub/desisim#275 (wrap-newexp updates) now. |
I think the way it is set up now, it is no longer necessary to add the 'EXPID' column to the input. I'll look at that. |
Another small thing: the calibration MJDs are added in reverse chronological order compared to the calibration EXPIDs. Please fix and add a test that after adding the calibration exposures:
It would be fine to start assigning the calibration exposures at 1pm local time and walk forward from there based upon exposure times and readout overheads. If the user requests more calibration exposures than can fit in the time window before the first observation of that night, throw an error. |
OK, I think I've fixed all the "one more things":
|
Just waiting for tests to complete now. |
As requested by desihub/desisim#273, this PR adds a function to add calibration exposures to the output of
desisurvey.progress.Progress.get_exposures()
.