ARTS
2.4.0(git:4fb77825)
|
Sensor modelling functions. More...
#include "arts.h"
#include "gridded_fields.h"
#include "interpolation.h"
#include "math_funcs.h"
#include "matpackI.h"
#include "matpackII.h"
#include "messages.h"
Go to the source code of this file.
Functions | |
void | antenna1d_matrix (Sparse &H, const Index &antenna_dim, ConstVectorView antenna_dza, const GriddedField4 &antenna_response, ConstVectorView za_grid, ConstVectorView f_grid, const Index n_pol, const Index do_norm) |
antenna1d_matrix More... | |
void | antenna2d_gridded_dlos (Sparse &H, const Index &antenna_dim, ConstMatrixView antenna_dlos, const GriddedField4 &antenna_response, ConstMatrixView mblock_dlos, ConstVectorView f_grid, const Index n_pol) |
antenna2d_interp_gridded_dlos More... | |
void | antenna2d_interp_response (Sparse &H, const Index &antenna_dim, ConstMatrixView antenna_dlos, const GriddedField4 &antenna_response, ConstMatrixView mblock_dlos, ConstVectorView f_grid, const Index n_pol) |
antenna2d_interp_response More... | |
void | gaussian_response_autogrid (Vector &x, Vector &y, const Numeric &x0, const Numeric &fwhm, const Numeric &xwidth_si, const Numeric &dx_si) |
gaussian_response_autogrid More... | |
void | gaussian_response (Vector &y, const Vector &x, const Numeric &x0, const Numeric &fwhm) |
gaussian_response More... | |
void | mixer_matrix (Sparse &H, Vector &f_mixer, const Numeric &lo, const GriddedField1 &filter, ConstVectorView f_grid, const Index &n_pol, const Index &n_sp, const Index &do_norm) |
mixer_matrix More... | |
void | mueller_rotation (Sparse &H, const Index &stokes_dim, const Numeric &rotangle) |
mueller_rotation More... | |
void | met_mm_polarisation_hmatrix (Sparse &H, const ArrayOfString &pol, const Numeric dza, const Index stokes_dim, const String &iy_unit) |
Calculate polarisation H-matrix. More... | |
void | sensor_aux_vectors (Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Matrix &sensor_response_dlos, ConstVectorView sensor_response_f_grid, const ArrayOfIndex &sensor_response_pol_grid, ConstMatrixView sensor_response_dlos_grid) |
sensor_aux_vectors More... | |
void | spectrometer_matrix (Sparse &H, ConstVectorView ch_f, const ArrayOfGriddedField1 &ch_response, ConstVectorView sensor_f, const Index &n_pol, const Index &n_sp, const Index &do_norm) |
spectrometer_matrix More... | |
void | stokes2pol (VectorView w, const Index &stokes_dim, const Index &ipol_1based, const Numeric nv=1) |
stokes2pol More... | |
void | find_effective_channel_boundaries (Vector &fmin, Vector &fmax, const Vector &f_backend, const ArrayOfGriddedField1 &backend_channel_response, const Numeric &delta, const Verbosity &verbosity) |
Calculate channel boundaries from instrument response functions. More... | |
void | integration_func_by_vecmult (VectorView h, ConstVectorView f, ConstVectorView x_f_in, ConstVectorView x_g_in) |
integration_func_by_vecmult More... | |
void | integration_bin_by_vecmult (VectorView h, ConstVectorView x_g_in, const Numeric &limit1, const Numeric &limit2) |
integration_bin_by_vecmult More... | |
void | summation_by_vecmult (VectorView h, ConstVectorView f, ConstVectorView x_f, ConstVectorView x_g, const Numeric x1, const Numeric x2) |
summation_by_vecmult More... | |
Sensor modelling functions.
This file contains the definition of the functions in sensor.cc that are of interest elsewhere.
Definition in file sensor.h.
void antenna1d_matrix | ( | Sparse & | H, |
const Index & | antenna_dim, | ||
ConstVectorView | antenna_dza, | ||
const GriddedField4 & | antenna_response, | ||
ConstVectorView | za_grid, | ||
ConstVectorView | f_grid, | ||
const Index | n_pol, | ||
const Index | do_norm | ||
) |
antenna1d_matrix
Core function for setting up the response matrix for 1D antenna cases.
Main task is to extract correct antenna pattern, including frequency interpolation. Actual weights are calculated in integration_func_by_vectmult.
H | The antenna transfer matrix |
antenna_dim | As the WSV with the same name |
antenna_dza | The zenith angle column of antenna_dlos. |
antenna_response | As the WSV with the same name |
za_grid | Zenith angle grid for pencil beam calculations |
f_grid | Frequency grid for monochromatic calculations |
n_pol | Number of polarisation states |
do_norm | Flag whether response should be normalised |
Definition at line 58 of file sensor.cc.
References ARTS::Var::antenna_dim(), ARTS::Var::antenna_response(), DEBUG_ONLY, ARTS::Var::f_grid(), GFIELD4_AA_GRID, GFIELD4_F_GRID, GFIELD4_FIELD_NAMES, GFIELD4_ZA_GRID, gridpos(), Sparse::insert_row(), integration_func_by_vecmult(), interp(), interpweights(), joker, Sparse::ncols(), ConstVectorView::nelem(), Sparse::resize(), ConstVectorView::sum(), and ARTS::Var::za_grid().
Referenced by sensor_responseAntenna().
void antenna2d_gridded_dlos | ( | Sparse & | H, |
const Index & | antenna_dim, | ||
ConstMatrixView | antenna_dlos, | ||
const GriddedField4 & | antenna_response, | ||
ConstMatrixView | mblock_dlos, | ||
ConstVectorView | f_grid, | ||
const Index | n_pol | ||
) |
antenna2d_interp_gridded_dlos
The radiances are treated as a bi-linear function, but the antenna response is treated as step-wise constant function (in contrast to 1D). See also built-in doc.
H | The antenna transfer matrix |
antenna_dim | As the WSV with the same name |
antenna_dza | The zenith angle column of antenna_dlos. |
antenna_response | As the WSV with the same name |
za_grid | Zenith angle grid for pencil beam calculations |
f_grid | Frequency grid for monochromatic calculations |
n_pol | Number of polarisation states |
do_norm | Flag whether response should be normalised |
Definition at line 199 of file sensor.cc.
References ARTS::Var::aa_grid(), abs, ARTS::Var::f_grid(), ConstMatrixView::ncols(), ConstMatrixView::nrows(), and ARTS::Var::za_grid().
Referenced by sensor_responseAntenna().
void antenna2d_interp_response | ( | Sparse & | H, |
const Index & | antenna_dim, | ||
ConstMatrixView | antenna_dlos, | ||
const GriddedField4 & | antenna_response, | ||
ConstMatrixView | mblock_dlos, | ||
ConstVectorView | f_grid, | ||
const Index | n_pol | ||
) |
antenna2d_interp_response
For this option, each direction defined by mblock_dlos_grid is considered to represent the same size in terms of solid beam angle, and the antenna pattern is interpolated to these directions. See also built-in doc.
H | The antenna transfer matrix |
antenna_dim | As the WSV with the same name |
antenna_dza | The zenith angle column of antenna_dlos. |
antenna_response | As the WSV with the same name |
za_grid | Zenith angle grid for pencil beam calculations |
f_grid | Frequency grid for monochromatic calculations |
n_pol | Number of polarisation states |
do_norm | Flag whether response should be normalised |
Definition at line 442 of file sensor.cc.
References ARTS::Var::antenna_dim(), ARTS::Var::antenna_dlos(), ARTS::Var::antenna_response(), ARTS::Var::f_grid(), GFIELD4_AA_GRID, GFIELD4_F_GRID, GFIELD4_FIELD_NAMES, GFIELD4_ZA_GRID, gridpos(), Sparse::insert_row(), interp(), interpweights(), joker, ConstMatrixView::ncols(), Sparse::ncols(), ConstVectorView::nelem(), ConstMatrixView::nrows(), Sparse::resize(), and ConstVectorView::sum().
Referenced by sensor_responseAntenna().
void find_effective_channel_boundaries | ( | Vector & | fmin, |
Vector & | fmax, | ||
const Vector & | f_backend, | ||
const ArrayOfGriddedField1 & | backend_channel_response, | ||
const Numeric & | delta, | ||
const Verbosity & | verbosity | ||
) |
Calculate channel boundaries from instrument response functions.
This function finds out the unique channel boundaries from f_backend and backend_channel_response. This is not a trivial task, since channels may overlap, or may be sorted in a strange way. The function tries to take care of all that. If channels overlap, they are combined to one continuous frequency region. therefore the number of elements in the output vectors fmin and fmax can be lower than the number of elements in f_backend and backend_channel_response.
The function also does consistency checking on the two input variables.
The output vectors fmin and fmax will be monotonically increasing.
[out] | fmin | Vector of lower boundaries of instrument channels. |
[out] | fmax | Vector of upper boundaries of instrument channels. |
[in] | f_backend | Nominal backend frequencies. |
[in] | backend_channel_response | Channel response, relative to nominal frequencies. |
[in] | delta | Extra margin on both sides of each band. Has a default value of 0. |
delta;
Definition at line 1152 of file sensor.cc.
References ARTS::Var::backend_channel_response(), CREATE_OUT2, ARTS::Var::f_backend(), get_sorted_indexes(), is_increasing(), last(), ConstVectorView::nelem(), Vector::resize(), and test_and_merge_two_channels().
Referenced by f_gridFromSensorAMSU(), f_gridFromSensorAMSUgeneric(), and f_gridFromSensorHIRS().
gaussian_response
Returns a 1D gaussian response
y is the gaussian function on grid x, with max at x0 and width following fwhm.
y | Calculated response. |
x | Grid. |
x0 | The x-position of response centre/max. |
fwhm | The full width at half-maximum of the response |
Definition at line 629 of file sensor.cc.
References NAT_LOG_2, PI, pow(), sqrt(), ARTS::Var::x(), x0, and ARTS::Var::y().
Referenced by antenna_responseVaryingGaussian(), and gaussian_response_autogrid().
void gaussian_response_autogrid | ( | Vector & | x, |
Vector & | y, | ||
const Numeric & | x0, | ||
const Numeric & | fwhm, | ||
const Numeric & | xwidth_si, | ||
const Numeric & | dx_si | ||
) |
gaussian_response_autogrid
Returns a 1D gaussian response with a suitable grid
First a grid is generated. The grid is si*[-xwidth_si:dx:xwidth_si], where si is the "standard deviation" corresponding to the FWHM, and dx is biggest possible value < dx_si, to enusre an symmetric grid wth end points exactly at xwidth_si. That is, width and spacing of the grid is specified in terms of number of standard deviations. If xwidth_si is set to 2, the response will cover about 95% the complete response. For xwidth_si=3, about 99% is covered.
y is the gaussian function on grid x, with max at x0 and width following fwhm.
x | Grid generated. |
y | Calculated response. |
x0 | The x-position of response centre/max. |
fwhm | The full width at half-maximum of the response |
xwidth_si | The one-sided width of x. See above. |
dx_si | The grid step size of x. See above. |
Definition at line 606 of file sensor.cc.
References gaussian_response(), NAT_LOG_2, nlinspace(), sqrt(), ARTS::Var::x(), x0, and ARTS::Var::y().
Referenced by antenna_responseGaussian(), antenna_responseVaryingGaussian(), and backend_channel_responseGaussian().
void integration_bin_by_vecmult | ( | VectorView | h, |
ConstVectorView | x_g_in, | ||
const Numeric & | limit1, | ||
const Numeric & | limit2 | ||
) |
integration_bin_by_vecmult
Calculates the (row) vector that multiplied with an unknown (column) vector, g, approximates the integral between limit1 and limit2, where limit1 >= limit2.
This can be seen as a special case of what is handled by integration_func_by_vecmult*, where the function f is a boxcar function. Or expressed differently, the function g is "binned" between limit1 and limit2.
The limits must be inside the range the x_g.
h | The multiplication (row) vector. |
x_g_in | The grid points of function g(x). Can be increasing or decreasing. Must cover a wider range than the boxcar function (in both ends). |
limit1 | The lower integration limit. |
limit2 | The upper integration limit. |
Definition at line 1503 of file sensor.cc.
Referenced by yActive().
void integration_func_by_vecmult | ( | VectorView | h, |
ConstVectorView | f, | ||
ConstVectorView | x_f_in, | ||
ConstVectorView | x_g_in | ||
) |
integration_func_by_vecmult
Calculates the (row) vector that multiplied with an unknown (column) vector approximates the integral of the product between the functions represented by the two vectors: h*g = integral( f(x)*g(x) dx )
Basic principle follows Eriksson et al., Efficient forward modelling by matrix representation of sensor responses, Int. J. Remote Sensing, 27, 1793-1808, 2006. However, while in Eriksson et al. the product between f*g is assumed to vary linearly between the grid point, the expressions applied here are more advanced and are completly exact as long as f and g are piece-wise linear functions. The product f*g is then a quadratic funtion between the grid points.
h | The multiplication (row) vector. |
f | The values of function f(x). |
x_f_in | The grid points of function f(x). Must be increasing. |
x_g_in | The grid points of function g(x). Can be increasing or decreasing. Must cover a wider range than x_f (in both ends). |
Definition at line 1361 of file sensor.cc.
Referenced by antenna1d_matrix(), and spectrometer_matrix().
void met_mm_polarisation_hmatrix | ( | Sparse & | H, |
const ArrayOfString & | pol, | ||
const Numeric | dza, | ||
const Index | stokes_dim, | ||
const String & | iy_unit | ||
) |
Calculate polarisation H-matrix.
Takes into account instrument channel polarisation and zenith angle.
[out] | H | Polarisation matrix |
[in] | mm_pol | Instrument channel polarisations |
[in] | dza | Zenith angle, from reference direction |
[in] | stokes_dim | Workspace variable |
[in] | iy_unit | Workspace variable |
Definition at line 775 of file sensor.cc.
References abs, Sparse::insert_row(), ARTS::Var::iy_unit(), mueller_rotation(), mult(), Array< base >::nelem(), stokes2pol(), ARTS::Var::stokes_dim(), and w().
Referenced by sensor_responseMetMM().
void mixer_matrix | ( | Sparse & | H, |
Vector & | f_mixer, | ||
const Numeric & | lo, | ||
const GriddedField1 & | filter, | ||
ConstVectorView | f_grid, | ||
const Index & | n_pol, | ||
const Index & | n_sp, | ||
const Index & | do_norm | ||
) |
mixer_matrix
Sets up the sparse matrix that models the response from sideband filtering and the mixer.
The size of the transfer matrix is changed in the function as follows: nrows = f_mixer.nelem() ncols = f_grid.nelem()
The returned frequencies are given in IF, so both primary and mirror band is converted down.
H | The mixer/sideband filter transfer matrix |
f_mixer | The frequency grid of the mixer |
lo | The local oscillator frequency |
filter | The sideband filter data. See sideband_response for format and constraints. |
f_grid | The original frequency grid of the spectrum |
n_pol | The number of polarisations to consider |
n_sp | The number of spectra (viewing directions) |
do_norm | Flag whether rows should be normalised |
Definition at line 645 of file sensor.cc.
References GriddedField1::data, DEBUG_ONLY, ARTS::Var::f_grid(), GriddedField::get_numeric_grid(), GFIELD1_F_GRID, last(), ARTS::Var::lo(), ConstVectorView::nelem(), and Vector::resize().
Referenced by sensor_responseMixer().
mueller_rotation
Returns the Mueller matrix for a rotation of the coordinate system defining H and V directions.
The function follows Eq 9 in the sensor response article (Eriksson et al, Efficient forward modelling by matrix representation of sensor responses, IJRS, 2006).
The sparse matrix H is not sized by the function, in order to save time for repeated usage. Before first call of this function, size H as H.resize( stokes_dim, stokes_dim ); The H returned of this function can be used as input for later calls. That is, no need to repeat the resize command above.
H | Mueller matrix |
stokes_dim | Stokes dimensionality |
rotangle | Rotation angle. |
Definition at line 745 of file sensor.cc.
References DEG2RAD, Sparse::ncols(), Sparse::nrows(), Sparse::rw(), and ARTS::Var::stokes_dim().
Referenced by met_mm_polarisation_hmatrix(), and sensor_responseStokesRotation().
void sensor_aux_vectors | ( | Vector & | sensor_response_f, |
ArrayOfIndex & | sensor_response_pol, | ||
Matrix & | sensor_response_dlos, | ||
ConstVectorView | sensor_response_f_grid, | ||
const ArrayOfIndex & | sensor_response_pol_grid, | ||
ConstMatrixView | sensor_response_dlos_grid | ||
) |
sensor_aux_vectors
Sets up the the auxiliary vectors for sensor_response.
The function assumes that all grids are common, and the full vectors are just the grids repeated.
sensor_response_f | As the WSV with same name |
sensor_response_pol | As the WSV with same name |
sensor_response_za | As the WSV with same name |
sensor_response_aa | As the WSV with same name |
sensor_response_f_grid | As the WSV with same name |
sensor_response_pol_grid | As the WSV with same name |
sensor_response_dlos_grid | As the WSV with same name |
Definition at line 938 of file sensor.cc.
References joker, ARTS::Var::sensor_response_dlos(), ARTS::Var::sensor_response_dlos_grid(), ARTS::Var::sensor_response_f(), ARTS::Var::sensor_response_f_grid(), ARTS::Var::sensor_response_pol(), and ARTS::Var::sensor_response_pol_grid().
Referenced by sensor_responseAntenna(), sensor_responseBackend(), sensor_responseBackendFrequencySwitching(), sensor_responseFrequencySwitching(), sensor_responseGenericAMSU(), sensor_responseInit(), sensor_responseMixer(), sensor_responseMixerBackendPrecalcWeights(), sensor_responsePolarisation(), and sensor_responseWMRF().
void spectrometer_matrix | ( | Sparse & | H, |
ConstVectorView | ch_f, | ||
const ArrayOfGriddedField1 & | ch_response, | ||
ConstVectorView | sensor_f, | ||
const Index & | n_pol, | ||
const Index & | n_sp, | ||
const Index & | do_norm | ||
) |
spectrometer_matrix
Constructs the sparse matrix that multiplied with the spectral values gives the spectra from the spectrometer.
The input to the function corresponds mainly to WSVs. See f_backend and backend_channel_response for how the backend response is specified.
H | The response matrix. |
ch_f | Corresponds directly to WSV f_backend. |
ch_response | Corresponds directly to WSV backend_channel_response. |
sensor_f | Corresponds directly to WSV sensor_response_f_grid. |
n_pol | The number of polarisations. |
n_sp | The number of spectra (viewing directions). |
do_norm | Corresponds directly to WSV sensor_norm. |
Definition at line 975 of file sensor.cc.
References data, GFIELD1_F_GRID, Sparse::insert_row(), integration_func_by_vecmult(), Array< base >::nelem(), ConstVectorView::nelem(), Sparse::resize(), and ConstVectorView::sum().
Referenced by sensor_responseBackend().
void stokes2pol | ( | VectorView | w, |
const Index & | stokes_dim, | ||
const Index & | ipol_1based, | ||
const Numeric | nv = 1 |
||
) |
stokes2pol
Sets up a vector to convert the Stokes vector to different polarsiations.
The measured value is the sum of the element product of the conversion vector and the Stokes vector. Schematically:
y[iout] = sum( w.*iy(iin,joker)
Vectors for I, Q, U and V are always normalised to have unit length (one value is 1, the remaining ones zero). The first element of remaining vectors is set to nv (and other values normalised accordingly), to allow that calibartion and other normalisation effects can be incorporated.
s2p | Array of conversion vectors. |
nv | Norm value for polarisations beside I, Q, U and V. |
Definition at line 1041 of file sensor.cc.
References Array< base >::nelem(), ARTS::Var::stokes_dim(), and w().
Referenced by iy_transmitterMultiplePol(), iy_transmitterSinglePol(), met_mm_polarisation_hmatrix(), sensor_responsePolarisation(), and yActive().
void summation_by_vecmult | ( | VectorView | h, |
ConstVectorView | f, | ||
ConstVectorView | x_f, | ||
ConstVectorView | x_g, | ||
const Numeric | x1, | ||
const Numeric | x2 | ||
) |
summation_by_vecmult
Calculates the (row) vector that multiplied with an unknown (column) vector approximates the sum of the product between the functions at two points.
E.g. h*g = f(x1)*g(x1) + f(x2)*g(x2)
The typical application is to set up the combined response matrix for mixer and sideband filter.
See Eriksson et al., Efficient forward modelling by matrix representation of sensor responses, Int. J. Remote Sensing, 27, 1793-1808, 2006, for details.
No normalisation of the response is made.
h | The summation (row) vector. |
f | Sideband response. |
x_f | The grid points of function f(x). |
x_g | The grid for spectral values (normally equal to f_grid) |
x1 | Point 1 |
x2 | Point 2 |