ARTS
2.0.49
|
Functions related to sensor modelling. More...
#include <cmath>
#include <list>
#include <stdexcept>
#include "arts.h"
#include "logic.h"
#include "matpackI.h"
#include "matpackII.h"
#include "messages.h"
#include "sorting.h"
#include "sensor.h"
Go to the source code of this file.
Functions | |
void | antenna1d_matrix (Sparse &H, const Index &antenna_dim, ConstMatrixView antenna_los, const GriddedField4 &antenna_response, ConstVectorView za_grid, ConstVectorView f_grid, const Index n_pol, const Index do_norm) |
antenna1d_matrix More... | |
void | antenna2d_simplified (Sparse &H, const Index &antenna_dim, ConstMatrixView antenna_los, const GriddedField4 &antenna_response, ConstVectorView za_grid, ConstVectorView aa_grid, ConstVectorView f_grid, const Index n_pol, const Index do_norm) |
antenna2d_simplified More... | |
void | gaussian_response (Vector &x, Vector &y, const Numeric &x0, const Numeric &fwhm, const Numeric &xwidth_si, const Numeric &dx_si) |
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 | sensor_aux_vectors (Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, ConstVectorView sensor_response_f_grid, const ArrayOfIndex &sensor_response_pol_grid, ConstVectorView sensor_response_za_grid, ConstVectorView sensor_response_aa_grid, const Index za_aa_independent) |
sensor_aux_vectors More... | |
void | sensor_integration_vector (VectorView h, ConstVectorView f, ConstVectorView x_f_in, ConstVectorView x_g_in) |
sensor_integration_vector More... | |
void | sensor_summation_vector (VectorView h, ConstVectorView f, ConstVectorView x_f, ConstVectorView x_g, const Numeric x1, const Numeric x2) |
sensor_summation_vector 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... | |
bool | test_and_merge_two_channels (Vector &fmin, Vector &fmax, Index i, Index j) |
Test if two instrument channels overlap, and if so, merge them. 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... | |
Variables | |
const Numeric | PI |
const Numeric | NAT_LOG_2 |
const Index | GFIELD1_F_GRID |
const Index | GFIELD4_FIELD_NAMES |
const Index | GFIELD4_F_GRID |
const Index | GFIELD4_ZA_GRID |
const Index | GFIELD4_AA_GRID |
Functions related to sensor modelling.
Functions to model sensor behaviour and integration calculated as vector multiplication.
Definition in file sensor.cc.
void antenna1d_matrix | ( | Sparse & | H, |
const Index & | antenna_dim, | ||
ConstMatrixView | antenna_los, | ||
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 sensor_integration_vector.
H | The antenna transfer matrix |
antenna_dim | As the WSV with the same name |
antenna_los | As the WSV with the same name |
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 78 of file sensor.cc.
References GriddedField4::data, DEBUG_ONLY, GriddedField::get_numeric_grid(), GriddedField::get_string_grid(), GFIELD4_AA_GRID, GFIELD4_F_GRID, GFIELD4_FIELD_NAMES, GFIELD4_ZA_GRID, gridpos(), Sparse::insert_row(), interp(), interpweights(), joker, Sparse::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), Sparse::resize(), sensor_integration_vector(), and ConstVectorView::sum().
Referenced by antenna2d_simplified(), and sensor_responseAntenna().
void antenna2d_simplified | ( | Sparse & | H, |
const Index & | antenna_dim, | ||
ConstMatrixView | antenna_los, | ||
const GriddedField4 & | antenna_response, | ||
ConstVectorView | za_grid, | ||
ConstVectorView | aa_grid, | ||
ConstVectorView | f_grid, | ||
const Index | n_pol, | ||
const Index | do_norm | ||
) |
antenna2d_simplified
A first function for setting up the response matrix for 2D antenna cases.
Following the ARTS definitions, a bi-linear variation (in za and aa dimensions) for both antenna pattern and pencil beam radiances should be assumed here. This function does not handle this. It performs instead a series of 1D antenna calculations and "sums up" the results. In this summation, both antenna pattern and radiances are assumed to constant in the azimuthal direction around each point in aa_grid (corresponding to mblock_aa_grid). That is, for azimuth, a step-wise function is used instead of a piecewise linear one.
H | The antenna transfer matrix |
antenna_dim | As the WSV with the same name |
antenna_los | As the WSV with the same name |
antenna_response | As the WSV with the same name |
za_grid | Zenith angle grid for pencil beam calculations |
aa_grid | Azimuth 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 246 of file sensor.cc.
References antenna1d_matrix(), GriddedField4::data, GriddedField::get_numeric_grid(), GFIELD4_AA_GRID, gridpos(), Sparse::insert_row(), last(), ConstTensor4View::nbooks(), ConstVectorView::nelem(), ConstTensor4View::npages(), ConstTensor4View::nrows(), GriddedField4::resize(), Sparse::resize(), and GriddedField::set_grid().
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. |
Definition at line 1076 of file sensor.cc.
References CREATE_OUT2, get_sorted_indexes(), is_increasing(), Array< base >::nelem(), ConstVectorView::nelem(), Vector::resize(), and test_and_merge_two_channels().
Referenced by f_gridFromSensorAMSU(), and f_gridFromSensorHIRS().
void gaussian_response | ( | Vector & | x, |
Vector & | y, | ||
const Numeric & | x0, | ||
const Numeric & | fwhm, | ||
const Numeric & | xwidth_si, | ||
const Numeric & | dx_si | ||
) |
gaussian_response
Returns a 1D gaussian response
First a grid is generated. The grid is si*[-xwidth_si:dx_si:xwidth_si], where si is the "standard deviation" corresponding to the FWHM. 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 response matching x.
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 408 of file sensor.cc.
References linspace(), NAT_LOG_2, ConstVectorView::nelem(), PI, and Vector::resize().
Referenced by antenna_responseGaussian(), and backend_channel_responseGaussian().
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 455 of file sensor.cc.
References GriddedField1::data, DEBUG_ONLY, GriddedField::get_numeric_grid(), GFIELD1_F_GRID, Sparse::insert_row(), last(), ConstVectorView::nelem(), Vector::resize(), Sparse::resize(), sensor_summation_vector(), and ConstVectorView::sum().
Referenced by sensor_responseMixer().
void sensor_aux_vectors | ( | Vector & | sensor_response_f, |
ArrayOfIndex & | sensor_response_pol, | ||
Vector & | sensor_response_za, | ||
Vector & | sensor_response_aa, | ||
ConstVectorView | sensor_response_f_grid, | ||
const ArrayOfIndex & | sensor_response_pol_grid, | ||
ConstVectorView | sensor_response_za_grid, | ||
ConstVectorView | sensor_response_aa_grid, | ||
const Index | za_aa_independent | ||
) |
sensor_aux_vectors
Sets up the the auxiliary vectors for sensor_response.
The function assumes that all grids are common, and the aux 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_za_grid | As the WSV with same name |
sensor_response_aa_grid | As the WSV with same name |
za_aa_independent | Flag to indicate that za and aa dimensions are "perpendicular". This is only valid before the antenna response has been considered. |
Definition at line 586 of file sensor.cc.
References Array< base >::nelem(), ConstVectorView::nelem(), and Vector::resize().
Referenced by sensor_responseAntenna(), sensor_responseBackend(), sensor_responseBackendFrequencySwitching(), sensor_responseBeamSwitching(), sensor_responseFillFgrid(), sensor_responseFrequencySwitching(), sensor_responseInit(), sensor_responseMixer(), sensor_responseMultiMixerBackend(), sensor_responsePolarisation(), and sensor_responseWMRF().
void sensor_integration_vector | ( | VectorView | h, |
ConstVectorView | f, | ||
ConstVectorView | x_f_in, | ||
ConstVectorView | x_g_in | ||
) |
sensor_integration_vector
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.
E.g. h*g = integral( f(x)*g(x) dx )
See Eriksson et al., Efficient forward modelling by matrix representation of sensor responses, Int. J. Remote Sensing, 27, 1793-1808, 2006, for details.
The grids are internally normalised to cover the range [0,1] for increased numerical stability.
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_ft (in both ends). |
Definition at line 683 of file sensor.cc.
References b0, dx, is_decreasing(), is_increasing(), and ConstVectorView::nelem().
Referenced by antenna1d_matrix(), and spectrometer_matrix().
void sensor_summation_vector | ( | VectorView | h, |
ConstVectorView | f, | ||
ConstVectorView | x_f, | ||
ConstVectorView | x_g, | ||
const Numeric | x1, | ||
const Numeric | x2 | ||
) |
sensor_summation_vector
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 |
Definition at line 831 of file sensor.cc.
References gridpos(), interp(), interpweights(), last(), and ConstVectorView::nelem().
Referenced by mixer_matrix().
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 897 of file sensor.cc.
References GFIELD1_F_GRID, Sparse::insert_row(), Array< base >::nelem(), ConstVectorView::nelem(), Sparse::resize(), sensor_integration_vector(), and ConstVectorView::sum().
Referenced by sensor_responseBackend().
Test if two instrument channels overlap, and if so, merge them.
The channels boundaries are specified in two separate vectors, fmin and fmax. These vectors are both input and output. If merging has happened, they will each be one element shorter.
The positions of the channels to compare is given by the input parameters i and j. It is assumed that the minimum frequency of i is lower than or equal to that of j.
Furthermore, it is assumed that i itself is lower than j.
The range of the first channel (i) will have been extended to accomodate the second channel (j). The second channel will have been removed.
The function also handles the updating of index j: If the two channels do not overlap, j is increased by one.
Function returns true if merging has happened.
fmin | Lower channel boundaries. |
fmax | Upper channel boundaries. |
i | Index of first channel. |
j | Index of second channel. |
Definition at line 1000 of file sensor.cc.
References ConstVectorView::nelem(), and Vector::resize().
Referenced by find_effective_channel_boundaries().
|
extern |
Referenced by mixer_matrix(), and spectrometer_matrix().
|
extern |
Referenced by antenna1d_matrix(), and antenna2d_simplified().
|
extern |
Referenced by antenna1d_matrix().
|
extern |
Referenced by antenna1d_matrix().
|
extern |
Referenced by antenna1d_matrix().
|
extern |
Referenced by gaussian_response().
|
extern |
Referenced by gaussian_response().