Skip to content
Snippets Groups Projects
Commit 49c6e4d6 authored by Thomas Jürges's avatar Thomas Jürges
Browse files

SW-546: Lazy init of sub-band earlier

parent a54771bc
No related branches found
No related tags found
No related merge requests found
......@@ -362,6 +362,85 @@ namespace LOFAR
"this frame.");
return;
}
/**
* Lazily initialize last part of the book keeping map from the 1st
* frame that is received for a sub-band.
* subBandBookKeeping[bandNr].isInitialised is set to false when
* TBB_Dipole::init gets called and sets up the book keeping map.
*
* Also create a new TBB_SubbandDataset in the DipoleGroup
*/
else if(currentSubBand.isInitialised == false)
{
currentSubBand.time0 = frame.header.time;
currentSubBand.slice0 = sliceNr;
currentSubBand.dataSet.reset(new dal::TBB_SubbandDataset(
itsDipoleGroup()->subband(bandNr)));
// Store the data in the hdf5 file. Do not provide a file name!
currentSubBand.dataSet->create1D(currentSubBand.totalSizeInSamples,
currentSubBand.totalSizeInSamples, "",
currentSubBand.dataSet->LITTLE);
currentSubBand.dataSet->groupType().value = "SubbandDataset";
currentSubBand.dataSet->time().value = currentSubBand.time0;
currentSubBand.dataSet->bandNumber().value = bandNr;
currentSubBand.dataSet->sliceNumber().value = sliceNr;
currentSubBand.dataSet->samplesPerFrame().value = -1;
currentSubBand.dataSet->centralFrequency().value =
currentSubBand.centralFrequency;
currentSubBand.dataSet->centralFrequencyUnit().value = "Hz";
currentSubBand.dataSet->timeResolution().value =
SPECTRAL_TRANSFORM_SIZE /
(frame.header.sampleFreq * 1000000.0);
currentSubBand.dataSet->timeResolutionUnit().value =
"s";
// Filled in when the sub-band is complete:
currentSubBand.dataSet->dataLength().value = 0;
/**
* ATTENTION!
* Storing this value makes no sense. Only if all frames of a
* sub-band contain the same number of samples then this value
* is representing something real.
* But obviously this is only true if all n frames of a
* sub-band, 0 < n < infinity, contain exactly the same number
* of samples.
*
* A simple example that is pretty general where this does not
* hold:
* - Every sub-band that has a last frame with less than 480
* samples would have two values: 480 and the number of
* samples in the last frame.
*/
currentSubBand.dataSet->samplesPerFrame().value =
frame.header.nOfSamplesPerFrame;
// TODO
currentSubBand.dataSet->bandwidth().value = 0;
currentSubBand.dataSet->bandwidthUnit().value =
"not filled in";
currentSubBand.isInitialised = true;
LOG_INFO_STR("TBB: Band #"
<< currentSubBand.bandNr
<< " initialised with the following data: time0 = "
<< currentSubBand.time0
<< ", slice0 = "
<< currentSubBand.slice0
<< ", HDF5 SubbandDataset name = "
<< currentSubBand.dataSet->name()
<< " , dipole = "
<< itsDipoleGroup()->name()
<< ", station id = "
<< static_cast< uint32_t >(frame.header.stationID)
<< ", rsp = "
<< static_cast< uint32_t >(frame.header.rspID)
<< ", rcu = "
<< static_cast< uint32_t >(frame.header.rcuID));
}
}
else
{
......@@ -371,80 +450,6 @@ namespace LOFAR
return;
}
/**
* Lazily initialize last part of the book keeping map from the 1st
* frame that is received for a sub-band.
* subBandBookKeeping[bandNr].isInitialised is set to false when
* TBB_Dipole::init gets called and sets up the book keeping map.
*
* Also create a new TBB_SubbandDataset in the DipoleGroup
*/
const uint32_t sliceNr{getSpectralModeSliceNr(frame.header)};
if(currentSubBand.isInitialised == false)
{
currentSubBand.time0 = frame.header.time;
currentSubBand.slice0 = sliceNr;
currentSubBand.dataSet.reset(new dal::TBB_SubbandDataset(
itsDipoleGroup()->subband(bandNr)));
// Store the data in the hdf5 file. Do not provide a file name!
currentSubBand.dataSet->create1D(currentSubBand.totalSizeInSamples,
currentSubBand.totalSizeInSamples, "",
currentSubBand.dataSet->LITTLE);
currentSubBand.dataSet->groupType().value = "SubbandDataset";
currentSubBand.dataSet->time().value = currentSubBand.time0;
currentSubBand.dataSet->bandNumber().value = bandNr;
currentSubBand.dataSet->sliceNumber().value = sliceNr;
currentSubBand.dataSet->samplesPerFrame().value = -1;
// Filled in when the sub-band is complete.
currentSubBand.dataSet->dataLength().value = 0;
/**
* ATTENTION!
* Storing this value makes no sense. Only if all frames of a
* sub-band contain the same number of samples then this value is
* representing something real.
* But obviously this is only true if all n frames of a sub-band,
* 0 < n < infinity, contain exactly the same number of samples.
*
* A simple example that is pretty general where this does not hold:
* - Every sub-band that has a last frame with less than 480
* samples would have two values: 480 and the number of samples
* in the last frame.
*/
currentSubBand.dataSet->samplesPerFrame().value =
frame.header.nOfSamplesPerFrame;
// TODO
currentSubBand.dataSet->centralFrequency().value = 0;
currentSubBand.dataSet->centralFrequencyUnit().value =
"not filled in";
currentSubBand.dataSet->bandwidth().value = 0;
currentSubBand.dataSet->bandwidthUnit().value = "not filled in";
currentSubBand.dataSet->timeResolution().value = 1;
currentSubBand.dataSet->timeResolutionUnit().value =
"not filled in";
currentSubBand.isInitialised = true;
LOG_INFO_STR("TBB: Band #"
<< currentSubBand.bandNr
<< " initialised with the following data: time0 = "
<< currentSubBand.time0
<< ", slice0 = "
<< currentSubBand.slice0
<< ", HDF5 SubbandDataset name = "
<< currentSubBand.dataSet->name()
<< " , dipole = "
<< itsDipoleGroup()->name()
<< ", station id = "
<< static_cast< uint32_t >(frame.header.stationID)
<< ", rsp = "
<< static_cast< uint32_t >(frame.header.rspID)
<< ", rcu = "
<< static_cast< uint32_t >(frame.header.rcuID));
}
/**
* Out-of-order frame arrival has not been seen for Dutch stations.
* TBB from int'l stations is not (yet) dumped to CEP.
......
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