Functions linear_or_log¶
-
template<class
vec_t
, classvec2_t
>
voido2scl
::
linear_or_log
(vec_t &x, vec2_t &y, bool &log_x, bool &log_y)¶ Attempt to determine if data represented by two arrays, (x,y), would be better plotted on a linear, semi-log, or log-log plot.
This function attempts to guess whether the data stored in
x
andy
might be best plotted on a log scale. This algorithm will fail for poorly sampled or highly oscillatory data.- Note
Experimental.
This uses the linear_log_chi2() function to determine whether a log of x ore y improves the fit to the line
\( y=x \).- Note
The two vectors, x and y, must have the same size, as reported by their
size()
method.
-
template<class
vec_t
>
voido2scl
::
linear_or_log
(vec_t &y, bool &log_y)¶ Attempt to determine if data stored in
y
is more nearly linear or logarithmic.- Idea for Future:
There is a bit of extra calculation because the rebin function creates a new x vector with a uniform grid, so this could be streamlined.
- Note
Experimental.