42 "Length of vectors must be correct");
59 const Index& first_c_index,
64 "Length of vectors must be correct");
66 level0_time.
nelem() not_eq 0,
67 "Bad level0_time length, must be empty of same as level0_data");
72 if (level0_time.
nelem()) {
73 sensor_time.resize(ybatch.
nelem());
75 const Index pos = first_c_index - ((first_c_index > 1) ? 2 : 0);
77 sensor_time[i] = level0_time[pos + 2*i];
86 const Index& disregard_first,
87 const Index& disregard_last,
93 "Time vector length must match input data length");
97 "Time vector cannot decrease");
106 if (lims.front() == n) {
107 ybatch_out.resize(0);
108 sensor_time_out.resize(0);
114 [k](
auto& x){return x.nelem() == k;}),
115 "Bad frequency grid size in input data; expects all equal");
118 const Index m = lims.nelem() - 1;
120 "Must include last if time step covers all of the range");
125 #pragma omp parallel for if (not arts_omp_in_parallel()) schedule(guided)
126 for (
Index i=0; i<m; i++) {
127 sensor_time_out[i] =
mean_time(sensor_time, lims[i], lims[i+1]);
132 if (disregard_first) {
133 ybatch_out.erase(ybatch_out.begin());
134 sensor_time_out.erase(sensor_time_out.begin());
137 if (disregard_last) {
138 ybatch_out.pop_back();
139 sensor_time_out.pop_back();
143 sensor_time = sensor_time_out;
161 [m](
auto& y){return y.nelem() not_eq m;}),
162 "Bad input size, all of ybatch must match itself");
165 "Bad input size, trop_temp must match ybatch or be 1-long,\n"
166 "trop_temp: [", trop_temp,
"]\ntrop_temp.nelem(): ",
167 trop_temp.
nelem(),
"\nybatch.nelem(): ", n);
173 for (
Index i=0; i<n; i++) {
174 ybatch_corr[i][2] = trop_temp.
nelem() > 1 ? trop_temp[i] : trop_temp[0];
176 ybatch_corr[i][1] = std::exp(- std::log((ybatch_corr[i][2] - ybatch_corr[i][0]) / (ybatch_corr[i][2] - targ_temp)));
180 for (
Index i=0; i<n; i++) {
181 ybatch[i] *= ybatch_corr[i][1];
182 ybatch[i] += ybatch_corr[i][2] * (1 - ybatch_corr[i][1]);
194 [](
auto& corr){return corr.nelem() not_eq 3;})) or ybatch_corr.
nelem() not_eq n,
195 "Bad input size, all of ybatch_corr must match ybatch and have three elements each");
198 for (
Index i=0; i<n; i++) {
199 ybatch[i] -= ybatch_corr[i][2] * (1 - ybatch_corr[i][1]);
200 ybatch[i] /= ybatch_corr[i][1];
211 y[i] = mask[i] ? std::numeric_limits<Numeric>::quiet_NaN() : y[i];
227 throw std::runtime_error(
"f_grid and y must have the same size");
231 throw std::runtime_error(
"f_grid must be sorted and ever increasing");
234 if (f_grid.
nelem() < 2) {
235 throw std::runtime_error(
"Must have at least 2 frequency grid points");
240 const Numeric DF = df > 0 ? df : 10 * (f_grid[1] - f_grid[0]);
242 if (f_grid[0] <= F0 or F0 >=
last(f_grid)) {
243 throw std::runtime_error(
"Needs F0 in the range of f_grid");
257 if (f_grid.
nelem() not_eq y.nelem()) {
258 throw std::runtime_error(
"f_grid and all of ybatch must have the same size");
263 throw std::runtime_error(
"f_grid must be sorted and ever increasing");
266 if (f_grid.
nelem() < 2) {
267 throw std::runtime_error(
"Must have at least 2 frequency grid points");
272 const Numeric DF = df > 0 ? df : 10 * (f_grid[1] - f_grid[0]);
274 if (
last(f_grid) <= F0 or f_grid[0] >= F0) {
275 throw std::runtime_error(
"Needs F0 in the range of f_grid");
TimeStep mean(const ArrayOfTimeStep &dt)
Returns the mean time step.
ArrayOfIndex time_steps(const ArrayOfTime ×, const TimeStep &DT)
Finds the index matching demands in a list of times.
TimeStep time_stepper_selection(const String &time_step)
Returns a time step from valid string.
Time mean_time(const ArrayOfTime &ts, Index s, Index E)
Computes the average time in a list.
TimeStep median(ArrayOfTimeStep dt)
Returns the median time step.
Stuff related to time in ARTS.
Array< Time > ArrayOfTime
List of times.
Index nelem() const ARTS_NOEXCEPT
Index nelem() const noexcept
Returns the number of elements.
void resize(Index n)
Resize function.
#define ARTS_USER_ERROR_IF(condition,...)
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
void yDoublingMeanFocus(Vector &f_grid, Vector &y, const Numeric &f0, const Numeric &df, const Verbosity &)
WORKSPACE METHOD: yDoublingMeanFocus.
void yColdAtmHot(Vector &y, const Vector &cold, const Vector &atm, const Vector &hot, const Numeric &cold_temp, const Numeric &hot_temp, const Index &calib, const Verbosity &)
WORKSPACE METHOD: yColdAtmHot.
void ybatchTimeAveraging(ArrayOfVector &ybatch, ArrayOfTime &sensor_time, const String &time_step, const Index &disregard_first, const Index &disregard_last, const Verbosity &)
WORKSPACE METHOD: ybatchTimeAveraging.
void ybatchDoublingMeanFocus(Vector &f_grid, ArrayOfVector &ybatch, const Numeric &f0, const Numeric &df, const Verbosity &)
WORKSPACE METHOD: ybatchDoublingMeanFocus.
void ybatchColdAtmHotAtmCycle(ArrayOfVector &ybatch, ArrayOfTime &sensor_time, const ArrayOfVector &level0_data, const ArrayOfTime &level0_time, const Vector &cold_temp, const Vector &hot_temp, const Index &first_c_index, const Verbosity &)
WORKSPACE METHOD: ybatchColdAtmHotAtmCycle.
void yMaskOutsideMedianRange(Vector &y, const Numeric &dx, const Verbosity &)
WORKSPACE METHOD: yMaskOutsideMedianRange.
void ybatchTroposphericCorrectionNaiveMedianForward(ArrayOfVector &ybatch_corr, ArrayOfVector &ybatch, const ArrayOfIndex &range, const Vector &trop_temp, const Numeric &targ_temp, const Verbosity &)
WORKSPACE METHOD: ybatchTroposphericCorrectionNaiveMedianForward.
void ybatchTroposphericCorrectionNaiveMedianInverse(ArrayOfVector &ybatch, const ArrayOfVector &ybatch_corr, const Verbosity &)
WORKSPACE METHOD: ybatchTroposphericCorrectionNaiveMedianInverse.
void ybatchMaskOutsideMedianRange(ArrayOfVector &ybatch, const Numeric &dx, const Verbosity &verbosity)
WORKSPACE METHOD: ybatchMaskOutsideMedianRange.
Numeric last(ConstVectorView x)
last
Array< Vector > ArrayOfVector
An array of vectors.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Numeric nanmedian(const ConstVectorView &v, const ArrayOfIndex &pos)
Get the median of the vector in the range ignoring all non-normal values.
VectorView nanavg(VectorView y, const ArrayOfVector &ys, const Index start, const Index end_tmp)
Compute the average of the ranged ys ignoring all non-normal values.
ArrayOfVector caha(const ArrayOfVector &data, const Vector &tcvec, const Vector &thvec, const Index first_c_index)
Calibrate the data by CAHA.
Vector systemtemp(const Vector &pc, const Vector &ph, Numeric tc, Numeric th) noexcept
Computes the linear receiver temperature formula elementwise.
Vector calibration(const Vector &pc, const Vector &pa, const Vector &ph, Numeric tc, Numeric th) noexcept
Computes the linear calibration formula elementwise.
std::vector< bool > out_of_bounds(const Vector &x, const Numeric xmin, const Numeric xmax)
Masks values that are out of bounds in x.
Vector nanfocus(const Vector &x, const ArrayOfIndex &scaling)
Returns the re-averaged values of x according to scaling ignoring all non-normal values.
ArrayOfIndex focus_doublescaling(const Vector &x, const Numeric x0, const Numeric dx)
Returns the relative position scale for each value in x.
Stuff related to generating y-data from raw data.