44 x = -1 + 2 * rng.
draw();
45 y = -1 + 2 * rng.
draw();
49 }
while (r2 > 1.0 || r2 == 0);
52 return sigma * y *
sqrt(-2.0 * log(r2) / r2);
58 phi = 360.0 * rng.
draw() - 180.0;
68 cza = cos(prop_los[0] *
DEG2RAD);
69 sza = sin(prop_los[0] * DEG2RAD);
70 caa = cos(prop_los[1] * DEG2RAD);
71 saa = sin(prop_los[1] * DEG2RAD);
73 R_ant2enu(0, 0) = -cza * saa;
74 R_ant2enu(0, 1) = caa;
75 R_ant2enu(0, 2) = sza * saa;
77 R_ant2enu(1, 0) = -cza * caa;
78 R_ant2enu(1, 1) = -saa;
79 R_ant2enu(1, 2) = sza * caa;
81 R_ant2enu(2, 0) = sza;
82 R_ant2enu(2, 1) = 0.0;
83 R_ant2enu(2, 2) = cza;
87 const Index& stokes_dim,
94 const Numeric flip = f1_dir * f2_dir;
95 Numeric cos_pra1, sin_pra1, cos_pra2, sin_pra2;
98 sin_pra1 = f2_dir * (R_f1(
joker, 0) * R_f2(
joker, 1));
99 sin_pra2 = f1_dir * (R_f1(
joker, 1) * R_f2(
joker, 0));
100 cos_pra2 = f1_dir * f2_dir * (R_f1(
joker, 1) * R_f2(
joker, 1));
104 if (stokes_dim > 1) {
105 R_pra(1, 1) = 2 * cos_pra1 * cos_pra1 - 1.0;
106 if (stokes_dim > 2) {
107 R_pra(1, 2) = flip * 2 * cos_pra1 * sin_pra1;
108 R_pra(2, 1) = 2 * cos_pra2 * sin_pra2;
109 R_pra(2, 2) = flip * (2 * cos_pra2 * cos_pra2 - 1.0);
110 if (stokes_dim > 3) {
111 R_pra(3, 3) = flip * 1.0;
157 mult(k_vhk, R_enu2ant, R_return(
joker, 2));
162 ant_el = atan(k_vhk[0] / k_vhk[2]) *
RAD2DEG;
163 ant_az = atan(k_vhk[1] / k_vhk[2]) *
RAD2DEG;
166 z = term_el * term_el + term_az * term_az;
175 os <<
"invalid Antenna type.";
176 throw runtime_error(os.
str());
191 sampled_rte_los = bore_sight_los;
202 while (ant_el >= 90) {
205 while (ant_az >= 90) {
212 ant_r =
sqrt(1 + tel * tel + taz * taz);
213 k_vhk[0] = tel / ant_r;
214 k_vhk[1] = taz / ant_r;
215 k_vhk[2] = (
Numeric)1.0 / ant_r;
218 sampled_rte_los[0] = acos(R_los(2, 2)) *
RAD2DEG;
222 if (((
Numeric)1.0 -
abs(R_los(2, 2))) < DBL_EPSILON) {
225 sampled_rte_los[1] = bore_sight_los[1];
227 const Vector uhat{0.0, 0.0, 1.0};
229 sampled_rte_los[1] = atan2(R_los(0, 2), R_los(1, 2)) *
RAD2DEG;
232 R_los(
joker, 1) /= magh;
242 os <<
"invalid Antenna type.";
243 throw runtime_error(os.
str());
248 os <<
"MCAntenna: Output operator not implemented";
INDEX Index
The type to use for all integer numbers and indices.
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b)
cross3
void set_gaussian(const Numeric &za_sigma, const Numeric &aa_sigma)
set_gaussian.
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.
Workspace functions for the solution of cloud-box radiative transfer by Monte Carlo methods...
Numeric ran_gaussian(Rng &rng, const Numeric sigma)
ran_gaussian.
void set_lookup(ConstVectorView za_grid, ConstVectorView aa_grid, ConstMatrixView G_lookup)
set_lookup.
_CS_string_type str() const
ostream & operator<<(ostream &os, const MCAntenna &)
NUMERIC Numeric
The type to use for all floating point numbers.
void set_pencil_beam()
set_pencil_beam
void draw_los(VectorView sampled_rte_los, MatrixView R_los, Rng &rng, ConstMatrixView R_ant2enu, ConstVectorView bore_sight_los) const
draw_los.
An Antenna object used by MCGeneral.
void mult(ComplexVectorView y, const ConstComplexMatrixView &M, const ConstComplexVectorView &x)
Matrix-Vector Multiplication.
double draw()
Draws a double from the uniform distribution [0,1)
void return_los(Numeric &wgt, ConstMatrixView R_return, ConstMatrixView R_enu2ant) const
return_los
A constant view of a Vector.
AntennaType get_type() const
AntennaType get_type.
Numeric ran_uniform(Rng &rng)
ran_uniform.
A constant view of a Matrix.
void rotmat_enu(MatrixView R_ant2enu, ConstVectorView prop_los)
rotmat_enu.
void set_gaussian_fwhm(const Numeric &za_fwhm, const Numeric &aa_fwhm)
set_gaussian_fwhm.
Numeric sqrt(const Rational r)
Square root.