bletl.features

class bletl.features.BSFeatureExtractor

Bases: Extractor

Class for feature extraction of backscatter.

Methods

extract_inflection_point_t(x, y)

Extracts value at the turning point.

extract_inflection_point_y(x, y)

Extracts time at the turning point.

extract_mue_median(x, y)

Extracts median of mue at the exponential phase.

get_methods()

Returns the extration methods by name.

extract_inflection_point_t(x, y)

Extracts value at the turning point.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

turning point

extract_inflection_point_y(x, y)

Extracts time at the turning point.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

time of turning point

extract_mue_median(x, y)

Extracts median of mue at the exponential phase.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

median

class bletl.features.DOFeatureExtractor

Bases: Extractor

Class for feature extraction of dissolved oxygen

Methods

extract_peak(x, y)

Extracts the duration of DO < 5

get_methods()

Returns the extration methods by name.

extract_peak(x, y)

Extracts the duration of DO < 5

Returns:
resultfloat

duration of DO < 5

class bletl.features.Extractor

Bases: ABC

Common base class for all feature extractors.

Methods

get_methods()

Returns the extration methods by name.

get_methods() Dict[str, Callable[[ndarray, ndarray], float]]

Returns the extration methods by name.

All classmethods that are named extract_* are considered feature extration methods.

Returns:
methodsdict

dictionary of { name : callable }

class bletl.features.StatisticalFeatureExtractor

Bases: Extractor

Class for statistical feature extraction.

Methods

extract_max(x, y)

Extracts the maximum of y.

extract_mean(x, y)

Extracts the mean of y.

extract_median(x, y)

Extracts the median of y.

extract_min(x, y)

Extracts the minimum of y.

extract_span(x, y)

Extracts the span between minimum and maximum.

extract_stan_dev(x, y)

Extracts the standard deviation of y.

extract_time_max(x, y)

Extracts the time at the maximum of y.

extract_time_min(x, y)

Extracts the time at the minimum of y.

get_methods()

Returns the extration methods by name.

extract_max(x, y)

Extracts the maximum of y.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

maximum

extract_mean(x, y)

Extracts the mean of y.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

mean

extract_median(x, y)

Extracts the median of y.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

median

extract_min(x, y)

Extracts the minimum of y.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

minimum

extract_span(x, y)

Extracts the span between minimum and maximum.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

span

extract_stan_dev(x, y)

Extracts the standard deviation of y.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

standard deviation

extract_time_max(x, y)

Extracts the time at the maximum of y.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

time at the maximum

extract_time_min(x, y)

Extracts the time at the minimum of y.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

time at the minimum

class bletl.features.TSFreshExtractor(**kwargs)

Bases: object

Class for feature extraction with tsfresh.

bletl.features.from_bldata(bldata: BLData, extractors: Dict[str, Sequence[Extractor]], last_cycles: Dict[str, int] | None = None, *, take_wells: Iterable[str] | None = None) DataFrame

Apply feature extractors to a dataset.

Parameters:
dataBLData

a dataset to extract from

extractorsdict

map of { filterset : [extractor, …] }

last_cyclesoptional, dict

maps well ids to the number of the last cycle to consider

take_wellsiterable

List or set of wells that should be extracted from. This should be used to remove wells that are sampled too early to have meaningful time series features.

Returns:
resultpandas.DataFrame

well-indexed features

class bletl.features.pHFeatureExtractor

Bases: Extractor

Class for feature extraction of pH.

Methods

extract_sum_of_increase(x, y)

Extracts sum of increase.

extract_sum_of_reduction(x, y)

Extracts sum of reduction.

get_methods()

Returns the extration methods by name.

extract_sum_of_increase(x, y)

Extracts sum of increase.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

sum of increase

extract_sum_of_reduction(x, y)

Extracts sum of reduction.

Parameters:
xnumpy.ndarray

list of time values

ynumpy.ndarray

list of values

Returns:
resultfloat

sum of reduction