get_poly_region module

Methods for finding points and regions in vectors.

DMT.extraction.get_poly_region.get_poly_region(x_vals, y_vals, x_range, degree, r_ov_ymax, sort=False)[source]

Enlarge the x_range as long as the linear fit for this range is still “good enough”

Parameters:
x_vals, y_valsarray
x_range(float, float)

Range inside x_vals, in this region the region will be searched

degreeint

Degree of polynomial fit. If a constant region is searched use 0, for a linear use 1.

r_ov_ymaxfloat

Maximum for the relative conditional number for the polyfit iteration.

sort{False, True}, optional

If true, x_vals and y_vals are sorted before smoothing spline.

Returns
——–
poly_finalndarray

Final polynomial coefficients for the fit

(x_lower, x_upper)tuple

Lower and upper borders of the polynomial region