Thanks for the ping.
So, I think the problem is that a couple of different things are converging to make it hard to see what’s going on.
First of all, it’s not always obvious, but re-running the cell in the notebook which calls sim_runner does NOT actually do the same thing each time, UNLESS you reset the model observatory. This is because the model observatory is updated during the sim_runner execution, so that “time passes”. In other words, check mo.mjd
before and after you try to run sim_runner, to make sure it’s trying to obtain observations when you think it is. A good practice would be to reset your model observatory to a known time at the start of the cell.
Secondly, at least when I tried this – when sim_runner “crashes out” due to not being able to obtain observations, it doesn’t return anything! So your “observations” array from sim_runner is empty even though the model observatory is updated inside sim_runner. This makes it look like nothing was observed … however, it actually was. If you notice the time on the model observatory after the error, it’s 60218.33631284 instead of 60218, when it started. So sim_runner ran (successfully) for 0.3 days or so, and if you try running sim_runner with a survey length of 0.3 days, you do see the successful observations returned.
So the question really is – what happened at mjd = 60218.33631284 ?
And then, if I look at the observations which were acquired if I ran for 0.3 days I see the final altitude of the field is 0.377 radians … which is 21 degrees, and the pointing limit of the telescope is again +20 degrees.
So the observatory model is refusing to observe pointings which are outside the range of where it can safely observe, and then sim_runner says it cannot schedule observations (because this one target is its only choice, and the target has now set).
Does this answer the question?
Now, I will also add this —
the simulated example survey in the notebook is really just a very simple example. Fixing only a few target observations and insisting on these in “generate_observations_rough()” without any consideration of whether the targets are visible or not results in these kind of problems – not all fields are visible all times.
It’s not how any of our actual surveys in use work … every survey we actually use with the CoreScheduler in full simulations includes a check on whether the field is at a usable altitude, in the “calc_reward_function”. And then, because the reward is “infeasible” (-Infinity), the requested observation will never show up as being requested – and so sim_runner doesn’t crash from this effect.
The RA/Dec in the simulated simple example were chosen so that the pointing is visible for the length of time shown in the sim_runner example, but this is not how you should try to program any real survey.
If you are trying to program something which will acquire observations of a particular point on the sky, but does account for visibility, you might want to have a look at the FieldSurvey. You might still want to be able to propose valid targets for times when your fields are not available, but I think the error/crash is only triggered by repeatedly requesting invalid targets (not just not proposing targets).