m_sensor.cc File Reference

Workspace functions related to sensor modelling variables. More...

#include <cmath>
#include <stdexcept>
#include <string>
#include "arts.h"
#include "auto_md.h"
#include "check_input.h"
#include "math_funcs.h"
#include "messages.h"
#include "ppath.h"
#include "special_interp.h"
#include "xml_io.h"
#include "sensor.h"
#include "make_vector.h"
#include "sorting.h"

Include dependency graph for m_sensor.cc:

Go to the source code of this file.

Functions

void AntennaOff (Index &antenna_dim, Vector &mblock_za_grid, Vector &mblock_aa_grid)
 WORKSPACE METHOD: AntennaOff.
void AntennaSet1D (Index &antenna_dim, Vector &mblock_aa_grid)
 WORKSPACE METHOD: AntennaSet1D.
void AntennaSet2D (Index &antenna_dim, const Index &atmosphere_dim)
 WORKSPACE METHOD: AntennaSet2D.
void f_gridFromSensorAMSU (Vector &f_grid, const Vector &lo, const ArrayOfVector &f_backend, const ArrayOfArrayOfGField1 &backend_channel_response, const Numeric &spacing)
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.
void f_gridFromSensorHIRS (Vector &f_grid, const Vector &f_backend, const ArrayOfGField1 &backend_channel_response, const Numeric &spacing)
 WORKSPACE METHOD: f_gridFromSensorHIRS.
void sensorOff (Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, Vector &sensor_response_f_grid, ArrayOfIndex &sensor_response_pol_grid, Vector &sensor_response_za_grid, Vector &sensor_response_aa_grid, Index &antenna_dim, Vector &mblock_za_grid, Vector &mblock_aa_grid, const Index &atmosphere_dim, const Index &stokes_dim, const Vector &f_grid)
 WORKSPACE METHOD: sensorOff.
void sensor_responseAntenna (Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, Vector &sensor_response_za_grid, Vector &sensor_response_aa_grid, const Vector &sensor_response_f_grid, const ArrayOfIndex &sensor_response_pol_grid, const Index &atmosphere_dim, const Index &antenna_dim, const Matrix &antenna_los, const GField4 &antenna_response, const Index &sensor_norm)
 WORKSPACE METHOD: sensor_responseAntenna.
void sensor_responseBackend (Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, Vector &sensor_response_f_grid, const ArrayOfIndex &sensor_response_pol_grid, const Vector &sensor_response_za_grid, const Vector &sensor_response_aa_grid, const Vector &f_backend, const ArrayOfGField1 &backend_channel_response, const Index &sensor_norm)
 WORKSPACE METHOD: sensor_responseBackend.
void sensor_responseBeamSwitching (Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, Vector &sensor_response_za_grid, Vector &sensor_response_aa_grid, const Vector &sensor_response_f_grid, const ArrayOfIndex &sensor_response_pol_grid, const Numeric &w1, const Numeric &w2)
 WORKSPACE METHOD: sensor_responseBeamSwitching.
void sensor_responseIF2RF (Vector &sensor_response_f, Vector &sensor_response_f_grid, const Numeric &lo, const String &sideband_mode)
 WORKSPACE METHOD: sensor_responseIF2RF.
void sensor_responseInit (Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, Vector &sensor_response_f_grid, ArrayOfIndex &sensor_response_pol_grid, Vector &sensor_response_za_grid, Vector &sensor_response_aa_grid, const Vector &f_grid, const Vector &mblock_za_grid, const Vector &mblock_aa_grid, const Index &antenna_dim, const Index &atmosphere_dim, const Index &stokes_dim, const Index &sensor_norm)
 WORKSPACE METHOD: sensor_responseInit.
void sensor_responseMixer (Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, Vector &sensor_response_f_grid, const ArrayOfIndex &sensor_response_pol_grid, const Vector &sensor_response_za_grid, const Vector &sensor_response_aa_grid, const Numeric &lo, const GField1 &sideband_response, const Index &sensor_norm)
 WORKSPACE METHOD: sensor_responseMixer.
void sensor_responseMultiMixerBackend (Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Vector &sensor_response_za, Vector &sensor_response_aa, Vector &sensor_response_f_grid, const ArrayOfIndex &sensor_response_pol_grid, const Vector &sensor_response_za_grid, const Vector &sensor_response_aa_grid, const Vector &lo_multi, const ArrayOfGField1 &sideband_response_multi, const ArrayOfString &sideband_mode_multi, const ArrayOfVector &f_backend_multi, const ArrayOfArrayOfGField1 &backend_channel_response_multi, const Index &sensor_norm)

