Math

Math helper functions.

syris.math.closest(values, min_value)

Get the minimum greater value greater than min_value from values.

syris.math.difference_root(x_0, tck, y_d)

Given a function f(x) = y, find x_1 for which holds |f(x_1) - f(x_0)| = y_d. x_0 is the starting x_0 and f(x) is defined by spline coefficients tck.

syris.math.fftfreq(n, pixel_size)

Compute spatial frequencies for a 2D grid (n, n) with spacing pixel_size. Returns spatial frequencies f as (f_y, f_x).

syris.math.fwnm_to_sigma(fwnm, n=2)

Return Gaussian sigma from full width at n-th maximum fwnm.

syris.math.get_surrounding_points(points, threshold)

Get the closest points around a threshold from both sides, left and right. If one of the sides is empty than None is returned on its place.

syris.math.infimum(x_0, data)

Return the greatest point from data which is less than x_0.

syris.math.match_range(x_points, y_points, x_target)

Match the curve f(x) = y to x_target points by interpolation of x_points and y_points.

syris.math.sigma_to_fwnm(sigma, n=2)

Return Gaussian full width at n-th maximum given by sigma and n.

syris.math.supremum(x_0, data)

Return the smallest point from data which is greater than x_0.