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

Merge remote-tracking branch 'origin/master' into TMSS-259

Conflicts:
	SAS/TMSS/src/tmss/tmssapp/conversions.py
	SAS/TMSS/src/tmss/tmssapp/views.py
parents 2490c90b 203baea4
No related branches found
No related tags found
1 merge request!284Resolve TMSS-259
......@@ -69,6 +69,10 @@ class QAFilteringOTDBBusListener(OTDBBusListener):
class QAFilteringTMSSSubTaskBusListener(TMSSBusListener):
class QAFilteringTMSSSubTaskEventMessageHandler(UsingToBusMixin, TMSSEventMessageHandler):
def __init__(self):
UsingToBusMixin.__init__(self)
TMSSEventMessageHandler.__init__(self)
def _send_qa_command_message(self, subtask_id: int, command_subject: str):
with TMSSsession.create_from_dbcreds_for_ldap() as tmsssession:
tmsssession.set_subtask_status(subtask_id, 'queueing')
......
......@@ -96,7 +96,8 @@ class TestQAService(unittest.TestCase):
cls.tmp_exchange = TemporaryExchange("%s_%s" % (cls.__name__, cls.TEST_UUID))
cls.tmp_exchange.open()
cls.tmss_test_env = TMSSTestEnvironment(exchange=cls.tmp_exchange.address)
cls.tmss_test_env = TMSSTestEnvironment(exchange=cls.tmp_exchange.address,
start_postgres_listener=True, start_ra_test_environment=True)
cls.tmss_test_env.start()
cls.tmss_test_env.populate_schemas()
......
......@@ -7,6 +7,9 @@ from astroplan.observer import Observer
import astropy.time
from functools import lru_cache
import logging
logger = logging.getLogger(__name__)
def create_astroplan_observer_for_station(station: str) -> Observer:
'''
returns an astroplan observer for object for a given station, located in the LBA center of the given station
......@@ -49,6 +52,8 @@ def timestamps_and_stations_to_sun_rise_and_set(timestamps: tuple, stations: tup
for timestamp in timestamps:
observer = create_astroplan_observer_for_station(station)
sunrise_start = observer.sun_rise_time(time=Time(timestamp), which='previous', n_grid_points=SUN_SET_RISE_PRECISION)
if sunrise_start.to_datetime().date() < timestamp.date():
sunrise_start = observer.sun_rise_time(time=Time(timestamp), horizon=-angle_to_horizon, which='nearest', n_grid_points=SUN_SET_RISE_PRECISION)
if sunrise_start.to_datetime().date() < timestamp.date():
sunrise_start = observer.sun_rise_time(time=Time(timestamp), horizon=-angle_to_horizon, which='next', n_grid_points=SUN_SET_RISE_PRECISION)
sunrise_end = observer.sun_rise_time(time=Time(timestamp), horizon=angle_to_horizon, which='next', n_grid_points=SUN_SET_RISE_PRECISION)
......
......@@ -15,8 +15,6 @@ from django.apps import apps
from rest_framework.decorators import api_view
from datetime import datetime
import dateutil.parser
from astropy.coordinates import SkyCoord
from astropy import units as u
from lofar.sas.tmss.tmss.tmssapp.conversions import local_sidereal_time_for_utc_and_station, local_sidereal_time_for_utc_and_longitude, timestamps_and_stations_to_sun_rise_and_set, coordinates_and_timestamps_to_separation_from_bodies
# Note: Decorate with @api_view to get this picked up by Swagger
......@@ -163,7 +161,7 @@ def get_sun_rise_and_set(request):
timestamps = (datetime.utcnow(),)
else:
timestamps = timestamps.split(',')
timestamps = tuple([dateutil.parser.parse(timestamp) for timestamp in timestamps]) # isot to datetime
timestamps = tuple([dateutil.parser.parse(timestamp, ignoretz=True) for timestamp in timestamps]) # isot to datetime
if stations is None:
stations = ("CS002",)
else:
......@@ -207,7 +205,7 @@ def get_angular_separation_from_bodies(request):
timestamps = (datetime.utcnow(),)
else:
timestamps = timestamps.split(',')
timestamps = tuple([dateutil.parser.parse(timestamp) for timestamp in timestamps]) # isot to datetime
timestamps = tuple([dateutil.parser.parse(timestamp, ignoretz=True) for timestamp in timestamps]) # isot to datetime
# calculate
sep_dict = coordinates_and_timestamps_to_separation_from_bodies(angle1=angle1, angle2=angle2, direction_type=direction_type, bodies=bodies, timestamps=timestamps)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment