-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdedoppler_test.cpp
More file actions
34 lines (29 loc) · 1011 Bytes
/
Copy pathdedoppler_test.cpp
File metadata and controls
34 lines (29 loc) · 1011 Bytes
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
#include "catch/catch.hpp"
#include <iostream>
#include <vector>
#include "dedoppler.h"
#include "filterbank_buffer.h"
#include "filterbank_metadata.h"
TEST_CASE("basic functionality", "[dedoppler]") {
int num_timesteps = 8;
int num_channels = 1000;
FilterbankBuffer buffer(makeNoisyBuffer(num_timesteps, num_channels));
FilterbankMetadata metadata = FilterbankMetadata();
// Draw a line drifting a few timesteps to the right
buffer.set(0, 70, 1.0);
buffer.set(1, 70, 1.0);
buffer.set(2, 71, 1.0);
buffer.set(3, 71, 1.0);
buffer.set(4, 72, 1.0);
buffer.set(5, 72, 1.0);
buffer.set(6, 73, 1.0);
buffer.set(7, 73, 1.0);
Dedopplerer dedopplerer(num_timesteps, num_channels, 1.0, 1.0, false);
vector<DedopplerHit> hits;
dedopplerer.search(buffer, metadata, NO_BEAM, 555, 0.01, 0.01, 200.0, &hits);
REQUIRE(hits.size() == 1);
REQUIRE(hits[0].index == 70);
REQUIRE(hits[0].drift_steps == 3);
REQUIRE(hits[0].beam == NO_BEAM);
REQUIRE(hits[0].coarse_channel == 555);
}