Variables

const Numeric PI
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


Detailed Description

Workspace functions related to sensor modelling variables.

Author:
Mattias Ekström <ekstrom@rss.chalmers.se>
Date:
2003-02-13
These functions are listed in the doxygen documentation as entries of the file auto_md.h.

Definition in file m_sensor.cc.


Function Documentation

void AntennaOff ( Index antenna_dim,
Vector mblock_za_grid,
Vector mblock_aa_grid 
)

WORKSPACE METHOD: AntennaOff.

Sets some antenna related variables

Use this method to set *antenna_dim*, *mblock_za_grid* and mblock_aa_grid* to suitable values (1, [0] and [], respectively) for cases when a sensor is included, but the antenna pattern is neglected.

Author:
Patrick Eriksson
Parameters:
[out] antenna_dim WS Output
[out] mblock_za_grid WS Output
[out] mblock_aa_grid WS Output

Definition at line 72 of file m_sensor.cc.

References out2, and Vector::resize().

Referenced by AntennaOff_g(), and sensorOff().

void AntennaSet1D ( Index antenna_dim,
Vector mblock_aa_grid 
)

WORKSPACE METHOD: AntennaSet1D.

Sets the antenna dimension to 1D.

Sets *antenna_dim* to 1 and sets *mblock_aa_grid* to be empty.

Author:
Patrick Eriksson
Parameters:
[out] antenna_dim WS Output
[out] mblock_aa_grid WS Output

Definition at line 92 of file m_sensor.cc.

References out2, out3, and Vector::resize().

Referenced by AntennaSet1D_g().

void AntennaSet2D ( Index antenna_dim,
const Index atmosphere_dim 
)

WORKSPACE METHOD: AntennaSet2D.

Sets the antenna dimension to 2D.

Sets *antenna_dim* to 2.

It is only allowed to set *antenna_dim* to 2 when *atmosphere_dim* equals 3.

Author:
Patrick Eriksson
Parameters:
[out] antenna_dim WS Output
[in] atmosphere_dim WS Input

Definition at line 107 of file m_sensor.cc.

References out2, and out3.

Referenced by AntennaSet2D_g().

void f_gridFromSensorAMSU ( Vector f_grid,
const Vector lo,
const ArrayOfVector f_backend,
const ArrayOfArrayOfGField1 backend_channel_response,
const Numeric spacing 
)

void f_gridFromSensorHIRS ( Vector f_grid,
const Vector f_backend,
const ArrayOfGField1 backend_channel_response,
const Numeric spacing 
)

WORKSPACE METHOD: f_gridFromSensorHIRS.

Automatically calculate f_grid to match the sensor.

This method is handy if you are simulating a HIRS-type instrument, consisting of a few discrete channels.

It calculates f_grid to match the instrument, as given by the nominal band frequencies *f_backend* and the spectral channel response functions given by *backend_channel_response*.

You have to specify the desired spacing in the keyword *spacing*, which has a default value of 5e8 Hz.

The produced grid will not have exactly the requested spacing, but will not be coarser than requested. The algorithm starts with the band edges, then adds additional points until the spacing is at least as fine as requested.

There is a similar method for AMSU-type instruments, see f_gridFromSensorAMSU*.

Author:
Stefan Buehler
Parameters:
[out] f_grid WS Output
[in] f_backend WS Input
[in] backend_channel_response WS Input
[in] spacing Generic Input (Default: "5e8")

Definition at line 349 of file m_sensor.cc.

References get_sorted_indexes(), is_increasing(), Array< base >::nelem(), ConstVectorView::nelem(), out2, out3, and test_and_merge_two_channels().

Referenced by f_gridFromSensorHIRS_g().

void sensor_responseAntenna ( Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Vector sensor_response_za,
Vector sensor_response_aa,
Vector sensor_response_za_grid,
Vector sensor_response_aa_grid,
const Vector sensor_response_f_grid,
const ArrayOfIndex sensor_response_pol_grid,
const Index atmosphere_dim,
const Index antenna_dim,
const Matrix antenna_los,
const GField4 antenna_response,
const Index sensor_norm 
)

