BirdSongToolbox.context_hand_labeling.ContextLabels

class BirdSongToolbox.context_hand_labeling.ContextLabels(bout_states: dict, bout_transitions: dict, full_bout_length: int)

Class which adds additional labels on top of the handlables to allow for flexible selection of events using context

Methods

bout_array(self, labels)

Returns an array that has 1 for every bout and a 0 for everything else for one chunk

bout_index(self, labels)

Gets the index for the labels that are the start and end of each Bout for one epoch

get_all_context_index_arrays(self, all_labels)

Get Context Arrays for all the Epoch for a day

get_context_index_array(self, labels)

Get Context array for one Epoch

motif_array(self, labels)

Returns an array that has 1 for every motif and 2 for every intra-motif silence for one chunk

__init__(self, bout_states: dict, bout_transitions: dict, full_bout_length: int)

Create Contextual Labels for the Handlabels based on the defined behavior of the birds song

Parameters
bout_statesdict

dictionary of all labels used for specified bird and their context for vocal behavior

bout_transitionsdict

dictionary of the transition label for each state (bout & not)

full_bout_lengthint

Last syllable of the stereotyped portion of the Motif (Not the Intra-Motif note)

Examples

Using behavior from subject z020:

>>> bout_states = {8:'not', 'I':'not','C':'not', 1:'bout',2:'bout',3:'bout',4:'bout',5:'bout',6:'bout',7:'bout'}
>>> bout_transitions = {'not':1,'bout':8}
>>> bout_syll_length = 4
>>> testclass = ContextLabels(bout_states, bout_transitions, bout_syll_length)

Methods

__init__(self, bout_states, …)

Create Contextual Labels for the Handlabels based on the defined behavior of the birds song

bout_array(self, labels)

Returns an array that has 1 for every bout and a 0 for everything else for one chunk

bout_index(self, labels)

Gets the index for the labels that are the start and end of each Bout for one epoch

get_all_context_index_arrays(self, all_labels)

Get Context Arrays for all the Epoch for a day

get_context_index_array(self, labels)

Get Context array for one Epoch

motif_array(self, labels)

Returns an array that has 1 for every motif and 2 for every intra-motif silence for one chunk

bout_array(self, labels: list)

Returns an array that has 1 for every bout and a 0 for everything else for one chunk

Parameters
labelslist | [Labels]

list of all labels for one Epoch

Returns
bout_resultslist

Array that encodes each label as either bout or not bout using 1 or 0, respectively.

bout_index(self, labels: list)

Gets the index for the labels that are the start and end of each Bout for one epoch

Parameters
labelslist | [Labels]

list of all labels for one Epoch

Returns
startslist

List of all Start Times corresponding to each motif in one chunk

endslist

List of all End Times corresponding to each motif in one chunk

get_all_context_index_arrays(self, all_labels: list)

Get Context Arrays for all the Epoch for a day

Parameters
all_labelslist | [Labels]

list of all labels for one Epoch

Returns
motif_array_listlist

list of arrays of context labels for each Epoch. [Epoch #] -> (labels, 4)

col: (Motif Sequence in Bout, First Motif (1-hot), Last Motif (1-hot), Last Syllable Dropped (1-hot))

get_context_index_array(self, labels: list)

Get Context array for one Epoch

Parameters
labelslist | [Labels]

list of all labels for one Epoch

Returns
motif_arrayarray

Array of context labels for one Epoch. columns: (Motif Sequence in Bout, First Motif (1-hot), Last Motif (1-hot), Last Syllable Dropped (1-hot))

motif_array(self, labels: list)

Returns an array that has 1 for every motif and 2 for every intra-motif silence for one chunk

Parameters
labelslist | [Labels]

list of all labels for one Epoch

Returns
motif_resultsndarray

array that segments motifs using both the labels and the initialized parameters for the bird’s song structure

Examples using BirdSongToolbox.context_hand_labeling.ContextLabels