-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflagwriter.h
More file actions
105 lines (84 loc) · 2.75 KB
/
Copy pathflagwriter.h
File metadata and controls
105 lines (84 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef FLAG_WRITER_H
#define FLAG_WRITER_H
#include "writer.h"
#include "fitsuser.h"
#include <stdint.h>
#include <iostream>
#include <fitsio.h>
class FlagWriter : public Writer, private FitsUser
{
public:
FlagWriter(const std::string &filename, int gpsTime, size_t timestepCount, size_t sbStart, size_t sbEnd, const std::vector<size_t>& subbandToGPUBoxFileIndex);
~FlagWriter();
void WriteBandInfo(const std::string &name, const std::vector<Writer::ChannelInfo> &channels, double refFreq, double totalBandwidth, bool flagRow) override final
{
_channelCount = channels.size();
setStride();
}
void WriteAntennae(const std::vector<Writer::AntennaInfo> &antennae, double time) override final
{
_antennaCount = antennae.size();
setStride();
}
void WritePolarizationForLinearPols(bool flagRow) override final
{
_polarizationCount = 4;
setStride();
}
void WriteSource(const Writer::SourceInfo &source) override final
{
}
void WriteField(const Writer::FieldInfo& field) override final
{
}
void WriteObservation(const ObservationInfo& observation) override final
{
}
void AddRows(size_t rowCount)
{
if(_rowsAdded == 0)
writeHeader();
_rowsAdded += rowCount;
}
void WriteRow(double time, double timeCentroid, size_t antenna1, size_t antenna2, double u, double v, double w, double interval, const std::complex<float>* data, const bool* flags, const float *weights)
{
writeRow(antenna1, antenna2, flags);
}
void WriteHistoryItem(const std::string &commandLine, const std::string &application, const std::vector<std::string> ¶ms)
{
}
bool IsTimeAligned(size_t antenna1, size_t antenna2)
{
return true;
}
virtual void SetOffsetsPerGPUBox(const std::vector<int>& offsets);
private:
void writeHeader();
void writeRow(size_t antenna1, size_t antenna2, const bool* flags);
void setStride();
struct Header
{
char fileIdentifier[4];
uint16_t versionMinor, versionMajor;
uint32_t timestepCount, antennaCount, channelCount, polarizationCount, gpuBoxIndex;
uint64_t gpsTime;
char baselineSelection;
};
void updateIntKey(size_t i, const char* keywordName, int value)
{
int status = 0;
fits_update_key(_files[i], TINT, keywordName, &value, NULL, &status);
checkStatus(status);
}
size_t _timestepCount, _antennaCount, _channelCount, _channelsPerGPUBox, _polarizationCount;
//size_t _rowStride;
size_t _rowsAdded, _rowsWritten, _sbStart, _sbEnd;
int _gpsTime;
std::vector<fitsfile*> _files;
const static uint16_t VERSION_MINOR, VERSION_MAJOR;
std::vector<size_t> _subbandToGPUBoxFileIndex;
std::vector<unsigned char> _singlePolBuffer;
std::vector<int> _hduOffsets;
//std::vector<unsigned char> _packBuffer;
};
#endif