WORKSPACE METHOD: sensor_responseAntenna.

Adds response of the antenna.

The function returns the sensor response matrix after the antenna characteristics have been included.

The function handles "multi-beam" cases where the polarisation coordinate system is the same for all beams.

See *antenna_dim*, *antenna_los* and *antenna_response* for details on how to specify the antenna response.

Author:
Mattias Ekstrom

Patrick Eriksson

Parameters:
[out] sensor_response WS Output
[out] sensor_response_f WS Output
[out] sensor_response_pol WS Output
[out] sensor_response_za WS Output
[out] sensor_response_aa WS Output
[out] sensor_response_za_grid WS Output
[out] sensor_response_aa_grid WS Output
[in] sensor_response_f_grid WS Input
[in] sensor_response_pol_grid WS Input
[in] atmosphere_dim WS Input
[in] antenna_dim WS Input
[in] antenna_los WS Input
[in] antenna_response WS Input
[in] sensor_norm WS Input

Definition at line 581 of file m_sensor.cc.

References antenna1d_matrix(), chk_if_bool(), chk_if_in_range(), chk_if_increasing(), GField::get_numeric_grid(), GField::get_string_grid(), GFIELD4_AA_GRID, GFIELD4_F_GRID, GFIELD4_FIELD_NAMES, GFIELD4_ZA_GRID, joker, last(), max, min, mult(), Sparse::ncols(), ConstMatrixView::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), Sparse::nrows(), out3, Sparse::resize(), and sensor_aux_vectors().

Referenced by sensor_responseAntenna_g().

void sensor_responseBackend ( Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Vector sensor_response_za,
Vector sensor_response_aa,
Vector sensor_response_f_grid,
const ArrayOfIndex sensor_response_pol_grid,
const Vector sensor_response_za_grid,
const Vector sensor_response_aa_grid,
const Vector f_backend,
const ArrayOfGField1 backend_channel_response,
const Index sensor_norm 
)

WORKSPACE METHOD: sensor_responseBackend.

Adds response of the backend (spectrometer).

The function returns the sensor response matrix after the backend characteristics have been included.

See *f_backend*, *backend_channel_response* and *sensor_norm* for details on how to specify the backend response.

Author:
Mattias Ekstrom

Patrick Eriksson

Parameters:
[out] sensor_response WS Output
[out] sensor_response_f WS Output
[out] sensor_response_pol WS Output
[out] sensor_response_za WS Output
[out] sensor_response_aa WS Output
[out] sensor_response_f_grid WS Output
[in] sensor_response_pol_grid WS Input
[in] sensor_response_za_grid WS Input
[in] sensor_response_aa_grid WS Input
[in] f_backend WS Input
[in] backend_channel_response WS Input
[in] sensor_norm WS Input

Definition at line 857 of file m_sensor.cc.

References GFIELD1_F_GRID, is_increasing(), last(), max, min, mult(), Sparse::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), Sparse::nrows(), out3, Sparse::resize(), sensor_aux_vectors(), and spectrometer_matrix().

Referenced by sensor_responseBackend_g(), and sensor_responseMultiMixerBackend().

void sensor_responseBeamSwitching ( Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Vector sensor_response_za,
Vector sensor_response_aa,
Vector sensor_response_za_grid,
Vector sensor_response_aa_grid,
const Vector sensor_response_f_grid,
const ArrayOfIndex sensor_response_pol_grid,
const Numeric w1,
const Numeric w2 
)

WORKSPACE METHOD: sensor_responseBeamSwitching.

Calculates the difference spectrum: Beam switching

The method allows to mimic beam switching. The measurement procedure is basedon taking the difference of two spectra and the calculation set-up must treat exactly two observation directions.

The returned spectrum is y = w1*y + w2*y2, where y1 and w1 are the spectrum and weight for the first direction, respectively (y2 and (w2 defined corresponingly for second direction).

Author:
Patrick Eriksson
Parameters:
[out] sensor_response WS Output
[out] sensor_response_f WS Output
[out] sensor_response_pol WS Output
[out] sensor_response_za WS Output
[out] sensor_response_aa WS Output
[out] sensor_response_za_grid WS Output
[out] sensor_response_aa_grid WS Output
[in] sensor_response_f_grid WS Input
[in] sensor_response_pol_grid WS Input
[in] w1 Generic Input (Default: "-1")
[in] w2 Generic Input (Default: "1")

Definition at line 1032 of file m_sensor.cc.

References Sparse::insert_row(), mult(), Sparse::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), Sparse::nrows(), out3, Vector::resize(), Sparse::resize(), and sensor_aux_vectors().

Referenced by sensor_responseBeamSwitching_g().

void sensor_responseIF2RF ( Vector sensor_response_f,
Vector sensor_response_f_grid,
const Numeric lo,
const String sideband_mode 
)

WORKSPACE METHOD: sensor_responseIF2RF.

Converts sensor response variables from IF to RF.

The function converts intermediate frequencies (IF) in sensor_response_f* and *sensor_response_f_grid* to radio frequencies (RF). This conversion is needed if the frequency translation of a mixer is included and the position of backend channels are specified in RF.

A direct frequency conversion is performed. Values are not sorted in any way.

Author:
Patrick Eriksson
Parameters:
[out] sensor_response_f WS Output
[out] sensor_response_f_grid WS Output
[in] lo WS Input
[in] sideband_mode WS Input

Definition at line 1105 of file m_sensor.cc.

References max.

Referenced by sensor_responseIF2RF_g(), and sensor_responseMultiMixerBackend().

void sensor_responseInit ( Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Vector sensor_response_za,
Vector sensor_response_aa,
Vector sensor_response_f_grid,
ArrayOfIndex sensor_response_pol_grid,
Vector sensor_response_za_grid,
Vector sensor_response_aa_grid,
const Vector f_grid,
const Vector mblock_za_grid,
const Vector mblock_aa_grid,
const Index antenna_dim,
const Index atmosphere_dim,
const Index stokes_dim,
const Index sensor_norm 
)

WORKSPACE METHOD: sensor_responseInit.

Initialises the variables summarising the sensor response.

This method sets the variables to match monochromatic pencil beam calculations, to be further modified by inclusion of sensor characteristics. If pure monochromatic pencil beam calculations shall be performed use *sensorOff*.

The variables are set as follows: <br> sensor_response : Identity matrix, with size matching *f_grid*, <br> *stokes_dim* *mblock_za_grid* and <br> *mblock_aa_grid*. <br> sensor_response_f : Repeated values of *f_grid*. <br> sensor_response_pol : Data matching *stokes_dim*. <br> sensor_response_za : Repeated values of *mblock_za_grid*. <br> sensor_response_aa : Repeated values of *mblock_aa_grid*. <br> sensor_response_f_grid : Equal to *f_grid*. <br> sensor_response_pol_grid: Set to 1:*stokes_dim*. <br> sensor_response_za_grid : Equal to *mblock_za_grid*. <br> sensor_response_aa_grid : Equal to *mblock_aa_grid*.

The standard order of WSM calls for creating *sensor_response* is: <br> sensor_responseInit <br> sensor_responseAntenna1D <br> sensor_responseRotation <br> sensor_responsePolarisation <br> sensor_responseMixer <br> sensor_responseBackend It is not necessary to include a method for all sensor responses. There exist several method versions for some responses.

Author:
Mattias Ekstrom

Patrick Eriksson

Parameters:
[out] sensor_response WS Output
[out] sensor_response_f WS Output
[out] sensor_response_pol WS Output
[out] sensor_response_za WS Output
[out] sensor_response_aa WS Output
[out] sensor_response_f_grid WS Output
[out] sensor_response_pol_grid WS Output
[out] sensor_response_za_grid WS Output
[out] sensor_response_aa_grid WS Output
[in] f_grid WS Input
[in] mblock_za_grid WS Input
[in] mblock_aa_grid WS Input
[in] antenna_dim WS Input
[in] atmosphere_dim WS Input
[in] stokes_dim WS Input
[in] sensor_norm WS Input

Definition at line 1147 of file m_sensor.cc.

References chk_if_bool(), chk_if_in_range(), chk_if_increasing(), is_decreasing(), is_increasing(), Sparse::make_I(), ConstVectorView::nelem(), out2, out3, and sensor_aux_vectors().

Referenced by sensor_responseInit_g(), and sensorOff().

void sensor_responseMixer ( Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Vector sensor_response_za,
Vector sensor_response_aa,
Vector sensor_response_f_grid,
const ArrayOfIndex sensor_response_pol_grid,
const Vector sensor_response_za_grid,
const Vector sensor_response_aa_grid,
const Numeric lo,
const GField1 sideband_response,
const Index sensor_norm 
)

