ARTS 2.5.9 (git: 825fa5f2)
Raw::Reduce Namespace Reference

Functions

ArrayOfIndex focus_doublescaling (const Vector &x, const Numeric x0, const Numeric dx)
 Returns the relative position scale for each value in x. More...
 
std::pair< Index, Indexfind_first_and_last_1 (const ArrayOfIndex &x)
 
Vector focus (const Vector &x, const ArrayOfIndex &scaling)
 Returns the re-averaged values of x according to scaling. More...
 
Vector nanfocus (const Vector &x, const ArrayOfIndex &scaling)
 Returns the re-averaged values of x according to scaling ignoring all non-normal values. More...
 

Function Documentation

◆ find_first_and_last_1()

std::pair< Index, Index > Raw::Reduce::find_first_and_last_1 ( const ArrayOfIndex x)

Definition at line 310 of file raw.cc.

References last(), and Array< base >::nelem().

Referenced by focus(), and nanfocus().

◆ focus()

Vector Raw::Reduce::focus ( const Vector x,
const ArrayOfIndex scaling 
)

Returns the re-averaged values of x according to scaling.

This refocus the input Vector x to reduce its size

The scaling should be such that it contains how many points you want the rescaled position to contain at most. Note that if there is not enough points left, all the remaining points are returned averaged to what they can be averaged to.

Note that this cannot defocus so there must be atleast 1 1 in scaling representing retained focus. Also note that all 1s must be continuous in scaling (if they are all non-1s inbetween are ignored). Lastly note that 0s are not allowed in scaling (if there are, the function will loop forever).

Parameters
[in]xA vector to refocus
[in]scalingThe scaling
Returns
A rescaled and focused x

Definition at line 325 of file raw.cc.

References find_first_and_last_1(), mean(), N, and ConstVectorView::size().

◆ focus_doublescaling()

ArrayOfIndex Raw::Reduce::focus_doublescaling ( const Vector x,
const Numeric  x0,
const Numeric  dx 
)

Returns the relative position scale for each value in x.

This is meant to be used with the focus routine to retain mostly values close to x0, as a reduction mechanism

This particular routine will compute the focus scaling by doubling the points so that for (positive values only, mirroring applies at absolute values):

x0 + 0 * dx to x0 + 1 * dx will have 1-long steps x0 + 1 * dx to x0 + 2 * dx will have 2-long steps x0 + 2 * dx to x0 + 4 * dx will have 4-long steps x0 + 4 * dx to x0 + 8 * dx will have 8-long steps

This doubling continues to the end (on both side around x0). The focus routine might still keep more noisy data at the end of the output focus vector when there are too few data points to have exactly a doubling of the numbers of steps

Note: the rounding is simplistic so that x0 + N * dx belongs to the 'next' step

Parameters
[in]xThe grid of x-values [strictly increasing by the same amount]
[in]x0A central position so that x[0] < x0 < x[x.size() - 1]
[in]dxA stepsize so that can be used to compute a relative step
Returns
Scaling of some positions (same size at x)

Definition at line 294 of file raw.cc.

References ConstVectorView::size().

Referenced by ybatchDoublingMeanFocus(), and yDoublingMeanFocus().

◆ nanfocus()

Vector Raw::Reduce::nanfocus ( const Vector x,
const ArrayOfIndex scaling 
)

Returns the re-averaged values of x according to scaling ignoring all non-normal values.

This refocus the input Vector x to reduce its size

The scaling should be such that it contains how many points you want the rescaled position to contain at most. Note that if there is not enough points left, all the remaining points are returned averaged to what they can be averaged to.

Note that this cannot defocus so there must be atleast 1 1 in scaling representing retained focus. Also note that all 1s must be continuous in scaling (if they are all non-1s inbetween are ignored). Lastly note that 0s are not allowed in scaling (if there are, the function will loop forever).

If there is only NaN in a range then that value is NaN in the output (retaining original sizes)

Parameters
[in,out]xA vector to refocus
[in]scalingThe scaling
Returns
A rescaled and focused x

Definition at line 359 of file raw.cc.

References find_first_and_last_1(), isnormal_or_zero(), N, nanmean(), and ConstVectorView::size().

Referenced by ybatchDoublingMeanFocus(), and yDoublingMeanFocus().