mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
signalWindows_test.cpp
1/** \file psdFilter_test.cpp
2 */
3#include "../../catch2/catch.hpp"
4
5#include <vector>
6#include <Eigen/Dense>
7
8#define MX_NO_ERROR_REPORTS
9
10#include "../../../include/sigproc/signalWindows.hpp"
11#include "../../../include/improc/eigenImage.hpp"
12
13/** Scenario: creating 2D Rectangular Tukey Windows
14 *
15 * Verify creation of a 2D rectangular Tukey window
16 *
17 * \anchor tests_sigproc_signalWindows_Tukey2DSquare
18 */
19SCENARIO( "creating 2D Rectangular Tukey Windows", "[sigproc::signalWindows::tukey2dSquare]" )
20{
21 GIVEN( "a centered square array" )
22 {
23 WHEN( "256x256, alpha=0" )
24 {
25
27 win.resize( 256, 256 );
28
29 mx::sigproc::window::tukey2dSquare<float>( win.data(),
30 win.rows(),
31 win.cols(),
32 256,
33 256,
34 0.0,
35 0.5 * ( win.rows() - 1.0 ),
36 0.5 * ( win.cols() - 1.0 ) );
37
38 REQUIRE( win.sum() == 256 * 256 );
39 }
40
41 WHEN( "256x256, alpha=1" )
42 {
43
45 win.resize( 256, 256 );
46
47 mx::sigproc::window::tukey2dSquare<float>( win.data(),
48 win.rows(),
49 win.cols(),
50 256,
51 256,
52 1.0,
53 0.5 * ( win.rows() - 1.0 ),
54 0.5 * ( win.cols() - 1.0 ) );
55
56 std::vector<float> win1( 256 );
57 mx::sigproc::window::tukey<float>( win1, 1.0 );
58
59 REQUIRE_THAT( win( 0, 0 ), Catch::Matchers::WithinAbs( win1[0] * win1[0], 1e-6 ) );
60 REQUIRE_THAT( win( 10, 15 ), Catch::Matchers::WithinAbs( win1[10] * win1[15], 1e-6 ) );
61 }
62 WHEN( "256x256, alpha=0.5" )
63 {
64
66 win.resize( 256, 256 );
67
68 mx::sigproc::window::tukey2dSquare<float>( win.data(),
69 win.rows(),
70 win.cols(),
71 256,
72 256,
73 0.5,
74 0.5 * ( win.rows() - 1.0 ),
75 0.5 * ( win.cols() - 1.0 ) );
76
77 std::vector<float> win1( 256 );
78 mx::sigproc::window::tukey<float>( win1, 0.5 );
79
80 REQUIRE_THAT( win( 0, 0 ), Catch::Matchers::WithinAbs( win1[0] * win1[0], 1e-6 ) );
81 REQUIRE_THAT( win( 10, 15 ), Catch::Matchers::WithinAbs( win1[10] * win1[15], 1e-6 ) );
82 }
83 }
84}
SCENARIO("Loading aoAtmosphere config settings", "[ao::analysis::aoAtmosphere]")
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.