ARTS 2.5.11 (git: 6827797f)
|
Stuff related to time in ARTS. More...
#include <chrono>
#include <cmath>
#include <string_view>
#include "array.h"
#include "debug.h"
#include "matpack_data.h"
#include "mystring.h"
Go to the source code of this file.
Classes | |
struct | Time |
Class to handle time in ARTS. More... | |
struct | DebugTime |
Used to debug execution time, prints msg+time on destruction to std::cerr. More... | |
Typedefs | |
using | TimeStep = std::chrono::duration< Numeric > |
A duration of time, 1 full tick should be 1 second. | |
using | ArrayOfTime = Array< Time > |
List of times. | |
using | ArrayOfArrayOfTime = Array< ArrayOfTime > |
List of times. | |
using | ArrayOfTimeStep = Array< TimeStep > |
List of time steps. | |
Functions | |
std::ostream & | operator<< (std::ostream &os, const TimeStep &dt) |
Debug output for duration. | |
TimeStep | time_stepper_selection (const String &time_step) |
Returns a time step from valid string. | |
Time | next_even (const Time &t, const TimeStep &dt) |
Returns the next time after t with an even time-step. | |
ArrayOfIndex | time_steps (const ArrayOfTime ×, const TimeStep &dt) |
Finds the index matching demands in a list of times. | |
Time | mean_time (const ArrayOfTime &ts, Index s=0, Index e=-1) |
Computes the average time in a list. | |
Vector | time_vector (const ArrayOfTime ×) |
Converts from each Time to seconds and returns as Vector. | |
ArrayOfTime | time_vector (const Vector ×) |
Converts from each Vector entry by seconds and returns as ArrayOfTime. | |
TimeStep | median (ArrayOfTimeStep) |
Returns the median time step. | |
TimeStep | mean (const ArrayOfTimeStep &) |
Returns the mean time step. | |
using ArrayOfArrayOfTime = Array<ArrayOfTime> |
List of times.
Definition at line 125 of file artstime.h.
using ArrayOfTime = Array<Time> |
List of times.
Definition at line 122 of file artstime.h.
using ArrayOfTimeStep = Array<TimeStep> |
List of time steps.
Definition at line 128 of file artstime.h.
using TimeStep = std::chrono::duration<Numeric> |
A duration of time, 1 full tick should be 1 second.
Definition at line 22 of file artstime.h.
TimeStep mean | ( | const ArrayOfTimeStep & | dt | ) |
Returns the mean time step.
[in] | times | Times |
Definition at line 172 of file artstime.cc.
Referenced by Raw::Reduce::focus(), NumericFromVector(), polynomial_basis_func(), Minimize::T4::x0(), Minimize::DPL::x0(), ybatchDoublingMeanFocus(), and yDoublingMeanFocus().
Time mean_time | ( | const ArrayOfTime & | ts, |
Index | s = 0 , |
||
Index | e = -1 |
||
) |
Computes the average time in a list.
[in] | ts | A list of time |
[in] | s | A starting index; valid range [0, ts.nelem()) |
[in] | e | The end+1 index; valid range [-1, ts.nelem()]; -1 is treated as ts.nelem() |
Definition at line 133 of file artstime.cc.
References ARTS_USER_ERROR_IF, and Array< base >::nelem().
Referenced by ybatchTimeAveraging().
TimeStep median | ( | ArrayOfTimeStep | dt | ) |
Returns the median time step.
Takes vector by copy to sort
[in] | times | Times |
Definition at line 161 of file artstime.cc.
Referenced by yMaskOutsideMedianRange().
Returns the next time after t with an even time-step.
[in] | t | A time |
[in] | dt | A duration of time |
Definition at line 50 of file artstime.cc.
References Time::EpochTime().
Referenced by time_steps().
std::ostream & operator<< | ( | std::ostream & | os, |
const TimeStep & | dt | ||
) |
Debug output for duration.
Definition at line 181 of file artstime.cc.
Returns a time step from valid string.
The string should look like: "X type". where X is parsed as a double and where valid string type(s) are: "hour", "hours", "h": Returns a X hour time step "minute", "minutes", "min": Returns a X minute time step "second", "seconds", "s": Returns a X seconds time step
[in] | time_step | A time step of format "X type" |
Definition at line 19 of file artstime.cc.
References check_enum_error(), and my_basic_string< charT >::tolower().
Referenced by ybatchTimeAveraging().
ArrayOfIndex time_steps | ( | const ArrayOfTime & | times, |
const TimeStep & | dt | ||
) |
Finds the index matching demands in a list of times.
The first index is 0 and the second index is the start of the first even period of the given stepsize
The last index is times.nelem(). If output has 1 element, no range was found matching the criteria.
[in] | times | Times sorted in ascending order |
[in] | dt | A duration of time |
Definition at line 59 of file artstime.cc.
References ARTS_USER_ERROR_IF, Array< base >::nelem(), next_even(), and time_steps().
Referenced by time_steps(), and ybatchTimeAveraging().
Vector time_vector | ( | const ArrayOfTime & | times | ) |
Converts from each Time to seconds and returns as Vector.
[in] | times | Times |
Definition at line 149 of file artstime.cc.
References Array< base >::nelem().
Referenced by jacobianCalcPointingZaInterp(), jacobianCalcPointingZaRecalc(), and x2artsSensor().
ArrayOfTime time_vector | ( | const Vector & | times | ) |
Converts from each Vector entry by seconds and returns as ArrayOfTime.
[in] | times | Times |
Definition at line 155 of file artstime.cc.