Function linear_or_log (o2scl)¶
-
template<class vec_t, class vec2_t>
void o2scl::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.This uses the linear_or_log_chi2() function to determine whether a log of x ore y improves the fit to the line \( y=x \).
Note
Experimental.
Note
The two vectors, x and y, must have the same size, as reported by their
size()
method.
-
template<class vec_t>
void o2scl::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.