BaseSequence#

BaseSequence is the parent class of the Sequence, Rhythm, and SoundSequence classes.

class thebeat.core.BaseSequence(iois, first_onset=0.0, end_with_interval=False, name=None)[source]#

This is the most basic of classes that the Sequence, Rhythm, and SoundSequence classes inherit from. It cannot do many things, apart from holding a number of inter-onset intervals (IOIs).

The BaseSequence class dictates that a sequence can either end with an interval or not. The default is to end with an event, meaning that if there are n onset values (i.e. t values), there are n-1 IOIs. This is what people will need in most cases. Sequences that end with an interval have an IOI at the end (so they end with a gap of silence). This is what you will need in cases with e.g. rhythmical/musical sequences.

The BaseSequence class protects against impossible values for the IOIs, as well as for the event onsets (t values).

iois#

Contains the inter-onset intervals (IOIs). This is the bread and butter of the BaseSequence class. Sequences that end with an event have n onsets and n-1 IOIs. Sequences that end with an interval have an equal number of IOIs and onsets.

Type:

NumPy 1-D array

end_with_interval#

If False, sequence has n-1 inter-onset intervals (IOIs) for n event onsets. If True, sequence has an equal number of IOIs and event onsets.

Type:

bool

name#

If desired, one can give the object a name. This is for instance used when printing the sequence, or when plotting the sequence. It can always be retrieved and changed via this attribute.

Type:

str

__init__(iois, first_onset=0.0, end_with_interval=False, name=None)[source]#

Initialization of BaseSequence class.

copy(deep=True)[source]#

Returns a copy of itself. See copy.copy() for more information.

Parameters:

deep (bool, default: True) – If True, a deep copy is returned. If False, a shallow copy is returned.

property duration: float64#

Property that returns the summed total of the inter-onset intervals.

property iois: ndarray#
property mean_ioi: float64#

The average inter-onset interval (IOI).

property onsets: ndarray#

Returns the event onsets (t values) on the basis of the sequence objects’ inter-onset intervals (IOIs).