Loading...
Searching...
No Matches
dyscodatacolumn.h
Go to the documentation of this file.
#ifndef DYSCO_DATA_COLUMN_H
#define DYSCO_DATA_COLUMN_H
#include "threadeddyscocolumn.h"
#include "stochasticencoder.h"
#include "timeblockencoder.h"
namespace dyscostman {
class DyscoStMan;
class DyscoDataColumn final : public ThreadedDyscoColumn<std::complex<float>> {
public:
DyscoDataColumn(DyscoStMan *parent, int dtype)
: ThreadedDyscoColumn(parent, dtype),
_rnd(std::random_device{}()),
_gausEncoder(),
_distribution(GaussianDistribution),
_normalization(Normalization::kRF),
_randomize(true) {}
DyscoDataColumn(const DyscoDataColumn &source) = delete;
void operator=(const DyscoDataColumn &source) = delete;
virtual ~DyscoDataColumn() { shutdown(); }
virtual void Prepare(DyscoDistribution distribution,
Normalization normalization, double studentsTNu,
double distributionTruncation) override;
void SetStaticRandomizationSeed() {
std::cout
<< "Warning: Initializing random number generator with static seed!\n";
_rnd = std::mt19937();
_randomize = false;
}
protected:
virtual void initializeDecode(TimeBlockBuffer<data_t> *buffer,
const float *metaBuffer, size_t nRow,
size_t nAntennae) override;
virtual void decode(TimeBlockBuffer<data_t> *buffer, const symbol_t *data,
size_t blockRow, size_t a1, size_t a2) override;
virtual std::unique_ptr<ThreadDataBase> initializeEncodeThread() override;
virtual void encode(ThreadDataBase *threadData,
TimeBlockBuffer<data_t> *buffer, float *metaBuffer,
symbol_t *symbolBuffer, size_t nAntennae) override;
virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations,
size_t nChannels,
size_t nAntennae) const override;
virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations,
size_t nChannels) const override;
virtual size_t defaultThreadCount() const override;
private:
struct ThreadData final : public ThreadDataBase {
ThreadData(std::unique_ptr<TimeBlockEncoder> timeBlockEncoder)
: encoder(std::move(timeBlockEncoder)) {}
std::unique_ptr<TimeBlockEncoder> encoder;
std::mt19937 rnd;
};
std::mt19937 _rnd;
std::unique_ptr<StochasticEncoder<float>> _gausEncoder;
std::unique_ptr<TimeBlockEncoder> _decoder;
DyscoDistribution _distribution;
Normalization _normalization;
double _studentsTNu;
bool _randomize;
};
} // namespace dyscostman
#endif
TimeBlockBuffer
Definition timeblockbuffer.h:10
casacore::StManColumnBase::dtype
DataType dtype() const
Definition StManColumnBase.h:90
dyscostman::DyscoDataColumn::_rnd
std::mt19937 _rnd
Definition dyscodatacolumn.h:81
dyscostman::DyscoDataColumn::decode
virtual void decode(TimeBlockBuffer< data_t > *buffer, const symbol_t *data, size_t blockRow, size_t a1, size_t a2) override
dyscostman::DyscoDataColumn::DyscoDataColumn
DyscoDataColumn(const DyscoDataColumn &source)=delete
dyscostman::DyscoDataColumn::initializeDecode
virtual void initializeDecode(TimeBlockBuffer< data_t > *buffer, const float *metaBuffer, size_t nRow, size_t nAntennae) override
dyscostman::DyscoDataColumn::DyscoDataColumn
DyscoDataColumn(DyscoStMan *parent, int dtype)
Create a new column.
Definition dyscodatacolumn.h:24
dyscostman::DyscoDataColumn::_studentsTNu
double _studentsTNu
Definition dyscodatacolumn.h:86
dyscostman::DyscoDataColumn::encode
virtual void encode(ThreadDataBase *threadData, TimeBlockBuffer< data_t > *buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t nAntennae) override
dyscostman::DyscoDataColumn::symbolCount
virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations, size_t nChannels) const override
dyscostman::DyscoDataColumn::SetStaticRandomizationSeed
void SetStaticRandomizationSeed()
Definition dyscodatacolumn.h:43
dyscostman::DyscoDataColumn::operator=
void operator=(const DyscoDataColumn &source)=delete
dyscostman::DyscoDataColumn::defaultThreadCount
virtual size_t defaultThreadCount() const override
dyscostman::DyscoDataColumn::metaDataFloatCount
virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations, size_t nChannels, size_t nAntennae) const override
dyscostman::DyscoDataColumn::~DyscoDataColumn
virtual ~DyscoDataColumn()
Destructor.
Definition dyscodatacolumn.h:37
dyscostman::DyscoDataColumn::_normalization
Normalization _normalization
Definition dyscodatacolumn.h:85
dyscostman::DyscoDataColumn::_randomize
bool _randomize
Definition dyscodatacolumn.h:87
dyscostman::DyscoDataColumn::_decoder
std::unique_ptr< TimeBlockEncoder > _decoder
Definition dyscodatacolumn.h:83
dyscostman::DyscoDataColumn::initializeEncodeThread
virtual std::unique_ptr< ThreadDataBase > initializeEncodeThread() override
dyscostman::DyscoDataColumn::_distribution
DyscoDistribution _distribution
Definition dyscodatacolumn.h:84
dyscostman::DyscoDataColumn::_gausEncoder
std::unique_ptr< StochasticEncoder< float > > _gausEncoder
Definition dyscodatacolumn.h:82
dyscostman::DyscoDataColumn::Prepare
virtual void Prepare(DyscoDistribution distribution, Normalization normalization, double studentsTNu, double distributionTruncation) override
dyscostman::DyscoStManColumn::nAntennae
size_t nAntennae() const
Definition dyscostmancol.h:150
dyscostman::DyscoStManColumn::nRowsInBlock
size_t nRowsInBlock() const
Definition dyscostmancol.h:146
dyscostman::DyscoStMan
The main class for the Dysco storage manager.
Definition dyscostman.h:46
dyscostman::ThreadedDyscoColumn< std::complex< float > >::symbol_t
TimeBlockBuffer< data_t >::symbol_t symbol_t
Definition threadeddyscocolumn.h:115
dyscostman::ThreadedDyscoColumn< std::complex< float > >::ThreadedDyscoColumn
ThreadedDyscoColumn(DyscoStMan *parent, int dtype)
dyscostman::ThreadedDyscoColumn< std::complex< float > >::shutdown
virtual void shutdown() override final
dyscostman
Definition bytepacker.h:7
dyscostman::Normalization
Normalization
Definition dysconormalization.h:5
dyscostman::Normalization::kRF
@ kRF
Definition dysconormalization.h:5
dyscostman::DyscoDistribution
DyscoDistribution
Definition dyscodistribution.h:5
dyscostman::GaussianDistribution
@ GaussianDistribution
Definition dyscodistribution.h:6
std
Define real & complex conjugation for non-complex types and put comparisons into std namespace.
Definition Complex.h:350
stochasticencoder.h
dyscostman::DyscoDataColumn::ThreadData::rnd
std::mt19937 rnd
Definition dyscodatacolumn.h:78
dyscostman::DyscoDataColumn::ThreadData::ThreadData
ThreadData(std::unique_ptr< TimeBlockEncoder > timeBlockEncoder)
Definition dyscodatacolumn.h:75
dyscostman::DyscoDataColumn::ThreadData::encoder
std::unique_ptr< TimeBlockEncoder > encoder
Definition dyscodatacolumn.h:77
threadeddyscocolumn.h
timeblockencoder.h