grapa.shared.maths

Functions dealing with math

@author: Romain Carron Copyright (c) 2026, Empa, Laboratory for Thin Films and Photovoltaics, Romain Carron

Functions

derivative(x, y)

numerical derivative dy/dx for the x and y datapoint series.

derivative2nd(x, y)

Second numerical derivative d2y/dx2 for the x and y datapoint series.

find_nearest(array, value)

Finds in array the value nearest to value.

fractionstr_to_float(frac_str)

Returns a numeric value for floats, or fractions in the form '2/5'

is_number(s)

Returns True is s can be converted to a float.

roundSignificant(series, n_digits)

Rounds the values in series to n_digits significant digits.

roundSignificantRange(series, n_digits)

Rounds the values in series to n_digits significant digits

roundgraphlim(lim)

Returns rounded graph limits.

smooth(x[, window_len, window])

smooth the data using a window with requested size.

trapz(y, x, *args)

At some point numpy changed the function name for its trapz function

xAtValue(x_series, y_series, value[, ...])

Returns the x value where y_series crosses value.

Classes

MathOperator()

To help write nicer code when dealing with math operations on Curves