DP3
Public Member Functions | Static Public Member Functions | List of all members
dp3::antennaflagger::Flagger Class Reference

#include <Flagger.h>

Public Member Functions

 Flagger (size_t n_stations, size_t n_antennas_per_station, size_t n_channels, size_t n_correlations)
 
void ComputeStats (const dp3::base::DPBuffer::DataType &data, common::BaselineOrder baseline_order)
 
xt::xtensor< int, 1 > FindBadAntennas (float sigma, int max_iterations)
 
xt::xtensor< int, 1 > FindBadStations (float sigma, int max_iterations)
 

Static Public Member Functions

static xt::xtensor< int, 2 > ComputeAntennaFlags (float sigma, int max_iterations, const xt::xtensor< std::complex< float >, 3 > &stats)
 
static xt::xtensor< int, 2 > ComputeStationFlags (float sigma, int max_iterations, const xt::xtensor< std::complex< float >, 3 > &stats)
 
static xt::xtensor< std::complex< float >, 2 > ComputeStatsStdDev (const dp3::base::DPBuffer::DataType &data)
 
static xt::xtensor< std::complex< float >, 2 > ComputeStatsSumSquare (const dp3::base::DPBuffer::DataType &data)
 
static xt::xtensor< std::complex< float >, 3 > GroupStats (size_t n_stations, size_t n_antennas_per_station, const xt::xtensor< std::complex< float >, 2 > &stats_baseline, common::BaselineOrder baseline_order)
 

Constructor & Destructor Documentation

◆ Flagger()

dp3::antennaflagger::Flagger::Flagger ( size_t  n_stations,
size_t  n_antennas_per_station,
size_t  n_channels,
size_t  n_correlations 
)
inline

Member Function Documentation

◆ ComputeAntennaFlags()

static xt::xtensor<int, 2> dp3::antennaflagger::Flagger::ComputeAntennaFlags ( float  sigma,
int  max_iterations,
const xt::xtensor< std::complex< float >, 3 > &  stats 
)
static

Per station, look at the statistics for all its antennas to find outliers. The input is assumed to be in the form (n_stations, n_antennas_per_station, n_correlations).

Returns
Flags as a tensor of integers in the form (n_stations, n_antennas_per_station). The flags are 'int' instead of 'bool' since XSimd otherwise converts booleans to integers and back.

◆ ComputeStationFlags()

static xt::xtensor<int, 2> dp3::antennaflagger::Flagger::ComputeStationFlags ( float  sigma,
int  max_iterations,
const xt::xtensor< std::complex< float >, 3 > &  stats 
)
static

Per correlation (XX in case of n_correlations == 1, XX and YY in case of n_correlations == 4), take the median of the statistics for all antennas in a station and compare these to find outliers. The input is assumed to be in the form (n_stations, n_antennas_per_station, n_correlations).

Returns
Flags as a tensor of booleans in the form (n_stations, 1 || 2). The booleans are 'int' instead of 'bool' since XSimd otherwise converts booleans to integers and back.

◆ ComputeStats()

void dp3::antennaflagger::Flagger::ComputeStats ( const dp3::base::DPBuffer::DataType data,
common::BaselineOrder  baseline_order 
)

This helper function computes statistics over the input visibility data. These statistics are used by FindBadAntennas and FindBadStations, which perform the actual flagging. Therefore, this function should always be called first.

Parameters
dataThree-dimensional input data of the form (baseline, channels, polarizations).
baseline_orderBaselines are assumed to be ordered according to this ordering. See common/baseline_indices.h for more details on the ordering.

◆ ComputeStatsStdDev()

static xt::xtensor<std::complex<float>, 2> dp3::antennaflagger::Flagger::ComputeStatsStdDev ( const dp3::base::DPBuffer::DataType data)
static

Compute standard deviation for the real and imaginary component seperately over the second axis of the input.

Returns
Statistics as a tensor of complex numbers.

◆ ComputeStatsSumSquare()

static xt::xtensor<std::complex<float>, 2> dp3::antennaflagger::Flagger::ComputeStatsSumSquare ( const dp3::base::DPBuffer::DataType data)
static

Compute sum of squares for the real and imaginary component seperately over the second axis of the input.

Returns
Statistics as a tensor of complex numbers.

◆ FindBadAntennas()

xt::xtensor<int, 1> dp3::antennaflagger::Flagger::FindBadAntennas ( float  sigma,
int  max_iterations 
)

Identify antennas that are outliers compared to the other antennas belonging to the same station. Note that this is only usefull for telescopes such as AARTFAAC where n_antennas_per_station > 1.

Returns
Flags as a tensor of booleans of length n_stations * n_antennas_per_station.

◆ FindBadStations()

xt::xtensor<int, 1> dp3::antennaflagger::Flagger::FindBadStations ( float  sigma,
int  max_iterations 
)

Identify stations that are outliers compared to the other stations. In case of n_antennas_per_station > 1, a per-station statistic over all antennas in a station is used.

Returns
Flags as a tensor of integers of length n_stations * n_antennas_per_station. The booleans are 'int' instead of 'bool' since XSimd otherwise converts booleans to integers and back.

◆ GroupStats()

static xt::xtensor<std::complex<float>, 3> dp3::antennaflagger::Flagger::GroupStats ( size_t  n_stations,
size_t  n_antennas_per_station,
const xt::xtensor< std::complex< float >, 2 > &  stats_baseline,
common::BaselineOrder  baseline_order 
)
static

Compute the per antenna statistics by combining the statistics of all baselines an antenna contributed to. The input is in the form (n_stations, n_antennas_per_station, n_correlations),

Returns
Statistics in the form (n_stations, n_antennas_per_station, n_correlations).

The documentation for this class was generated from the following file: