Utilities

Utilities module within the ketos library

This module provides a number of auxiliary methods.

complex_value(mag, angle)

Computes complex value from magnitude and phase angle.

detect_peaks(df[, distance, multiplicity, ...])

Detect peaks in time-series data.

ensure_dir(file_path)

Ensure that destination directory exists.

factors(n)

Returns sorted set of all divisors of n

get_member(cls, member_name)

Query class member by name.

morlet_func(time, frequency, width, displacement)

Compute Morlet wavelet function

ndim(a)

Returns the number of dimensions of a list/tuple/array.

nearest_values(x, i, n)

Returns the n values nearest to index i from the array x.

octave_bands([band_min, band_max])

Compute the min, central, and max frequency value of the specified octave bands, using the following formulas,

octave_bands_json(band_min, band_max)

Produce a string of the specified octave bands in json format

random_floats([size, low, high, seed])

Returns a random number or numpy array of randum numbers uniformly distributed in the half-open interval [low, high)

signif(x, p)

Round to a specified number of significant digits.

str_is_int(s[, signed])

Check if a given string represents a (signed) integer.

tostring(box[, decimals])

Convert an array, tuple or list into a string.

ceil(a[, decimals])

This function adds the ability to ceil to a decimal precision instead of to the nearest integer.

floor(a[, decimals])

This function adds the ability to floor to a decimal precision instead of to the nearest integer.

ceil_round_down(a[, decimals])

Provides a convenient way to use ceil while specifying a decimal precision to floor instead This helps deal with imprecision of finite number of floating points arithmetics

floor_round_up(a[, decimals])

Provides a convenient way to use floor while specifying a decimal precision to ceil instead This helps deal with imprecision of finite number of floating points arithmetics