#!/usr/bin/python3 # Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy) # P.O. Box 2, 7990 AA Dwingeloo, The Netherlands # # This file is part of the LOFAR software suite. # The LOFAR software suite is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # The LOFAR software suite is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. from lofar.sas.tmss.tmss.tmssapp.models.scheduling import Subtask from lofar.parameterset import parameterset from lofar.common.datetimeutils import formatDatetime def convert_to_parset(subtask: Subtask) -> parameterset: print(subtask.specifications_doc) parset = dict() # parameterset has no proper assignment operators, so take detour via dict... parset["Observation.startTime"] = formatDatetime(subtask.start_time) parset["Observation.stopTime"] = formatDatetime(subtask.stop_time) parset["Observation.antennaSet"] = subtask.specifications_doc["stations"]["antenna_set"] parset["Observation.VirtualInstrument.stationList"] = subtask.specifications_doc["stations"]["station_list"] parset["Observation.bandFilter"] = subtask.specifications_doc["stations"]["filter"] parset["Observation.sampleClock"] = 200 parset["Observation.nrBitsPerSample"] = 8 # convert dict to real parameterset, and return it parset = parameterset(parset) print(parset) return parset