Skip to content
Snippets Groups Projects
Commit b42bb709 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-2344: only loop over unique gridded timestamps

parent ed006d37
Branches
Tags
1 merge request!1075TMSS-2344
...@@ -904,15 +904,15 @@ def evaluate_sky_min_elevation_constraint(scheduling_unit: models.SchedulingUnit ...@@ -904,15 +904,15 @@ def evaluate_sky_min_elevation_constraint(scheduling_unit: models.SchedulingUnit
# evaluate at start/stop/center of observation # evaluate at start/stop/center of observation
# take along the relative start_time of this task compared to the scheduling unit's start_time # take along the relative start_time of this task compared to the scheduling unit's start_time
# currently we only check at bounds and center, we probably want to add some more samples in between later on
task_proposed_start_time = proposed_start_time + task.relative_start_time task_proposed_start_time = proposed_start_time + task.relative_start_time
task_proposed_end_time = task_proposed_start_time + task.specified_duration
task_proposed_center_time = task_proposed_start_time + task.specified_duration / 2 task_proposed_center_time = task_proposed_start_time + task.specified_duration / 2
task_proposed_end_time = task_proposed_start_time + task.specified_duration
gridded_timestamps = set([gridder.grid_time(t) for t in (task_proposed_start_time, task_proposed_center_time, task_proposed_end_time)])
# currently we only check at bounds and center, we probably want to add some more samples in between later on for gridded_timestamp in gridded_timestamps:
for timestamp in (task_proposed_start_time, task_proposed_center_time, task_proposed_end_time):
for station in stations: for station in stations:
for pointing, min_elevation in pointings_and_min_elevations: for pointing, min_elevation in pointings_and_min_elevations:
gridded_timestamp = gridder.grid_time(timestamp)
station_target_rise_and_set_times = coordinates_timestamps_and_stations_to_target_rise_and_set(pointing=pointing, station_target_rise_and_set_times = coordinates_timestamps_and_stations_to_target_rise_and_set(pointing=pointing,
timestamps=(gridded_timestamp,), timestamps=(gridded_timestamp,),
stations=(station,), stations=(station,),
...@@ -940,8 +940,8 @@ def evaluate_sky_min_elevation_constraint(scheduling_unit: models.SchedulingUnit ...@@ -940,8 +940,8 @@ def evaluate_sky_min_elevation_constraint(scheduling_unit: models.SchedulingUnit
# check if constraint is met... # check if constraint is met...
if rise_and_set_time['always_below_horizon'] or \ if rise_and_set_time['always_below_horizon'] or \
(rise_and_set_time['rise'] is not None and timestamp < gridder.minus_margin(rise_and_set_time['rise'])) or \ (rise_and_set_time['rise'] is not None and gridded_timestamp < gridder.minus_margin(rise_and_set_time['rise'])) or \
(rise_and_set_time['set'] is not None and timestamp > gridder.plus_margin(rise_and_set_time['set'])): (rise_and_set_time['set'] is not None and gridded_timestamp > gridder.plus_margin(rise_and_set_time['set'])):
elevation = compute_elevation(pointing, gridded_timestamp, station) elevation = compute_elevation(pointing, gridded_timestamp, station)
if elevation < min_elevation.rad: if elevation < min_elevation.rad:
# constraint not met. update result, and do early exit. # constraint not met. update result, and do early exit.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment