casacore
dyscodatacolumn.h
Go to the documentation of this file.
1 #ifndef DYSCO_DATA_COLUMN_H
2 #define DYSCO_DATA_COLUMN_H
3 
4 #include "threadeddyscocolumn.h"
5 
6 #include "stochasticencoder.h"
7 #include "timeblockencoder.h"
8 
9 namespace dyscostman {
10 
11 class DyscoStMan;
12 
18 class DyscoDataColumn final : public ThreadedDyscoColumn<std::complex<float>> {
19  public:
25  : ThreadedDyscoColumn(parent, dtype),
26  _rnd(std::random_device{}()),
27  _gausEncoder(),
30  _randomize(true) {}
31 
32  DyscoDataColumn(const DyscoDataColumn &source) = delete;
33 
34  void operator=(const DyscoDataColumn &source) = delete;
35 
37  virtual ~DyscoDataColumn() { shutdown(); }
38 
39  virtual void Prepare(DyscoDistribution distribution,
40  Normalization normalization, double studentsTNu,
41  double distributionTruncation) override;
42 
44  std::cout
45  << "Warning: Initializing random number generator with static seed!\n";
46  _rnd = std::mt19937();
47  _randomize = false;
48  }
49 
50  protected:
52  const float *metaBuffer, size_t nRow,
53  size_t nAntennae) override;
54 
55  virtual void decode(TimeBlockBuffer<data_t> *buffer, const symbol_t *data,
56  size_t blockRow, size_t a1, size_t a2) override;
57 
58  virtual std::unique_ptr<ThreadDataBase> initializeEncodeThread() override;
59 
60  virtual void encode(ThreadDataBase *threadData,
61  TimeBlockBuffer<data_t> *buffer, float *metaBuffer,
62  symbol_t *symbolBuffer, size_t nAntennae) override;
63 
64  virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations,
65  size_t nChannels,
66  size_t nAntennae) const override;
67 
68  virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations,
69  size_t nChannels) const override;
70 
71  virtual size_t defaultThreadCount() const override;
72 
73  private:
74  struct ThreadData final : public ThreadDataBase {
75  ThreadData(std::unique_ptr<TimeBlockEncoder> timeBlockEncoder)
76  : encoder(std::move(timeBlockEncoder)) {}
77  std::unique_ptr<TimeBlockEncoder> encoder;
78  std::mt19937 rnd;
79  };
80 
81  std::mt19937 _rnd;
82  std::unique_ptr<StochasticEncoder<float>> _gausEncoder;
83  std::unique_ptr<TimeBlockEncoder> _decoder;
86  double _studentsTNu;
87  bool _randomize;
88 };
89 
90 } // namespace dyscostman
91 
92 #endif
A column for storing compressed complex values with an approximate Gaussian distribution.
virtual void decode(TimeBlockBuffer< data_t > *buffer, const symbol_t *data, size_t blockRow, size_t a1, size_t a2) override
DyscoDataColumn(const DyscoDataColumn &source)=delete
virtual void initializeDecode(TimeBlockBuffer< data_t > *buffer, const float *metaBuffer, size_t nRow, size_t nAntennae) override
DyscoDataColumn(DyscoStMan *parent, int dtype)
Create a new column.
virtual void encode(ThreadDataBase *threadData, TimeBlockBuffer< data_t > *buffer, float *metaBuffer, symbol_t *symbolBuffer, size_t nAntennae) override
virtual size_t symbolCount(size_t nRowsInBlock, size_t nPolarizations, size_t nChannels) const override
void operator=(const DyscoDataColumn &source)=delete
virtual size_t defaultThreadCount() const override
virtual size_t metaDataFloatCount(size_t nRow, size_t nPolarizations, size_t nChannels, size_t nAntennae) const override
virtual ~DyscoDataColumn()
Destructor.
std::unique_ptr< TimeBlockEncoder > _decoder
DyscoDistribution _distribution
std::unique_ptr< StochasticEncoder< float > > _gausEncoder
virtual void Prepare(DyscoDistribution distribution, Normalization normalization, double studentsTNu, double distributionTruncation) override
virtual std::unique_ptr< ThreadDataBase > initializeEncodeThread() override
The main class for the Dysco storage manager.
Definition: dyscostman.h:46
A column for storing compressed values in a threaded way, tailored for the data and weight columns th...
Define real & complex conjugation for non-complex types and put comparisons into std namespace.
Definition: Complex.h:352
ThreadData(std::unique_ptr< TimeBlockEncoder > timeBlockEncoder)
std::unique_ptr< TimeBlockEncoder > encoder