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

Fix for program ending during new field or same field setup. #67

Closed

Conversation

michaelJwilson
Copy link

@michaelJwilson michaelJwilson commented Aug 10, 2019

As program ending was tested after the shutter was opened and ETC started, if a program
ended during new field or same field setup then negative exposures were generated by the reset

mjd_now  = mjd_program_end

I've added checks on program ending during setup after both new_tile and continue_same_tile, i.e. before ETC started, and an assertion on exposures > 0.

I think this was not specific to twilight, but affected each program change. However, adding more program changes and shorter exposures did exacerbate the problem.

…LDSETUP of program end, reject the tile. Invoking standard time rejection handling (TILE_DELAY).
…tion is simply to reject the tile in this period, aand wait on it ending.
@sbailey
Copy link
Contributor

sbailey commented Aug 12, 2019

@dkirkby and @schlafly please take a look at this and comment.

We need to have a way to handle transitions between programs that doesn't generate negative exptimes (issue #65), but I think that logic should be owned in desisurvey.scheduler.Scheduler.next_tile() rather than by having the simulator watch for program transitions and make a choice to not call next_tile for awhile. i.e. the simulator should be simulating ICS, and ICS will be calling next_tile in these situations without waiting. So I think we need a different fix on the simulator side to accept whatever next_tile says, but not end up with negative exptimes.

@michaelJwilson michaelJwilson changed the title Fix for program enduring during new field or same field setup. Fix for program ending during new field or same field setup. Aug 12, 2019
@schlafly
Copy link
Contributor

I agree that next_tile needs to be smarter about choosing which program to select a tile from near program boundaries. That said, I think next_tile should always return a tile if there are things that are observable; I definitely don't think that either the simulator or next_tile should see a program boundary coming and decide to sit around for a while. I think the easiest approach would be to select tiles in next_tile based not on the current program, but based on the program in 5 minutes (or something).

I wouldn't have guessed the simulator needed much in the way of special behavior around program boundaries. ETC.update() will stop a dark tile if the SNR^2 starts dropping, so I might have just went with 'finish the current tile, then ask next_tile for the next one.'

@michaelJwilson
Copy link
Author

My minimal fix might not be optimal, but it solves a worse problem by design.

The branches are becoming very intertwined, it'd be nice to tidy this up to not have to merge separate threads every time.

@sbailey
Copy link
Contributor

sbailey commented Sep 13, 2019

I agree that you've identified a genuine problem, but my core objection is that this PR fixes the problem in the simulator but not in the actual operations code, thus making the simulator a less realistic model of what would actually be observed (without further fixes on the desisurvey side).

The simulator should call next_tile just like ICS will (i.e. without any waiting or even knowledge about program boundaries), and any problems with what next_tile returns should be fixed on the desisurvey / next_tile side, rather than with a workaround on the simulator side to make it do what we wish the real system would do (but perhaps doesn't).

Could you try fixing this by removing any waiting logic here in surveysim, and then evaluating (and possibly contributing a fix) for what happens on the desisurvey / next_tile side?

@michaelJwilson
Copy link
Author

Closing this given #65 remains as a record of the problem and the desired solution is orthogonal to this fix.

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.

3 participants