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

TMSS-707: fix conditions for including certain beams in the SIP, add test coverage

parent 35fbaa47
No related branches found
No related tags found
3 merge requests!634WIP: COBALT commissioning delta,!491Resolve TMSS-707,!481Draft: SW-971 SW-973 SW-975: Various fixes to build LOFAR correctly.
......@@ -347,7 +347,7 @@ def create_sip_representation_for_dataproduct(dataproduct: Dataproduct):
beams = []
beam_map = siplib.ArrayBeamMap(
subarraypointing_identifier=get_siplib_identifier(dataproduct.sap.global_identifier, "SAP %s" % dataproduct.sap.id),
beamnumber=0, # todo: we only have one pointing in the feedback. Do we need a reference here?
beamnumber=dataproduct.specifications_doc['identifiers']['tab_index'] if 'identifiers' in dataproduct.specifications_doc else 0, # todo: verify
dispersionmeasure=0, # fixed
numberofsubbands=len(dataproduct.feedback_doc['frequency']['subbands']),
stationsubbands=dataproduct.feedback_doc['frequency']['subbands'],
......@@ -363,13 +363,17 @@ def create_sip_representation_for_dataproduct(dataproduct: Dataproduct):
for field in dataproduct.feedback_doc['antennas']['fields']:
station_fields.setdefault(field['station'], []).append(field['field'])
for station, fields in station_fields.items():
if True: # todo: how to tell whether we have a FlyseyeBeam?
if len(dataproduct.feedback_doc['antennas']['fields']) == 1:
beams.append(
siplib.FlysEyeBeam(
arraybeam_map=beam_map,
station=siplib.Station.preconfigured(station, fields))
)
if True: # todo: how to tell whether we have a CoherentStokesBeam?
elif 'coherent' in dataproduct.specifications_doc and dataproduct.specifications_doc['coherent'] is False:
beams.append(
siplib.IncoherentStokesBeam(arraybeam_map=beam_map)
)
else:
pointing = dataproduct.feedback_doc['target']['pointing']
sap_pointing = dataproduct.sap.specifications_doc['pointing']
beams.append(
......@@ -385,10 +389,6 @@ def create_sip_representation_for_dataproduct(dataproduct: Dataproduct):
equinox=pointing['direction_type'])._get_pyxb_pointing(suppress_warning=True), # todo: Use the diff between pointing and SAP pointing
)
)
if True: # todo: how to tell whether we have a IncoherentStokesBeam?
beams.append(
siplib.IncoherentStokesBeam(arraybeam_map=beam_map)
)
sip_dataproduct = siplib.BeamFormedDataProduct(
dataproduct_map,
......
......@@ -330,9 +330,28 @@ class SIPadapterTest(unittest.TestCase):
self.assertIn(str(dataproduct.global_identifier.unique_identifier), sip.get_prettyxml())
self.assertIn(str(sap.global_identifier.unique_identifier), sip.get_prettyxml())
# assert that a time Beamformed dataproduct in TMSS creates a BeamformedDataproduct in the SIP
# assert that a Beamformed dataproduct in TMSS creates a BeamformedDataproduct in the SIP
self.assertIn(str('<dataProduct xsi:type="sip:BeamFormedDataProduct">'), sip.get_prettyxml())
# assert we get a coherent stokes beam by default
self.assertIn(str('CoherentStokesBeam'), sip.get_prettyxml())
# alter dataproduct, recreate sip
dataproduct.specifications_doc['coherent'] = False
dataproduct.save()
sip = generate_sip_for_dataproduct(dataproduct)
# assert we get an incoherent stokes beam
self.assertIn(str('<arrayBeam xsi:type="sip:IncoherentStokesBeam">'), sip.get_prettyxml())
# alter dataproduct, recreate sip
dataproduct.feedback_doc['antennas']['fields'] = [{'type': 'HBA', 'field': 'HBA0', 'station': 'CS001'}]
dataproduct.save()
sip = generate_sip_for_dataproduct(dataproduct)
# assert we get a flyseye beam if we have a single antenna field
self.assertIn(str('<arrayBeam xsi:type="sip:FlysEyeBeam">'), sip.get_prettyxml())
class FeedbackAdapterTest(unittest.TestCase):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment