-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrawls.cpp
More file actions
46 lines (40 loc) · 1.53 KB
/
Copy pathrawls.cpp
File metadata and controls
46 lines (40 loc) · 1.53 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
#include <fmt/core.h>
#include <iostream>
#include "raw_file_group.h"
#include "util.h"
using namespace std;
/*
Displays information about a directory full of raw files.
Usage:
rawls <directory>
*/
int main(int argc, char* argv[]) {
if (argc != 2) {
cerr << "usage: rawls <directory>\n";
exit(1);
}
string dir(argv[1]);
auto file_lists = scanForRawFileGroups(dir);
cout << dir << " has " << pluralize(file_lists.size(), "raw file group") << ":\n";
for (auto& file_list : file_lists) {
RawFileGroup group(file_list);
group.resetBand(0, 1);
cout << endl;
cout << pluralize(group.filenames.size(), "file") << " match " << group.prefix
<< ".*.raw\n";
cout << pluralize(group.nants, "antenna") << endl;
cout << fmt::format("{:.1f} MHz bandwidth\n", group.obsbw);
cout << fmt::format("{:.1f} MHz center frequency\n", group.obsfreq);
cout << fmt::format("start time: {:.8f} MJD / {:.7f} unix\n",
unixTimeToMJD(group.getStartTime(0)),
group.getStartTime(0));
cout << pluralize(group.num_coarse_channels, "coarse channel") << endl;
cout << pluralize(group.timesteps_per_block, "timestep") << " per block\n";
cout << (group.oneBlockDataSize() / 1024 / 1024) << " MB block size\n";
cout << "schan: " << group.schan << endl;
cout << "obsid: " << group.obsid << endl;
cout << pluralize(group.num_blocks, "total block") << endl;
cout << fmt::format("{:.1f} GB total data\n", group.totalDataGB());
cout << fmt::format("{:.1f}s total time\n", group.totalTime());
}
}