WORKSPACE METHOD: sensor_responseMixer.

Adds response of the mixer of a heterodyne system.

The function returns the sensor response matrix after the mixer characteristics have been included. Frequency variables are converted from radio frequency (RF) to intermediate frequency (IF).

See *lo* and *sideband_response* for details on how to specify the mixer response

Author:
Mattias Ekstrom

Patrick Eriksson

Parameters:
[out] sensor_response WS Output
[out] sensor_response_f WS Output
[out] sensor_response_pol WS Output
[out] sensor_response_za WS Output
[out] sensor_response_aa WS Output
[out] sensor_response_f_grid WS Output
[in] sensor_response_pol_grid WS Input
[in] sensor_response_za_grid WS Input
[in] sensor_response_aa_grid WS Input
[in] lo WS Input
[in] sideband_response WS Input
[in] sensor_norm WS Input

Definition at line 1242 of file m_sensor.cc.

References GField::get_numeric_grid(), GFIELD1_F_GRID, is_increasing(), last(), mixer_matrix(), mult(), Sparse::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), Sparse::nrows(), out3, Sparse::resize(), and sensor_aux_vectors().

Referenced by sensor_responseMixer_g(), and sensor_responseMultiMixerBackend().

void sensor_responseMultiMixerBackend ( Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Vector sensor_response_za,
Vector sensor_response_aa,
Vector sensor_response_f_grid,
const ArrayOfIndex sensor_response_pol_grid,
const Vector sensor_response_za_grid,
const Vector sensor_response_aa_grid,
const Vector lo_multi,
const ArrayOfGField1 sideband_response_multi,
const ArrayOfString sideband_mode_multi,
const ArrayOfVector f_backend_multi,
const ArrayOfArrayOfGField1 backend_channel_response_multi,
const Index sensor_norm 
)

void sensorOff ( Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Vector sensor_response_za,
Vector sensor_response_aa,
Vector sensor_response_f_grid,
ArrayOfIndex sensor_response_pol_grid,
Vector sensor_response_za_grid,
Vector sensor_response_aa_grid,
Index antenna_dim,
Vector mblock_za_grid,
Vector mblock_aa_grid,
const Index atmosphere_dim,
const Index stokes_dim,
const Vector f_grid 
)

WORKSPACE METHOD: sensorOff.

Sets sensor WSVs to obtain monochromatic pencil beam values.

The variables are set as follows: <br> antenna_dim : 1. <br> mblock_za_grid : Length 1, value 0. <br> mblock_aa_grid : Empty. <br> sensor_response : As returned by *sensor_responseInit*. <br> sensor_response_f : As returned by *sensor_responseInit*. <br> sensor_response_pol : As returned by *sensor_responseInit*. <br> sensor_response_za : As returned by *sensor_responseInit*. <br> sensor_response_aa : As returned by *sensor_responseInit*.

Author:
Patrick Eriksson
Parameters:
[out] sensor_response WS Output
[out] sensor_response_f WS Output
[out] sensor_response_pol WS Output
[out] sensor_response_za WS Output
[out] sensor_response_aa WS Output
[out] sensor_response_f_grid WS Output
[out] sensor_response_pol_grid WS Output
[out] sensor_response_za_grid WS Output
[out] sensor_response_aa_grid WS Output
[out] antenna_dim WS Output
[out] mblock_za_grid WS Output
[out] mblock_aa_grid WS Output
[in] atmosphere_dim WS Input
[in] stokes_dim WS Input
[in] f_grid WS Input

Definition at line 545 of file m_sensor.cc.

References AntennaOff(), and sensor_responseInit().

Referenced by sensorOff_g().

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.

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.

Author:
Stefan Buehler
Returns:
True if channels were merged, otherwise false.
Return values:
fmin Lower channel boundaries.
fmax Upper channel boundaries.
Parameters:
i Index of first channel.
j Index of second channel.

Definition at line 297 of file m_sensor.cc.

References ConstVectorView::nelem(), and Vector::resize().

Referenced by f_gridFromSensorHIRS().


Variable Documentation

const Numeric PI


Generated on Mon Mar 23 14:06:42 2009 for ARTS by  doxygen 1.5.6