mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
moffat_test.cpp
Go to the documentation of this file.
1/** \file moffat_test.cpp
2 * \brief Tests Moffat profile functions.
3 */
4#include "../../../catch2/catch.hpp"
5
6#include <Eigen/Dense>
7
8#define MX_NO_ERROR_REPORTS
9
11
12/** compiling 1D Moffat function.
13 *
14 *
15 */
16/**
17 * \ingroup moffat_unit_tests
18 */
19TEST_CASE( "compiling 1D Moffat function", "[math::func::moffat]" )
20{
21 GIVEN( "the 1D Moffat function" )
22 {
23 WHEN( "compiling" )
24 {
25 double mv = mx::math::func::moffat<double>( 0., 0., 1., 0., 1., 1. );
26 REQUIRE_THAT( mv, Catch::Matchers::WithinAbs( 1.0, 1e-12 ) );
27 }
28 }
29}
30
31/** compiling 2D Moffat function.
32 *
33 *
34 */
35/**
36 * \ingroup moffat_unit_tests
37 */
38TEST_CASE( "compiling 2D Moffat function", "[math::func::moffat]" )
39{
40 GIVEN( "the 2D Moffat function" )
41 {
42 WHEN( "compiling" )
43 {
44 double mv = mx::math::func::moffat2D<double>( 0., 0., 0., 1., 0., 0., 1., 1. );
45 REQUIRE_THAT( mv, Catch::Matchers::WithinAbs( 1.0, 1e-12 ) );
46 }
47 }
48}
49
50/** compiling Moffat FWHM
51 *
52 *
53 */
54/**
55 * \ingroup moffat_unit_tests
56 */
57TEST_CASE( "compiling Moffat FWHM", "[math::func::moffat]" )
58{
59 GIVEN( "the Moffat FWHM" )
60 {
61 WHEN( "compiling" )
62 {
63 double mv = mx::math::func::moffatFWHM<double>( 1., 1. );
64 REQUIRE_THAT( mv, Catch::Matchers::WithinAbs( 2.0, 1e-12 ) );
65 }
66 }
67}
realT moffatFWHM(realT alpha, realT beta)
Compute the full-width at half-maximum of a Moffat profile.
Definition moffat.hpp:190
realT moffat(const realT x, const realT I0, const realT Ipk, const realT x0, const realT alpha, const realT beta)
Find value at position (x) of the 1D arbitrarily-centered symmetric unnormalized Moffat function.
Definition moffat.hpp:72
realT moffat2D(const realT x, const realT y, const realT I0, const realT Ipk, const realT x0, const realT y0, const realT alpha, const realT beta)
Find value at position (x,y) of the 2D arbitrarily-centered unnormalized symmetric Moffat function.
Definition moffat.hpp:125
TEST_CASE("compiling 1D Moffat function", "[math::func::moffat]")
Declarations for utilities related to the Moffat function.