Skip to content
Snippets Groups Projects
Commit e9c44d8a authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

TMSS-250: add tests for target rise and set

parent 1cec47cf
No related branches found
No related tags found
1 merge request!291Resolve TMSS-250
...@@ -225,10 +225,11 @@ def can_run_anywhere_within_timewindow_with_sky_constraints(scheduling_unit: mod ...@@ -225,10 +225,11 @@ def can_run_anywhere_within_timewindow_with_sky_constraints(scheduling_unit: mod
min_elevation = Angle(constraints['sky']['min_target_elevation'], unit=astropy.units.rad) min_elevation = Angle(constraints['sky']['min_target_elevation'], unit=astropy.units.rad)
timestamps = (lower_bound, upper_bound) timestamps = (lower_bound, upper_bound)
stations = task['specifications_doc']['stations'] stations = task['specifications_doc']['stations']
# currently we only check at bounds, we probably want to add some more samples in between later on
target_rise_and_set_times = coordinates_timestamps_and_stations_to_target_rise_and_set(angle1=angle1, angle2=angle2, direction_type=direction_type, timestamps=timestamps, stations=tuple(stations), angle_to_horizon=min_elevation) target_rise_and_set_times = coordinates_timestamps_and_stations_to_target_rise_and_set(angle1=angle1, angle2=angle2, direction_type=direction_type, timestamps=timestamps, stations=tuple(stations), angle_to_horizon=min_elevation)
for station, times in target_rise_and_set_times.items(): for station, times in target_rise_and_set_times.items():
for i in range(len(timestamps)): for i in range(len(timestamps)):
if timestamps[i] > times[i]['rise'] and timestamps[i] < times[i]['set']: if not (timestamps[i] > times[0]['rise'] and timestamps[i] < times[0]['set']):
if task['specifications_template'] == 'calibrator observation': if task['specifications_template'] == 'calibrator observation':
logger.info('min_calibrator_elevation=%s constraint is not met at timestamp=%s' % (min_elevation.rad, timestamps[i])) logger.info('min_calibrator_elevation=%s constraint is not met at timestamp=%s' % (min_elevation.rad, timestamps[i]))
else: else:
......
This diff is collapsed.
...@@ -127,8 +127,8 @@ def coordinates_timestamps_and_stations_to_target_rise_and_set(angle1: float, an ...@@ -127,8 +127,8 @@ def coordinates_timestamps_and_stations_to_target_rise_and_set(angle1: float, an
:param angle_to_horizon: the angle between horizon and given coordinates for which rise and set times are returned :param angle_to_horizon: the angle between horizon and given coordinates for which rise and set times are returned
:return A dict that maps station names to a list of dicts with rise and set times for each requested date. :return A dict that maps station names to a list of dicts with rise and set times for each requested date.
E.g. E.g.
{"CS002": [{"rise": datetime(2020, 1, 1, 4, 0, 0)), "set": datetime(2020, 1, 1, 11, 0, 0)}, {"CS002": [{"rise": datetime(2020, 1, 1, 4, 0, 0), "set": datetime(2020, 1, 1, 11, 0, 0)},
{"rise": datetime(2020, 1, 2, 4, 0, 0)), "set": datetime(2020, 1, 2, 11, 0, 0)}] {"rise": datetime(2020, 1, 2, 4, 0, 0), "set": datetime(2020, 1, 2, 11, 0, 0)}]
} }
""" """
if direction_type == "J2000": if direction_type == "J2000":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment