42 throw std::runtime_error(
"Length of vectors must be correct");
48 y[
i] =
calibration(cold[
i], atm[i], hot[i], cold_temp, hot_temp);
63 const Index& disregard_first,
64 const Index& disregard_last,
69 if (time_grid.
nelem() not_eq
n) {
70 throw std::runtime_error(
"Time vector length must match input data length");
75 throw std::runtime_error(
"Time vector cannot decrease");
84 if (lims.front() ==
n) {
86 time_grid_out.resize(0);
87 covmat_sepsbatch.resize(0);
93 if (not std::all_of(ybatch.cbegin(), ybatch.cend(), [k](
auto& x){
return x.
nelem() == k;})) {
94 throw std::runtime_error(
"Bad frequency grid size in input data; expects all equal");
98 const Index m = lims.nelem() - 1;
100 throw std::runtime_error(
"Must include last if time step covers all of the range");
107 #pragma omp parallel for if (not arts_omp_in_parallel()) schedule(guided) 109 counts[
i] = lims[
i+1] - lims[
i];
110 time_grid_out[
i] =
mean_time(time_grid, lims[
i], lims[i+1]);
111 linalg::avg(ybatch_out[i], ybatch, lims[i], lims[i+1]);
112 linalg::cov(covmat_sepsbatch[i], ybatch_out[i], ybatch, lims[i], lims[i+1]);
116 if (disregard_first) {
117 counts.erase(counts.begin());
118 ybatch_out.erase(ybatch_out.begin());
119 time_grid_out.erase(time_grid_out.begin());
120 covmat_sepsbatch.erase(covmat_sepsbatch.begin());
123 if (disregard_last) {
125 ybatch_out.pop_back();
126 time_grid_out.pop_back();
127 covmat_sepsbatch.pop_back();
131 time_grid = time_grid_out;
146 if (std::any_of(ybatch.begin(), ybatch.end(), [m](
auto& y){
return y.
nelem() not_eq m;})) {
147 throw std::runtime_error(
"Bad input size, all of ybatch must match itself");
148 }
else if (trop_temp.
nelem() not_eq
n) {
149 throw std::runtime_error(
"Bad input size, trop_temp must match ybatch");
157 ybatch_corr[
i][2] = trop_temp[
i];
159 ybatch_corr[
i][1] = std::exp(- std::log((ybatch_corr[i][2] - ybatch_corr[i][0]) / (ybatch_corr[i][2] - targ_temp)));
164 ybatch[
i] *= ybatch_corr[
i][1];
165 ybatch[
i] += ybatch_corr[
i][2] * (1 - ybatch_corr[
i][1]);
176 if ((std::any_of(ybatch_corr.begin(), ybatch_corr.end(), [](
auto& corr){
return corr.
nelem() not_eq 3;})) or ybatch_corr.
nelem() not_eq
n) {
177 throw std::runtime_error(
"Bad input size, all of ybatch_corr must match ybatch and have three elements each");
182 ybatch[
i] -= ybatch_corr[
i][2] * (1 - ybatch_corr[
i][1]);
183 ybatch[
i] /= ybatch_corr[
i][1];
INDEX Index
The type to use for all integer numbers and indices.
void ybatchTroposphericCorrectionNaiveMedianInverse(ArrayOfVector &ybatch, const ArrayOfVector &ybatch_corr, const Verbosity &)
WORKSPACE METHOD: ybatchTroposphericCorrectionNaiveMedianInverse.
Index nelem() const
Number of elements.
void avg(VectorView y, const ArrayOfVector &ys, const Index start=0, const Index end=-1)
Compute the average of the ranged ys.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
Index nelem() const
Returns the number of elements.
Array< Vector > ArrayOfVector
An array of vectors.
void cov(MatrixView cov, const Vector &y, const ArrayOfVector &ys, const Index start=0, const Index end=-1)
Compute the covariance matrix of the ranged ys.
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.
bool is_sorted(ConstVectorView x)
Checks if a vector is sorted in ascending order.
Stuff related to generating y-data from raw data.
Time mean_time(const ArrayOfTime &ts, Index s, Index e)
Computes the average time in a list.
NUMERIC Numeric
The type to use for all floating point numbers.
void ybatchTroposphericCorrectionNaiveMedianForward(ArrayOfVector &ybatch_corr, ArrayOfVector &ybatch, const ArrayOfIndex &range, const Vector &trop_temp, const Numeric &targ_temp, const Verbosity &)
WORKSPACE METHOD: ybatchTroposphericCorrectionNaiveMedianForward.
Array< Matrix > ArrayOfMatrix
An array of matrices.
constexpr Numeric calibration(Numeric pc, Numeric pa, Numeric ph, Numeric tc, Numeric th) noexcept
Computes the linear calibration formula.
Array< Time > ArrayOfTime
List of times.
Stuff related to time in ARTS.
void resize(Index n)
Resize function.
constexpr Numeric systemtemp(Numeric pc, Numeric ph, Numeric tc, Numeric th) noexcept
Computes the linear receiver temperature formula.
ArrayOfIndex time_steps(const ArrayOfTime ×, const String &step)
Finds the index matching demands in a list of times.
invlib::Matrix< ArtsMatrix > Matrix
invlib wrapper type for ARTS matrices.
void ybatchTimeAveraging(ArrayOfVector &ybatch, ArrayOfTime &time_grid, ArrayOfMatrix &covmat_sepsbatch, ArrayOfIndex &counts, const String &time_step, const Index &disregard_first, const Index &disregard_last, const Verbosity &)
WORKSPACE METHOD: ybatchTimeAveraging.
Numeric median(const ConstVectorView v, const ArrayOfIndex &pos=ArrayOfIndex{})
Get the median of the vector in the range.