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

OPSIM-1073: Modify filter scheduler (u/y swap default) and update twilight survey feasibility function #357

Merged
merged 3 commits into from
Sep 9, 2023

Conversation

yoachim
Copy link
Member

@yoachim yoachim commented Sep 7, 2023

Basis functions used by the twilight near sun survey. Also update filter schdeduler to default to u swaps with y.

Copy link
Member

@rhiannonlynne rhiannonlynne left a comment

Choose a reason for hiding this comment

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

I have some questions, and I think I need to submit a review here in order for you to see the comments.

time_to_12deg : `float`
How much time must be remaining before 12 degree twilight in the morning (minutes)
time_remaining : `float`
Minimum about of time that must be available before trying to execute (minutes)
Copy link
Member

Choose a reason for hiding this comment

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

This feels like a confusing way to write this .. I think it's purpose is to make sure that the twilight NEO survey functions within a limited amount of time near 12 degree twilight and also happens to scale that amount of time depending on the time of year (at least for evening twilight, since that's set by sun_alt .. but it doesn't do the same for the morning twilight).
Would it make sense to recast this function in that light, as taking arguments of the minimum amount of time required, as well as a number between 0-1 that represents the fraction of the time from 12-18 degree twilight to pass as "good" to use?
The time between -12 and -18 degree twilight varies from 27 to 36 minutes over the year so some parts of the year could have more time available and some less.

Copy link
Member

Choose a reason for hiding this comment

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

I poked around "how much time is available between -12 and -18 twilight", and also "how much time did we actually allocate to evening and twilight observations" and it's enlightening.
I think this change you're applying here will help, but there will still be some discrepancies between morning and evening twilight that probably aren't intentional.

Copy link
Member

Choose a reason for hiding this comment

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

Screenshot 2023-09-07 at 8 53 09 PM

(histogram shows how many nights had a twilight length of X minutes .. splits between morning and evening -- the 'visits' histograms show how much time was actually used in baseline_v3.2, and the other histograms are the time between -12 and -18 twilight)

Copy link
Member

Choose a reason for hiding this comment

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

which suggests you might go for something sort of like what I tested here - https://github.com/rhiannonlynne/notebooks/blob/main/twilight_time.ipynb

Copy link
Member Author

Choose a reason for hiding this comment

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

There's an asymmetry in picking when/how to start the inner solar system observations, I'm not sure what the best way to deal with it is. At sunset, we clearly want to start the observations as soon as possible (but we can't start at too high an airmass because we need to be able to complete multiple visits before points set below the alt limit). At sunrise, we can go right to the alt limit since things are rising, so that means we want to start a sequence as late as possible.

It's all about how much margin for error we want to have, and it gets complicated because on one side that error is easy to express as an altitude-buffer and on the other side as a time-buffer.

This was the basis function used in v3.2. We can check if yours works better and put that in for v3.3.

Copy link
Member

Choose a reason for hiding this comment

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

Yes .. tricky.
I assumed that the minimum time was being applied to sunrise because you ran out of time as the sun rose. Your description sounds like the minimum time could also be applied to sunset?
This is just a True/False for the whole sky, right? Does it make sense to also have a function which is weighting towards which airmass is chosen (I guess I had thought that would come from other places, like the footprint).

Copy link
Member

Choose a reason for hiding this comment

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

One thing with the mix of sun altitude (for sunset) and time (for sunrise) is that it's not super easy to see how those differences are working out, as these are completely different kinds of "units", so it seems harder to maintain and interpret.
Agree that maybe the way to go is to just test both.

Copy link
Member

Choose a reason for hiding this comment

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

Updated the notebook to actually run the SunAltitudeFeasibilityFunction as well, and I think these actually behave pretty similarly, if configured in similar sorts of ways. So maybe it just depends which one looks easier to keep.

Screenshot 2023-09-08 at 1 57 19 PM

Copy link
Member Author

Choose a reason for hiding this comment

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

Having the fraction of twilight time as a kwarg might not be best. Since the amount of twilight time changes through the year sometimes it can start before it's ideal and/or not have enough time to complete a quad. There's also the potential to set it so it will silently fail to execute (e.g., max_fraction=0.1 and min_time=15.0).

Copy link
Member

Choose a reason for hiding this comment

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

The time required to do a quad isn't really spelled out (probably should be documented somewhere or demonstrated how to calculate). The sun alt could be set to a point where quads aren't possible couldn't it?

result = self.survey_features["n_obs_count_all"].feature / (
self.survey_features["n_obs_count_in_filt"].feature + 1
)
return result
Copy link
Member

Choose a reason for hiding this comment

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

Just out of curiosity - this (the idea of distributing visits among filters) is also reflected in the footprint basis function, isn't it? Why is this necessary as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

For the twilight inner solar system survey we can't use the regular footprint basis function because we don't want to enforce spatial uniformity of the observations. We just want them on the ecliptic, we don't care if parts of the ecliptic don't happen to get observed. So the footprint basis function ends up with zero weight, it's just there as an effective mask, so it can't regulate filter distribution.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, thanks! That's a good reason.

@rhiannonlynne rhiannonlynne changed the title Tickets/opsim 1073 OPSIM-1073: Modify filter scheduler (u/y swap default) and update twilight survey feasibility function Sep 8, 2023
@yoachim yoachim merged commit f76f5e0 into main Sep 9, 2023
4 checks passed
@rhiannonlynne rhiannonlynne deleted the tickets/OPSIM-1073 branch November 1, 2023 18:53
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