generate_inputs
Module to generate inputs for the simulation.
- ska_sdp_resource_model.simulate.generate_inputs.add_observing_schedule_id_columns(observing_schedule_df)[source]
Add SB_ID and SBI_ID columns to the observing schedule DataFrame.
SB_ID is a unique identifier for each Scheduling Block type with the format {SB_type_shortname}_{00X}, where SB_type_shortname is the first letter of the first two words of the SB_type and 00X is a zero-padded integer incremented for each SB_type.
SBI_ID is a unique identifier for each Scheduling Block instance with the format {SB_ID}_{00X}, where SB_ID is the unique identifier for the Scheduling Block type and 00X is a zero-padded integer incremented for each instance of the Scheduling Block. Currently this is not used in the simulation but will be used to track individual instances of Scheduling Blocks in the future.
- Parameters:
observing_schedule_df (pd.DataFrame) – Observing schedule DataFrame. Must contain the column “SB_type”.
- Returns:
observing_schedule_df (pd.DataFrame) – Observing schedule DataFrame with ID columns added.
- ska_sdp_resource_model.simulate.generate_inputs.cycle_scheduling_blocks(scheduling_block_types_config, schedule_length_hrs=168)[source]
Iterate over scheduling block types configuration.
- Parameters:
scheduling_block_types_config (dict) – Scheduling block types configuration.
schedule_length_hrs (int) – Total length of the observation schedule in hours.
- Returns:
scheduling_blocks (list) – List of scheduling blocks.
- ska_sdp_resource_model.simulate.generate_inputs.fill_observing_schedule_df(scheduling_blocks)[source]
Generate an observing schedule DataFrame from a list of scheduling blocks.
- Parameters:
scheduling_blocks (list) – List of scheduling blocks.
- Returns:
observing_schedule_df (pd.DataFrame) – Observing schedule DataFrame.
- ska_sdp_resource_model.simulate.generate_inputs.generate_observing_schedule(scheduling_block_types_config, randomise=True, schedule_length_hrs=168, seed=42)[source]
Generate an observing schedule of specified length.
- Parameters:
scheduling_block_types_config (dict) – Scheduling block types configuration.
schedule_length_hrs (int) – Total length of the observing schedule in hours.
seed (int) – Random seed for sampling scheduling blocks.
- Returns:
pd.DataFrame – Observing schedule DataFrame containing randomly sampled
scheduling blocks.
- ska_sdp_resource_model.simulate.generate_inputs.sample_scheduling_blocks(scheduling_block_types_config, schedule_length_hrs=168, seed=42)[source]
Sample scheduling block types to compile a list for generating an observing schedule.
- Parameters:
scheduling_block_types_config (dict) – Scheduling block types.
schedule_length_hrs (configuration.) – Total length of the observing schedule in hours.
- Returns:
observing_schedule (list) – Sampled scheduling blocks
- ska_sdp_resource_model.simulate.generate_inputs.schedule_can_be_filled(current_schedule_length, target_schedule_length, minimum_block_duration)[source]
Check if the schedule can be filled with scheduling blocks.
Checks for remaining gaps in the schedule and if the gaps can be filled with scheduling blocks.
- Parameters:
current_schedule_length (float) – Current length of the schedule (hrs).
target_schedule_length (float) – Target length of the schedule (hrs).
minimum_block_duration (float) – Minimum duration of a scheduling block (hrs).
- Returns:
bool – True if the schedule can be filled with scheduling blocks, False
otherwise.
- ska_sdp_resource_model.simulate.generate_inputs.schedule_incomplete(current_schedule_length, target_schedule_length)[source]
Check if the current schedule length is less than the target schedule length.
- Parameters:
current_schedule_length (float) – Current length of the schedule (hrs).
target_schedule_length (float) – Target length of the schedule (hrs).
- Returns:
bool – True if the current schedule length is less than the target
schedule length, False otherwise.
- ska_sdp_resource_model.simulate.generate_inputs.schedule_remainder_fits_smallest_block(current_schedule_length, target_schedule_length, minimum_block_duration)[source]
Check if the remainder of the schedule can be filled with scheduling blocks.
- Parameters:
current_schedule_length (float) – Current length of the schedule (hrs).
target_schedule_length (float) – Target length of the schedule (hrs).
minimum_block_duration (float) – Minimum duration of a scheduling block (hrs).
- Returns:
bool – True if the remainder of the schedule can be filled with
scheduling blocks, False otherwise.
- ska_sdp_resource_model.simulate.generate_inputs.scheduling_block_too_long(current_schedule_length, target_schedule_length, block_duration)[source]
Check if the scheduling block is too long to fit in the schedule.
- Parameters:
current_schedule_length (float) – Current length of the schedule (hrs).
target_schedule_length (float) – Target length of the schedule (hrs).
block_duration (float) – Duration of the scheduling block (hrs).
- Returns:
bool – True if the scheduling block is too long to fit in the schedule,
False otherwise.