PURIFY
Next-generation radio interferometric imaging
Functions
purify_fitsio.cc File Reference
#include "catch2/catch_all.hpp"
#include "purify/config.h"
#include "purify/types.h"
#include "purify/logging.h"
#include "purify/directories.h"
#include "purify/pfitsio.h"
+ Include dependency graph for purify_fitsio.cc:

Go to the source code of this file.

Functions

 TEST_CASE ("header")
 

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "header"  )

Definition at line 90 of file purify_fitsio.cc.

90  {
91  const std::string fits_name = "test_image.fits";
92  const t_real mean_frequency = 123; // in MHz
93  const t_real cell_x = 5; // in arcseconds
94  const t_real cell_y = 2; // in arcseconds
95  const t_real ra = 12; // in radians, converted to decimal degrees before write
96  const t_real dec = 98; // in radians, converted to decimal degrees before write
97  const std::string pix_units = "Jy/PIXEL";
98  const t_real channels_total = 2;
99  const t_real channel_width = 11; // in MHz
100  const t_real polarisation = stokes_int.at(stokes::I);
101  const int niters = 10; // number of iterations
102  const bool hasconverged = true; // stating if model has converged
103  const t_real relative_variation = 1e-3;
104  const t_real residual_convergence = 1e-4;
105  const t_real epsilon = 10;
106  pfitsio::header_params header;
107  header.fits_name = fits_name;
108  header.mean_frequency = mean_frequency;
109  header.cell_x = cell_x;
110  header.cell_y = cell_y;
111  header.ra = ra;
112  header.dec = dec;
113  header.pix_units = pix_units;
114  header.channels_total = channels_total;
115  header.channel_width = channel_width;
116  header.polarisation = polarisation;
117  header.niters = niters;
118  header.hasconverged = hasconverged;
119  header.relative_variation = relative_variation;
120  header.residual_convergence = residual_convergence;
121  header.epsilon = epsilon;
122  const auto header_test = pfitsio::header_params(
123  fits_name, pix_units, channels_total, ra, dec, stokes::I, cell_x, cell_y, mean_frequency,
124  channel_width, niters, hasconverged, relative_variation, residual_convergence, epsilon);
125  CHECK(header_test == header);
126  CHECK(header_test == pfitsio::header_params(fits_name, pix_units, channels_total, ra, dec,
127  stokes_string.at("p"), cell_x, cell_y, mean_frequency,
128  channel_width, niters, hasconverged,
129  relative_variation, residual_convergence, epsilon));
130  CHECK_THROWS(header_test == pfitsio::header_params(fits_name, pix_units, channels_total, ra, dec,
131  stokes_string.at("z"), cell_x, cell_y,
132  mean_frequency, channel_width, niters,
133  hasconverged, relative_variation,
134  residual_convergence, epsilon));
135  CHECK(header_test != pfitsio::header_params(fits_name, pix_units, channels_total, ra, dec,
136  stokes::Q, cell_x, cell_y, mean_frequency,
137  channel_width, niters, hasconverged,
138  relative_variation, residual_convergence, epsilon));
139 }
#define CHECK(CONDITION, ERROR)
Definition: casa.cc:6
#define CHECK_THROWS(STATEMENT, ERROR)
Definition: casa.cc:8
const std::map< stokes, t_int > stokes_int
Definition: types.h:45
const std::map< std::string, stokes > stokes_string
Definition: types.h:49

References purify::pfitsio::header_params::cell_x, purify::pfitsio::header_params::cell_y, purify::pfitsio::header_params::channel_width, purify::pfitsio::header_params::channels_total, CHECK, CHECK_THROWS, purify::pfitsio::header_params::dec, purify::pfitsio::header_params::epsilon, purify::pfitsio::header_params::fits_name, purify::pfitsio::header_params::hasconverged, purify::I, purify::pfitsio::header_params::mean_frequency, purify::pfitsio::header_params::niters, purify::pfitsio::header_params::pix_units, purify::pfitsio::header_params::polarisation, purify::Q, purify::pfitsio::header_params::ra, purify::pfitsio::header_params::relative_variation, purify::pfitsio::header_params::residual_convergence, purify::stokes_int, and purify::stokes_string.