src.features package#

Submodules#

src.features.extract_features module#

src.features.features_utils module#

Utility classes, functions, and variables used in the feature extraction process

class src.features.features_utils.BaseExtractor#

Bases: object

Base feature extraction class, with some methods that are useful for all classes

static count_nonzero(x) int#

Simple wrapper around np.count_nonzero that removes NaN values from an array

static get_between(arr, i1, i2) array#

From an array arr, get all onsets between an upper and lower bound i1 and i2 respectively

static quantile25(x) float#

Simple wrapper around np.nanquantile with arguments set

static quantile75(x) float#

Simple wrapper around np.nanquantile with arguments set

static truncate_df(arr: DataFrame | Series, low: float, high: float, col: str | None = None, fill_nans: bool = False) DataFrame#

Truncate a dataframe or series between a low and high threshold.

Args:

arr (pd.DataFrame | pd.Series): dataframe to truncate low (float): lower boundary for truncating high (float): upper boundary for truncating. Must be greater than low. col (str): array to use when truncating. Must be provided if isinstance(arr, pd.DataFrame) fill_nans (bool, optional): whether to replace values outside low and high with np.nan

Raises:

AssertionError: if high < low

Returns:

pd.DataFrame

update_summary_dict(array_names, arrays, *args, **kwargs) None#

Update our summary dictionary with values from this feature. Can be overridden!

src.features.simulations_utils module#

Classes used for creating ensemble coordination simulations from the phase correction model

class src.features.simulations_utils.Simulation(params_dict, n_beats: int = 100, tempo: int = 120)#

Bases: object

Creates a single simulated performance with given params_dict

static _format_dict(python_dict: dict) Dict#

Converts a Python dictionary into a type that can be utilised by Numba

_get_async_cls() Asynchrony#

Gets all src.features.features_utils.Asynchrony classes for all instruments

_get_async_rms() float#

Gets root-mean-square of all pairwise asynchrony values

_get_bpm_values()#

Gets beats-per-minute values from the simulation dataframe

_get_initial_data(init_instr: str) Dict#

Gets initial starter data for use when creating the simulation

static _simulation_dispatcher(data_: tuple, params_: tuple) tuple#

Creates one simulated performance, optimized with numba

run_simulation()#

Dispatcher function for a single simulation

starting_onset = 0#
class src.features.simulations_utils.SimulationManager(coupling_params, tempo: int = 120, n_sims: int = 500, n_beats: int = 100, n_jobs: int = -1)#

Bases: object

Manager for creating and handling multiple Simulation instances.

backend = 'threads'#
get_mean_bpm() Series#

Returns average BPM value of all simulations in this simulation manager

get_mean_rms() float#

Returns average RMS asynchrony value from all simulations in this simulation manager

get_rms_values() array#

Returns all RMS asynchrony values from all simulations in this simulation manager

run_simulations()#

Runs all simulations and returns the SimulationManager instance

verbosity = 5#

Module contents#