extract

This module implements some common functions to extract the outputs of the IDyOM model.

For more concrete examples on extracting data, please see the tutorial.

class py2lispIDyOM.extract.ExperimentInfo(experiment_folder_path)[source]

An experiment object that contains all data in a single experiment.

Parameters:

experiment_folder_path (str) – the path to experiment log folder which you want to access.

access_melodies(starting_index=None, ending_index=None, melody_names=None)[source]

Access specific melodies by index or melody names. If all arguments are None, then the default is to access all melodies in the Experiment class

Parameters:
  • starting_index (int) – the index of the melody you want to start accessing

  • ending_index (int) – the index of the melody you want to end accessing

  • melody_names (list(str)) – list of meldoy names you want to access

Returns:

a list of MelodyInfo class objects (selected melodies)

Return type:

list(MelodyInfo)

melody_dictionary()[source]

Get a dictionary of all melodies in the experiment with melody name as the key and all melody info as the value.

Returns:

a dictionary consisting of:

  • melody_name: the name of the melody

  • MelodyInfo: a MelodyInfo class containing all IDyOM output data of the melody

Return type:

typed dict -> {melody_name: MelodyInfo}

class py2lispIDyOM.extract.MelodyInfo(exp_pitch_element_list, parent_experiment, *args, **kw)[source]

A melody object (pd.DataFrame) that contains all data in a single melody inherit from the parent Experiment.

access_idyom_output_keywords(output_keywords)[source]

Access certain idyom output(s) via its (their) keyword(s).

Parameters:

output_keywords (List[str]) – A list of IDyOM output keywords (e.g., [‘cpitch.information.content’, ‘onset’, ‘entropy’])

Returns:

a dataframe containing all data of the selected IDyOM outputs according to the specified keywords.

Return type:

pd.DataFrame

compute_properties_means(idyom_outputs)[source]

Compute the mean values of the idyom outputs.

Parameters:

idyom_outputs (List[str]) – list of idyom output keyword to compute the means

Type:

List[str]

Returns:

the mean values of selected idyom outputs

Return type:

DataFrame

get_idyom_output_keyword_list()[source]

Get a list of available IDyOM output keyword for this melody.

Returns:

a list of available IDyOM output keyword

Return type:

list(str)

get_idyom_output_nparray(idyom_output_key)[source]

Get the IDyOM output via its key as a np.array

Parameters:

idyom_output_key (str) – list of str

Returns:

an array of the specified output values

Return type:

np.array