bio_rtd.utils.vectors

Helper functions for vector operations.

true_start

bio_rtd.utils.vectors.true_start(boolean_vector)[source]

Accepts array of booleans and returns index of first True.

Parameters

boolean_vector (ndarray) – Boolean vector. It must contain at least one True value.

Returns

Index for first True value in boolean_vector.

Return type

int

Raises

ValueError – If all values in boolean_vector are False.

true_end

bio_rtd.utils.vectors.true_end(boolean_vector)[source]

Accepts array of booleans and returns index AFTER last True.

Parameters

boolean_vector (ndarray) – Boolean vector. It must contain at least one True value.

Returns

Index AFTER last True value in boolean_vector.

Return type

int

Raises

ValueError – If all values in boolean_vector are False.

true_start_and_end

bio_rtd.utils.vectors.true_start_and_end(boolean_vector)[source]

Returns indexes of first True value and AFTER last True value.

Parameters

boolean_vector (ndarray) – Boolean vector. It must contain at least one True value.

Return type

Tuple[int, int]

Returns

  • index_of_first_true – Index of first True value in boolean_vector.

  • index_after_last_true – Index AFTER last True value in boolean_vector.

Raises

ValueError – If all values in boolean_vector are False.