19#include "matpack_math.h"
26void rotmat_enu(MatrixView R_ant2enu, ConstVectorView prop_los)
29 Numeric cza, sza, caa, saa;
31 cza = cos(prop_los[0] *
DEG2RAD);
32 sza = sin(prop_los[0] *
DEG2RAD);
33 caa = cos(prop_los[1] *
DEG2RAD);
34 saa = sin(prop_los[1] *
DEG2RAD);
36 R_ant2enu(0, 0) = -cza * saa;
37 R_ant2enu(0, 1) = caa;
38 R_ant2enu(0, 2) = sza * saa;
40 R_ant2enu(1, 0) = -cza * caa;
41 R_ant2enu(1, 1) = -saa;
42 R_ant2enu(1, 2) = sza * caa;
44 R_ant2enu(2, 0) = sza;
45 R_ant2enu(2, 1) = 0.0;
46 R_ant2enu(2, 2) = cza;
50 const Index& stokes_dim,
51 const Numeric& f1_dir,
52 const Numeric& f2_dir,
57 const Numeric flip = f1_dir * f2_dir;
58 Numeric cos_pra1, sin_pra1, cos_pra2, sin_pra2;
60 cos_pra1 = R_f1(joker, 0) * R_f2(joker, 0);
61 sin_pra1 = f2_dir * (R_f1(joker, 0) * R_f2(joker, 1));
62 sin_pra2 = f1_dir * (R_f1(joker, 1) * R_f2(joker, 0));
63 cos_pra2 = f1_dir * f2_dir * (R_f1(joker, 1) * R_f2(joker, 1));
68 R_pra(1, 1) = 2 * cos_pra1 * cos_pra1 - 1.0;
70 R_pra(1, 2) = flip * 2 * cos_pra1 * sin_pra1;
71 R_pra(2, 1) = 2 * cos_pra2 * sin_pra2;
72 R_pra(2, 2) = flip * (2 * cos_pra2 * cos_pra2 - 1.0);
74 R_pra(3, 3) = flip * 1.0;
89 const Numeric& aa_fwhm) {
96 ConstVectorView aa_grid_,
97 ConstMatrixView G_lookup_) {
105 ConstMatrixView R_return,
106 ConstMatrixView R_enu2ant)
const {
107 Numeric z, term_el, term_az;
108 Numeric ant_el, ant_az;
118 mult(k_vhk, R_enu2ant, R_return(joker, 2));
123 ant_el = atan(k_vhk[0] / k_vhk[2]) *
RAD2DEG;
124 ant_az = atan(k_vhk[1] / k_vhk[2]) *
RAD2DEG;
127 z = term_el * term_el + term_az * term_az;
142 ConstMatrixView R_ant2enu,
143 ConstVectorView bore_sight_los)
const {
144 Numeric ant_el, ant_az, ant_r;
150 sampled_rte_los = bore_sight_los;
162 auto za_sample = rng.
get<std::normal_distribution>(0.0,
sigma_za);
163 while (ant_el >= 90) {
164 ant_el = za_sample();
166 auto aa_sample = rng.
get<std::normal_distribution>(0.0,
sigma_aa);
167 while (ant_az >= 90) {
168 ant_az = aa_sample();
175 ant_r = sqrt(1 + tel * tel + taz * taz);
176 k_vhk[0] = tel / ant_r;
177 k_vhk[1] = taz / ant_r;
178 k_vhk[2] = (Numeric)1.0 / ant_r;
179 mult(R_los(joker, 2), R_ant2enu, k_vhk);
181 sampled_rte_los[0] = acos(R_los(2, 2)) *
RAD2DEG;
185 if (((Numeric)1.0 - abs(R_los(2, 2))) < DBL_EPSILON) {
187 R_los(joker, 1) = R_ant2enu(1, joker);
188 sampled_rte_los[1] = bore_sight_los[1];
190 const Vector uhat{0.0, 0.0, 1.0};
192 sampled_rte_los[1] = atan2(R_los(0, 2), R_los(1, 2)) *
RAD2DEG;
193 cross3(R_los(joker, 1), R_los(joker, 2), uhat);
194 magh = sqrt(R_los(joker, 1) * R_los(joker, 1));
195 R_los(joker, 1) /= magh;
199 cross3(R_los(joker, 0), R_los(joker, 1), R_los(joker, 2));
209 os <<
"MCAntenna: Output operator not implemented";
Constants of physical expressions as constexpr.
A C++ standards dependent random number generator class.
auto get(Ts &&...x) const
Returns a random number generator of some random distribution.
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_USER_ERROR(...)
constexpr Numeric DEG2RAD
constexpr Numeric RAD2DEG
constexpr Numeric DEG2RAD
constexpr Numeric RAD2DEG
void rotmat_stokes(MatrixView R_pra, const Index &stokes_dim, const Numeric &f1_dir, const Numeric &f2_dir, ConstMatrixView R_f1, ConstMatrixView R_f2)
rotmat_stokes.
ostream & operator<<(ostream &os, const MCAntenna &)
void rotmat_enu(MatrixView R_ant2enu, ConstVectorView prop_los)
rotmat_enu.
Workspace functions for the solution of cloud-box radiative transfer by Monte Carlo methods....
@ ANTENNA_TYPE_PENCIL_BEAM
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr auto deg2rad(auto x) noexcept
Converts degrees to radians.
constexpr auto rad2deg(auto x) noexcept
Converts radians to degrees.
An Antenna object used by MCGeneral.
void return_los(Numeric &wgt, ConstMatrixView R_return, ConstMatrixView R_enu2ant) const
return_los
void set_lookup(ConstVectorView za_grid, ConstVectorView aa_grid, ConstMatrixView G_lookup)
set_lookup.
void draw_los(VectorView sampled_rte_los, MatrixView R_los, RandomNumberGenerator<> &rng, ConstMatrixView R_ant2enu, ConstVectorView bore_sight_los) const
draw_los.
void set_gaussian(const Numeric &za_sigma, const Numeric &aa_sigma)
set_gaussian.
void set_gaussian_fwhm(const Numeric &za_fwhm, const Numeric &aa_fwhm)
set_gaussian_fwhm.
void set_pencil_beam()
set_pencil_beam