diff --git a/RTCP/Cobalt/CoInterface/src/Parset.cc b/RTCP/Cobalt/CoInterface/src/Parset.cc index 7169c8ef3abd07f744368dc2427edb57123ecd82..60440518551e5bd03ae2ec954e4f06a2511297ad 100644 --- a/RTCP/Cobalt/CoInterface/src/Parset.cc +++ b/RTCP/Cobalt/CoInterface/src/Parset.cc @@ -765,6 +765,50 @@ namespace LOFAR } } + void Parset::readSubbandIndices( + const string& prefix, + const unsigned int sapNr, + std::vector<unsigned int>& subbandIndices, + const std::vector<unsigned int>& defaultSubbandIndices, + const struct ObservationSettings& settings) const + { + auto obsSAP = settings.SAPs[sapNr]; + + const vector<unsigned> emptyVectorUnsigned; + auto subbandNrs = getUint32Vector(prefix + str(format(".Beam[%u].subbandList") % sapNr), emptyVectorUnsigned, true); + + // Try to match the subband numbers with the global subband numbers, + // if a match is found, add the corresponding subband index to the + // local list of subband indices + subbandIndices.resize(0); + for (unsigned bfSubbandNr : subbandNrs) + { + for (auto obsSubband : obsSAP.subbands) + { + if (bfSubbandNr == obsSubband.stationIdx) + { + subbandIndices.push_back(obsSubband.idx); + } + } + } + + ASSERTSTR(subbandIndices.size() == subbandNrs.size(), + "Could not map all subbands for " << prefix << + ", selected " << subbandNrs.size() << " subbands, but matched " << + subbandIndices.size() << " subbands."); + + // In case no subband numbers were matched, + // fall back to using all global subband indices + if (subbandIndices.size() == 0) + { + subbandIndices.resize(0); + for (unsigned int subbandIdx : defaultSubbandIndices) + { + subbandIndices.push_back(subbandIdx); + } + } + } + void Parset::readQuantizerSettings( std::string prefix, ObservationSettings::BeamFormer::StokesSettings::QuantizerSettings& qtSettings, @@ -897,6 +941,15 @@ namespace LOFAR unsigned int nrSAPs = settings.SAPs.size(); + // Read default subband indices + beamFormer.SAPs.resize(nrSAPs); + for (unsigned int sapNr = 0; sapNr < nrSAPs; sapNr++) + { + auto& obsSAP = settings.SAPs[sapNr]; + auto& bfSAP = beamFormer.SAPs[sapNr]; + readSubbandIndices("Cobalt.BeamFormer", sapNr, bfSAP.subbandIndices, obsSAP.subbandIndices(), settings); + } + if (!beamFormer.doFlysEye) { readTABs("Observation.Beam", settings.SAPs); @@ -992,35 +1045,9 @@ namespace LOFAR bfSAP.nrIncoherent = 0; // Read subband numbers for the current beamFormer pipeline - const vector<unsigned> emptyVectorUnsigned; - auto bfSubbandNrs = getUint32Vector(prefix + str(format(".Beam[%u].subbandList") % sapNr), emptyVectorUnsigned, true); - - // Try to match the subband numbers with the global subband numbers, - // if a match is found, add the corresponding subband index to the - // local list of subband indices - bfSAP.subbandIndices.resize(0); - for (unsigned bfSubbandNr : bfSubbandNrs) - { - for (auto obsSubband : obsSAP.subbands) - { - if (bfSubbandNr == obsSubband.stationIdx) - { - bfSAP.subbandIndices.push_back(obsSubband.idx); - } - } - } - - ASSERTSTR(bfSAP.subbandIndices.size() == bfSubbandNrs.size(), - "Could not map all subbands for beamFormer " << pipelineNr << - ", selected " << bfSubbandNrs.size() << " subbands, but matched " << - bfSAP.subbandIndices.size() << " subbands."); - - // In case no subband numbers were matched, - // fall back to using all global subband indices - if (bfSAP.subbandIndices.size() == 0) - { - bfSAP.subbandIndices = settings.SAPs[sapNr].subbandIndices(); - } + readSubbandIndices(prefix, sapNr, bfSAP.subbandIndices, + settings.beamFormer.SAPs[sapNr].subbandIndices, + settings); // Fill in the TABs for the current pipeline/SAP for (unsigned localTabNr = 0; localTabNr < nrTABs; localTabNr++) { @@ -1041,14 +1068,12 @@ namespace LOFAR } // end for pipelineNr // Register all TABs in the global list of TABs - beamFormer.SAPs.resize(nrSAPs); for (unsigned sapNr = 0; sapNr < nrSAPs; sapNr++) { auto& sap = beamFormer.SAPs[sapNr]; sap.globalSapIdx = sapNr; sap.nrCoherent = 0; sap.nrIncoherent = 0; - sap.subbandIndices = settings.SAPs[sapNr].subbandIndices(); for (auto& pipeline : beamFormer.pipelines) { diff --git a/RTCP/Cobalt/CoInterface/src/Parset.h b/RTCP/Cobalt/CoInterface/src/Parset.h index 140b97930476ef6185a9678ac424a695bd3c555a..d153e408fb93487968789a716045bc69766424ab 100644 --- a/RTCP/Cobalt/CoInterface/src/Parset.h +++ b/RTCP/Cobalt/CoInterface/src/Parset.h @@ -979,6 +979,13 @@ namespace LOFAR const unsigned int nrAntennaFields, std::vector<ObservationSettings::SAP>& SAPs) const; + void readSubbandIndices( + const string& prefix, + const unsigned int sapNr, + std::vector<unsigned int>& subbandIndices, + const std::vector<unsigned int>& defaultSubbandIndices, + const struct ObservationSettings& settings) const; + const ObservationSettings::BeamFormer::StokesSettings::QuantizerSettings defaultQuantizerSettings() const; void readQuantizerSettings( diff --git a/SubSystems/Online_Cobalt/test/LMM/tMultipleBeamFormers_bf4.parset b/SubSystems/Online_Cobalt/test/LMM/tMultipleBeamFormers_bf4.parset index 4be25dbd5a0aa5e11f5dc9364830984eff6ba94b..25cb987efff1e36501df3b072279c74258f78cc6 100644 --- a/SubSystems/Online_Cobalt/test/LMM/tMultipleBeamFormers_bf4.parset +++ b/SubSystems/Online_Cobalt/test/LMM/tMultipleBeamFormers_bf4.parset @@ -11,8 +11,7 @@ Cobalt.BeamFormer.nrDelayCompensationChannels=256 Cobalt.BeamFormer.nrHighResolutionChannels=256 # Select subband subset -Cobalt.BeamFormer.nrPipelines=1 -Cobalt.BeamFormer.Pipeline[0].Beam[0].subbandList=[103..104] +Cobalt.BeamFormer.Beam[0].subbandList=[103..104] #