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

New methods for scheduling #69

Closed
louisbondonneau opened this issue Mar 8, 2024 · 1 comment
Closed

New methods for scheduling #69

louisbondonneau opened this issue Mar 8, 2024 · 1 comment

Comments

@louisbondonneau
Copy link

After creating an optimized schedule with Nenupy and the genetic algorithm I still have gaps between my observation blocks. It would be great to have a method for extending the blocks on what is observable...
(I MP you a nootbook for example on Slack)
Capture d’écran 2024-03-08 à 10 26 19

@AlanLoh
Copy link
Owner

AlanLoh commented Apr 15, 2024

Hey Louis,

Great suggestion -as we have already discussed in private-.
I've added a new method Schedule.extend_scheduled_observations() to extend the scheduled observation blocks.

There is also a new argument ObsBlock(..., max_extended_duration=<dt>) if it is set to None (default), nothing is done. But if you give a duration, the algorithm will automatically try to increase the block duration.

As always, it's not bug-free guaranteed, so tell me if it suits your needs and if you see anything that should be corrected.

Here is a simple example:

from nenupy.schedule import (
    Schedule,
    ObsBlock,
    ESTarget,
    Constraints,
    ElevationCnst,
)
from astropy.time import Time, TimeDelta
import astropy.units as u

schedule = Schedule(
    time_min=Time('2024-04-10 00:00:00'),
    time_max=Time('2024-04-12 00:00:00'),
    dt=TimeDelta(10*60, format='sec')
)

schedule.plot(days_per_line=2, grid=False)

# Define ObsBlocks ---> note the new argument `max_extended_duration `
casa = ObsBlock(
    name='Cas A',
    program='es00',
    target=ESTarget.fromName('Vir A'),
    duration=TimeDelta(60*60, format='sec'),
    max_extended_duration=TimeDelta(5*3600, format='sec')
)
cyga = ObsBlock(
    name='Cyg A',
    program='es00',
    target=ESTarget.fromName('Cyg A'),
    duration=TimeDelta(60*60, format='sec'),
    max_extended_duration=TimeDelta(10*3600, format='sec'),
    constraints=Constraints(ElevationCnst(20))
)

my_observations = casa*2 + cyga*3

schedule.insert(my_observations)

schedule.book( optimize=False )

schedule.plot(days_per_line=2, grid=False)

schedule.extend_scheduled_observations(relative_score_threshold=0.4)

schedule.plot(days_per_line=2, grid=False)

@AlanLoh AlanLoh closed this as completed Jun 7, 2024
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

No branches or pull requests

2 participants