nplan
Module for night-level observation planning and optimization. Uses the TTP package to optimize nightly observation sequences. See https://github.com/lukehandley/ttp/tree/main for more info about the TTP
- class astroq.nplan.NightPlanner(config_file)[source]
Bases:
objectThe NightPlanner object is responsible for preparing, running, and outputting the TTP slew path optimization. It is built from the config file and requires a semester_planner object to have been created and saved to an h5 file first.
- classmethod from_hdf5(hdf5_path)[source]
Load a NightPlanner object from an HDF5 file.
- Parameters:
hdf5_path (str) – Path to the HDF5 file
- Returns:
Reconstructed NightPlanner object
- Return type:
- get_first_last_indices(selected_df)[source]
Get the first and last available time slots for each target in selected_df.
- Parameters:
selected_df (pd.DataFrame) – DataFrame containing selected targets with unique_id column
- Returns:
MM format for each target’s first available slot last_available_list (list) - Lists of time strings in HH:MM format for each target’s last available slot
- Return type:
first_available_list (list) - Lists of time strings in HH
- run_ttp()[source]
Prepare the TTP input dataframe by parsing the request_selected.csv file. Ensure data is in the correct format for TTP. Then run the TTP optimization to produce the solution which is then saved out as an hdf5 file. If no targets are selected, the function will gracefully return without running the TTP.
- Parameters:
None
- Returns:
None
- astroq.nplan.get_nightly_times_from_allocation(allocation_file, current_day)[source]
Extract start and stop times for a specific date from allocation.csv.
- Parameters:
allocation_file (str) – path to the allocation file
current_day (str) – the date to look for in YYYY-MM-DD format
- Returns:
the start time of the allocation for the current day stop_time (Time object): the stop time of the allocation for the current day
- Return type:
start_time (Time object)