Skip to content
Snippets Groups Projects
Commit 21cf1641 authored by Jan David Mol's avatar Jan David Mol
Browse files

bug 1362: don't discard station data if there is a lot of flagging but no stations are merged

parent 806d03e4
No related branches found
No related tags found
No related merge requests found
...@@ -74,27 +74,10 @@ void BeamFormer::initStationMergeMap( const std::vector<unsigned> &station2BeamF ...@@ -74,27 +74,10 @@ void BeamFormer::initStationMergeMap( const std::vector<unsigned> &station2BeamF
} }
} }
// functor for determining whether a station should be included based on
// its amount of flags
class stationValidator
{
public:
stationValidator( const SampleData<> *samples, const unsigned upperBound ):
samples(samples), upperBound(upperBound) {}
bool operator ()(unsigned stationNr) const
{
return samples->flags[stationNr].count() <= upperBound;
}
private:
const SampleData<> *samples;
const unsigned upperBound;
};
void BeamFormer::mergeStationFlags( const SampleData<> *in, SampleData<> *out ) void BeamFormer::mergeStationFlags( const SampleData<> *in, SampleData<> *out )
{ {
const unsigned upperBound = static_cast<unsigned>(itsNrSamplesPerIntegration * BeamFormer::MAX_FLAGGED_PERCENTAGE); const unsigned upperBound = static_cast<unsigned>(itsNrSamplesPerIntegration * BeamFormer::MAX_FLAGGED_PERCENTAGE);
const stationValidator isValid( in, upperBound );
for( unsigned d = 0; d < itsMergeDestStations.size(); d++ ) { for( unsigned d = 0; d < itsMergeDestStations.size(); d++ ) {
const unsigned destStation = itsMergeDestStations[d]; const unsigned destStation = itsMergeDestStations[d];
...@@ -103,12 +86,18 @@ void BeamFormer::mergeStationFlags( const SampleData<> *in, SampleData<> *out ) ...@@ -103,12 +86,18 @@ void BeamFormer::mergeStationFlags( const SampleData<> *in, SampleData<> *out )
validSourceStations.clear(); validSourceStations.clear();
// copy valid stations from sourceStations -> validSourceStations if (sourceStations.size() == 1) {
for( unsigned s = 0; s < sourceStations.size(); s++ ) { // source and dest are the same (no beamforming), so checking for
if( isValid( sourceStations[s] ) ) { // MAX_FLAGGED_PERCENTAGE is unnecessary conservative
validSourceStations.push_back( sourceStations[s] ); validSourceStations.push_back( sourceStations[0] );
} else {
// copy valid stations from sourceStations -> validSourceStations
for( unsigned s = 0; s < sourceStations.size(); s++ ) {
if( in->flags[sourceStations[s]].count() <= upperBound ) {
validSourceStations.push_back( sourceStations[s] );
}
} }
} }
// conservative flagging: flag output if any input was flagged // conservative flagging: flag output if any input was flagged
if( validSourceStations.empty() ) { if( validSourceStations.empty() ) {
...@@ -133,19 +122,18 @@ void BeamFormer::mergeStationFlags( const SampleData<> *in, SampleData<> *out ) ...@@ -133,19 +122,18 @@ void BeamFormer::mergeStationFlags( const SampleData<> *in, SampleData<> *out )
void BeamFormer::computeFlags( const SampleData<> *in, SampleData<> *out, unsigned nrBeams ) void BeamFormer::computeFlags( const SampleData<> *in, SampleData<> *out, unsigned nrBeams )
{ {
const unsigned upperBound = static_cast<unsigned>(itsNrSamplesPerIntegration * BeamFormer::MAX_FLAGGED_PERCENTAGE); const unsigned upperBound = static_cast<unsigned>(itsNrSamplesPerIntegration * BeamFormer::MAX_FLAGGED_PERCENTAGE);
const stationValidator isValid( in, upperBound );
// determine which stations have too much flagged data // determine which stations have too much flagged data
// also, source stations from a merge are set as invalid, since the ASM implementation // also, source stations from a merge are set as invalid, since the ASM implementation
// can only combine consecutive stations, we have to consider them. // can only combine consecutive stations, we have to consider them.
itsNrValidStations = 0; itsNrValidStations = 0;
for(unsigned i = 0; i < itsNrStations; i++ ) { for (unsigned i = 0; i < itsNrStations; i++) {
itsValidStations[i] = false; itsValidStations[i] = false;
} }
for(std::vector<unsigned>::const_iterator stat = itsMergeDestStations.begin(); stat != itsMergeDestStations.end(); stat++ ) { for (unsigned i = 0; i < itsMergeDestStations.size(); i++) {
if( isValid( *stat ) ) { if (in->flags[i].count() <= upperBound) {
itsValidStations[*stat] = true; itsValidStations[i] = true;
itsNrValidStations++; itsNrValidStations++;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment