visualization

This module implements some common plotting functions to visualize the output data. For more examples on visualizing the outputs, please see the tutorial.

In the current version, only limited basic plots are available. The following types of basic plots are the ones we find helpful for analysis:

  • simple_plot

  • selected_surprisal_entropy

  • all_surprisal

  • all_entropy

  • pianoroll_pitch_prediction_groundtruth

  • pianoroll_groundtruth_overall_surprisal

You are welcome to contribute or make your own figs.

class py2lispIDyOM.viz.BasicPlot[source]

BasicPlot for selected IDyOM outputs in an experiment.

static all_entropy(experiment_folder_path, melody_names=None, starting_index=None, ending_index=None, savefig=True, showfig=False, fig_format='png', dpi=400, figsize=(10, 8), grid=True, ggplot=True)[source]

Generate subplots that show all available entropy outputs.

Parameters:
  • experiment_folder_path (str) – the path to your experiment folder.

  • melody_names (Optional[List[str]]) – if not supplied by the users, default is all test melodies in the experiment.

  • starting_index (Optional[int]) – the index of the melody in the melody list that you want to start plotting.

  • ending_index (Optional[int]) – the index of the melody in the melody list that you want to stop plotting.

  • savefig (bool) –

  • showfig (bool) –

  • fig_format (str) – default = ‘png

  • dpi (float) – default = 400

  • figsize (tuple) – default is (10,5)

  • grid (bool) – whether to show grid or not.

  • ggplot (bool) – whether to use ggplot or not.

static all_surprisal(experiment_folder_path, melody_names=None, starting_index=None, ending_index=None, savefig=True, showfig=False, fig_format='png', dpi=400, figsize=(10, 8), grid=True, ggplot=True)[source]

Generate subplots of all available surprisal outputs.

Parameters:
  • experiment_folder_path (str) – the path to your experiment folder.

  • melody_names (Optional[List[str]]) – if not supplied by the users, default is all test melodies in the experiment.

  • starting_index (Optional[int]) – the index of the melody in the melody list that you want to start plotting.

  • ending_index (Optional[int]) – the index of the melody in the melody list that you want to stop plotting.

  • savefig (bool) –

  • showfig (bool) –

  • fig_format (str) – default = ‘png

  • dpi (float) – default = 400

  • figsize (tuple) – default is (10,5)

  • grid (bool) – whether to show grid or not.

  • ggplot (bool) – whether to use ggplot or not.

static pianoroll_groundtruth_overall_surprisal(experiment_folder_path, melody_names=None, starting_index=None, ending_index=None, savefig=True, showfig=False, fig_format='png', dpi=400, figsize=(10, 6))[source]

Generate a pair of figures: ground truth piano roll on the top and the surprisal line plot on the bottom.

Parameters:
  • experiment_folder_path (str) – the path to your experiment folder.

  • melody_names (Optional[List[str]]) – (optional), if not supplied by the users, default is all test melodies in the experiment.

  • starting_index (Optional[int]) – (optional),the index of the melody in the melody list that you want to start plotting.

  • ending_index (Optional[int]) – (optional), the index of the melody in the melody list that you want to stop plotting.

  • savefig (bool) – (optional)

  • showfig (bool) – (optional)

  • fig_format (str) – (optional), default = ‘png’

  • dpi (float) – (optional), default = 400

  • figsize (tuple) – (optional), default is (10,5)

static pianoroll_pitch_prediction_groundtruth(experiment_folder_path, melody_names=None, starting_index=None, ending_index=None, savefig=True, showfig=False, fig_format='png', dpi=400, figsize=(10, 10), nrows=2, ncols=1, probability_colorbar=False)[source]

Generate a pair of figures (the predicted pitch distribution and the ground truth) side by side. If users intend to plot figures for specific songs, they can do so by specifying either the melody names, or the starting/ending index in the melody list.

Parameters:
  • experiment_folder_path (str) – The path to your experiment folder.

  • melody_names (Optional[List[str]]) – (optional), if not supplied by the users, default is all test melodies in the experiment.

  • starting_index (Optional[int]) – (optional), the index of the melody in the melody list that you want to start plotting.

  • ending_index (Optional[int]) – (optional), the index of the melody in the melody list that you want to stop plotting.

  • savefig (bool) – (optional)

  • showfig (bool) – (optional)

  • fig_format (str) – (optional), default = ‘png

  • dpi (float) – (optional), default = 400

  • figsize (tuple) – (optional), default is (10,5)

  • ncols (int) – (optional), the number of columns of the figure. By default, ncols = 2, nrows = 1, figures are shown side-by-side.

  • nrows (int) – (optional), the number of columns of the figure. By default, ncols = 2, nrows = 1, figures are shown side-by-side.

  • probability_colorbar (bool) – (optional) whether to show the color bar for the probabilities of the predict pitch or not.

static selected_surprisal_entropy(experiment_folder_path, ic_source, entropy_source, melody_names=None, starting_index=None, ending_index=None, savefig=True, showfig=False, fig_format='png', dpi=400, figsize=(10, 6), grid=True, ggplot=True)[source]

Generate a figure that shows the selected entropy and information content.

Parameters:
  • experiment_folder_path (str) – the path to your experiment folder.

  • entropy_source (str) – the source of entropy.

  • ic_source (str) – the source of information content (surprisal)

  • melody_names (Optional[List[str]]) – if not supplied by the users, default is all test melodies in the experiment.

  • starting_index (Optional[int]) – the index of the melody in the melody list that you want to start plotting.

  • ending_index (Optional[int]) – the index of the melody in the melody list that you want to stop plotting.

  • savefig (bool) –

  • showfig (bool) –

  • fig_format (str) – default = ‘png

  • dpi (float) – default = 400

  • figsize (tuple) – default is (10,5)

  • grid (bool) – whether to show grid or not.

  • ggplot (bool) – whether to use ggplot or not.

static simple_plot(selected_idyom_output, experiment_folder_path, melody_names=None, starting_index=None, ending_index=None, savefig=True, showfig=False, fig_format='png', dpi=400, figsize=(10, 5), grid=True, ggplot=True)[source]

Generate a simple line plot with time (in quarter note) on the x-axis, and selected IDyOM output on the y-axis.

Parameters:
  • selected_idyom_output (str) – the keyword of the IDyOM output you want to plot.

  • experiment_folder_path (str) – the path to your experiment folder.

  • melody_names (Optional[List[str]]) – if not supplied by the users, default is all test melodies in the experiment.

  • starting_index (Optional[int]) – the index of the melody in the melody list that you want to start plotting.

  • ending_index (Optional[int]) – the index of the melody in the melody list that you want to stop plotting.

  • savefig (bool) –

  • showfig (bool) –

  • fig_format (str) – default = ‘png

  • dpi (float) – optional, default = 400

  • figsize (tuple) – optional, default is (10,5)

  • grid (bool) – whether to show grid or not.

  • ggplot (bool) – whether to use ggplot or not.