piogrowth.fit_spline module#

class piogrowth.fit_spline.SmoothingRange(s_min, s, s_max)#

Bases: tuple

s#

Alias for field number 1

s_max#

Alias for field number 2

s_min#

Alias for field number 0

piogrowth.fit_spline.fit_growth_data_w_peaks(df_wide: DataFrame, peaks: DataFrame, smoothing_factor: float = 100.0) tuple[DataFrame, DataFrame][source]#

Fit growth data with splines between detected peaks.

piogrowth.fit_spline.fit_spline_and_derivatives(s: Series, smoothing_factor: float = 1000.0) tuple[DataFrame, DataFrame][source]#

Fit B-splines to each column in the DataFrame and compute specified derivatives. Values cannot be missing as NaNs, i.e. on rolling median of data.

Parameters:
  • s (pd.Series) – Input Series with time series data

  • smoothing_factor (float) – Smoothing factor for the spline fitting.

  • Returns

    dict[str, pd.DataFrame]: Dictionary containing the fitted spline

    and its derivatives.

piogrowth.fit_spline.fit_spline_and_derivatives_one_batch(df: DataFrame, smoothing_factor: float = 1000.0) tuple[DataFrame, DataFrame][source]#

Fit B-splines to each column in the DataFrame and compute specified derivatives. Values cannot be missing as NaNs, i.e. on rolling median of data.

Parameters:
  • df (pd.DataFrame) – Input DataFrame with time series data.

  • smoothing_factor (float) – Smoothing factor for the spline fitting.

  • Returns

    tuple[pd.DataFrame, pd.DataFrame]: Tuple containing the fitted spline

    and its first derivative.

piogrowth.fit_spline.fit_splines_to_segments(s: Series, peaks: Series, smoothing_factor: float = 100.0) tuple[DataFrame, DataFrame][source]#

Fit splines to segments of the time series data between detected peaks.

Parameters:
  • s (pd.Series) – _description_

  • peaks (pd.Series) – _description_

  • smoothing_factor (float, optional) – _description_, by default 100.0

Returns:

_description_

Return type:

tuple[pd.DataFrame, pd.DataFrame]

piogrowth.fit_spline.get_smoothing_range(m: int)[source]#

Compute the smoothing range for B-spline fitting in scipy interpolate functionality.