Overview#
This notebook gives a general overview of the features included in the dataset.
Show imports
%load_ext autoreload
%autoreload 2
import os
import dimcat as dc
import pandas as pd
import plotly.express as px
from dimcat import filters, plotting
from IPython.display import display
import utils
RESULTS_PATH = os.path.abspath(os.path.join(utils.OUTPUT_FOLDER, "overview"))
os.makedirs(RESULTS_PATH, exist_ok=True)
def make_output_path(
filename: str,
extension=None,
path=RESULTS_PATH,
) -> str:
return utils.make_output_path(filename=filename, extension=extension, path=path)
def save_figure_as(
fig, filename, formats=("png", "pdf"), directory=RESULTS_PATH, **kwargs
):
if formats is not None:
for fmt in formats:
plotting.write_image(fig, filename, directory, format=fmt, **kwargs)
else:
plotting.write_image(fig, filename, directory, **kwargs)
Loading data
D = utils.get_dataset("kozeluh_sonatas", corpus_release="v2.4")
package = D.inputs.get_package()
package_info = package._package.custom
git_tag = package_info.get("git_tag")
utils.print_heading("Data and software versions")
print("Leopold Koželuch – Piano Sonatas version v2.4")
print(f"Datapackage '{package.package_name}' @ {git_tag}")
print(f"dimcat version {dc.__version__}\n")
D
Data and software versions
--------------------------
Leopold Koželuch – Piano Sonatas version v2.4
Datapackage 'kozeluh_sonatas' @ v2.4
dimcat version 3.4.0
Dataset
=======
{'inputs': {'basepath': None,
'packages': {'kozeluh_sonatas': ["'kozeluh_sonatas.measures' (MuseScoreFacetName.MuseScoreMeasures)",
"'kozeluh_sonatas.notes' (MuseScoreFacetName.MuseScoreNotes)",
"'kozeluh_sonatas.expanded' (MuseScoreFacetName.MuseScoreHarmonies)",
"'kozeluh_sonatas.chords' (MuseScoreFacetName.MuseScoreChords)",
"'kozeluh_sonatas.metadata' (FeatureName.Metadata)"]}},
'outputs': {'basepath': None, 'packages': {}},
'pipeline': []}
filtered_D = filters.HasHarmonyLabelsFilter(keep_values=[True]).process(D)
all_metadata = filtered_D.get_metadata()
assert len(all_metadata) > 0, "No pieces selected for analysis."
all_metadata
| TimeSig | KeySig | last_mc | last_mn | length_qb | last_mc_unfolded | last_mn_unfolded | length_qb_unfolded | all_notes_qb | n_onsets | ... | musicbrainz | viaf | typesetter | imslp | originalFormat | staff_1_instrument | staff_1_ambitus | staff_2_instrument | staff_2_ambitus | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| corpus | piece | |||||||||||||||||||||
| kozeluh_sonatas | 09op08no1a | {1: '6/8'} | {1: 0} | 135 | 135 | 405.00 | 194 | 194 | 582.00 | 960.00 | 2047 | ... | https://musicbrainz.org/work/0d01ac7f-61a1-401... | https://viaf.org/viaf/4934150382212213500006/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 55-86 (G3-D6) | Piano (2) | 36-69 (C2-A4) |
| 09op08no1b | {1: '2/4'} | {1: 0} | 68 | 67 | 135.00 | 68 | 67 | 135.00 | 259.50 | 941 | ... | https://musicbrainz.org/work/04f2c6d0-2202-4e6... | https://viaf.org/viaf/4934150382212213500006/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 64-88 (E4-E6) | Piano (2) | 35-62 (B1-D4) | |
| 10op08no2a | {1: '2/4'} | {1: -1} | 157 | 155 | 310.00 | 218 | 215 | 430.00 | 766.67 | 2038 | ... | https://musicbrainz.org/work/ca5925f0-8ebe-4c2... | https://viaf.org/viaf/6635150382260713500005/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 36-70 (C2-Bb4) | |
| 10op08no2b | {1: '2/4'} | {1: 0} | 73 | 73 | 146.00 | 139 | 139 | 278.00 | 374.00 | 796 | ... | https://musicbrainz.org/work/56435491-864d-43a... | https://viaf.org/viaf/6635150382260713500005/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 36-69 (C2-A4) | |
| 10op08no2c | {1: '2/4'} | {1: -1} | 182 | 156 | 312.00 | 256 | 216 | 432.00 | 691.71 | 2720 | ... | https://musicbrainz.org/work/b39254df-51a9-4a5... | https://viaf.org/viaf/6635150382260713500005/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-89 (A3-F6) | Piano (2) | 36-72 (C2-C5) | |
| 11op10no1a | {1: '4/4'} | {1: -3} | 177 | 177 | 708.00 | 354 | 354 | 1416.00 | 1592.00 | 3353 | ... | https://musicbrainz.org/work/36c08f36-5f82-499... | https://viaf.org/viaf/6150382274713500000/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 31-70 (G1-Bb4) | |
| 14op13no2a | {1: '2/4'} | {1: 1} | 171 | 171 | 342.00 | 342 | 342 | 684.00 | 789.25 | 1710 | ... | <NA> | https://viaf.org/viaf/8568150382227613500009/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 62-86 (D4-D6) | Piano (2) | 36-67 (C2-G4) | |
| 14op13no2b | {1: '6/8'} | {1: 2} | 51 | 49 | 147.00 | 102 | 98 | 294.00 | 362.17 | 777 | ... | <NA> | https://viaf.org/viaf/8568150382227613500009/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-86 (A3-D6) | Piano (2) | 40-69 (E2-A4) | |
| 14op13no2c | {1: '2/4'} | {1: 1} | 93 | 93 | 186.00 | 180 | 180 | 360.00 | 488.25 | 904 | ... | <NA> | https://viaf.org/viaf/8568150382227613500009/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 59-86 (B3-D6) | Piano (2) | 36-71 (C2-B4) | |
| 15op13no3a | {1: '4/4'} | {1: 1} | 137 | 137 | 548.00 | 274 | 274 | 1096.00 | 1485.25 | 2770 | ... | <NA> | https://viaf.org/viaf/778150382195013500004/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 55-88 (G3-E6) | Piano (2) | 35-71 (B1-B4) | |
| 15op13no3b | {1: '3/4'} | {1: 4} | 86 | 84 | 252.00 | 172 | 168 | 504.00 | 684.25 | 1849 | ... | <NA> | https://viaf.org/viaf/778150382195013500004/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 58-88 (A#3-E6) | Piano (2) | 37-69 (C#2-A4) | |
| 15op13no3c | {1: '6/8'} | {1: 1} | 141 | 141 | 423.00 | 282 | 282 | 846.00 | 972.50 | 2240 | ... | <NA> | https://viaf.org/viaf/778150382195013500004/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 55-88 (G3-E6) | Piano (2) | 35-72 (B1-C5) | |
| 16op15no1a | {1: '3/4'} | {1: -2} | 34 | 34 | 102.00 | 34 | 34 | 102.00 | 335.75 | 709 | ... | <NA> | https://viaf.org/viaf/180723133/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 60-89 (C4-F6) | Piano (2) | 38-75 (D2-Eb5) | |
| 16op15no1b | {1: '3/4'} | {1: -2} | 211 | 208 | 625.50 | 397 | 392 | 1177.50 | 1916.75 | 3230 | ... | <NA> | https://viaf.org/viaf/180723133/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 31-74 (G1-D5) | |
| 16op15no1c | {1: '2/4'} | {1: 1, 80: -2, 130: 1} | 186 | 186 | 382.75 | 186 | 186 | 382.75 | 1087.50 | 2634 | ... | <NA> | https://viaf.org/viaf/180723133/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 37-72 (C#2-C5) | |
| 17op15no2a | {1: '4/4'} | {1: 0} | 201 | 201 | 804.00 | 402 | 402 | 1608.00 | 2469.17 | 4491 | ... | <NA> | https://viaf.org/viaf/183583817/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 31-71 (G1-B4) | |
| 17op15no2b | {1: '3/4'} | {1: -1} | 42 | 40 | 120.00 | 84 | 80 | 240.00 | 392.12 | 791 | ... | <NA> | https://viaf.org/viaf/183583817/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-88 (G3-E6) | Piano (2) | 31-70 (G1-Bb4) | |
| 17op15no2c | {1: '4/4'} | {1: 0} | 160 | 160 | 640.00 | 320 | 320 | 1280.00 | 1890.00 | 2815 | ... | <NA> | https://viaf.org/viaf/183583817/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 48-89 (C3-F6) | Piano (2) | 34-76 (Bb1-E5) | |
| 19op17no1a | {1: '3/4'} | {1: -4} | 38 | 37 | 111.12 | 38 | 37 | 111.12 | 345.83 | 694 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 52-85 (E3-Db6) | Piano (2) | 35-72 (B1-C5) | |
| 19op17no1b | {1: '4/4'} | {1: -4} | 255 | 255 | 1020.00 | 361 | 361 | 1444.00 | 2887.67 | 3469 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 32-77 (Ab1-F5) | |
| 19op17no1c | {1: '2/4'} | {1: -4, 56: -1, 88: -4, 111: -1, 143: -4} | 221 | 213 | 426.50 | 302 | 289 | 578.50 | 1366.50 | 2523 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 36-73 (C2-Db5) | |
| 20op17no2a | {1: '6/8'} | {1: 3} | 226 | 226 | 678.00 | 452 | 452 | 1356.00 | 2294.00 | 3795 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 49-88 (C#3-E6) | Piano (2) | 33-76 (A1-E5) | |
| 20op17no2b | {1: '2/4'} | {1: 4, 51: 1, 83: 4} | 100 | 100 | 202.75 | 100 | 100 | 202.75 | 629.00 | 1472 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 56-88 (G#3-E6) | Piano (2) | 28-79 (E1-G5) | |
| 20op17no2c | {1: '2/4'} | {1: 3, 115: 0, 170: 3} | 218 | 218 | 440.50 | 218 | 218 | 440.50 | 1306.00 | 2563 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 36-74 (C2-D5) | |
| 21op17no3a | {1: '4/4'} | {1: -3} | 193 | 193 | 772.00 | 268 | 268 | 1072.00 | 2181.50 | 4459 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 33-74 (A1-D5) | |
| 21op17no3b | {1: '2/4'} | {1: -3} | 220 | 219 | 439.00 | 220 | 219 | 439.00 | 1305.83 | 3312 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 31-72 (G1-C5) | |
| 22op20no1a | {1: '3/4'} | {1: -1} | 171 | 171 | 513.00 | 227 | 227 | 681.00 | 1415.75 | 2374 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 50-89 (D3-F6) | Piano (2) | 34-70 (Bb1-Bb4) | |
| 22op20no1b | {1: '2/4'} | {1: -2} | 45 | 45 | 95.00 | 45 | 45 | 95.00 | 301.83 | 774 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 60-86 (C4-D6) | Piano (2) | 39-70 (Eb2-Bb4) | |
| 22op20no1c | {1: '6/8'} | {1: -1} | 150 | 150 | 451.50 | 150 | 150 | 451.50 | 1414.00 | 2007 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-86 (G3-D6) | Piano (2) | 31-70 (G1-Bb4) | |
| 23op20no2a | {1: '4/4'} | {1: 0} | 134 | 134 | 536.00 | 268 | 268 | 1072.00 | 1426.50 | 2654 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 53-87 (F3-Eb6) | Piano (2) | 29-74 (F1-D5) | |
| 23op20no2b | {1: '3/4'} | {1: -1} | 51 | 51 | 153.00 | 51 | 51 | 153.00 | 436.13 | 1017 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 36-71 (C2-B4) | |
| 23op20no2c | {1: '2/4'} | {1: 0, 73: -3, 108: 0} | 143 | 143 | 292.25 | 143 | 143 | 292.25 | 754.67 | 2092 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 53-88 (F3-E6) | Piano (2) | 31-72 (G1-C5) | |
| 24op20no3a | {1: '4/4'} | {1: -1} | 152 | 152 | 608.00 | 304 | 304 | 1216.00 | 1604.17 | 2173 | ... | <NA> | https://viaf.org/viaf/175077581/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 50-89 (D3-F6) | Piano (2) | 32-70 (G#1-Bb4) | |
| 24op20no3b | {1: '2/4'} | {1: 2} | 50 | 50 | 104.25 | 50 | 50 | 104.25 | 318.38 | 728 | ... | <NA> | https://viaf.org/viaf/175077581/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 54-88 (F#3-E6) | Piano (2) | 38-69 (D2-A4) | |
| 24op20no3c | {1: '6/8'} | {1: -1, 83: 2, 122: -1} | 160 | 159 | 482.75 | 160 | 159 | 482.75 | 1392.50 | 2287 | ... | <NA> | https://viaf.org/viaf/175077581/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 54-86 (F#3-D6) | Piano (2) | 36-70 (C2-Bb4) | |
| 25op26no1a | {1: '6/8'} | {1: 2} | 218 | 216 | 648.50 | 436 | 432 | 1297.00 | 1833.00 | 3133 | ... | <NA> | https://viaf.org/viaf/180342111/ | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 52-88 (E3-E6) | Piano (2) | 38-74 (D2-D5) | |
| 25op26no1b | {1: '2/2'} | {1: 3} | 50 | 50 | 210.00 | 67 | 67 | 278.00 | 631.25 | 947 | ... | <NA> | https://viaf.org/viaf/180342111/ | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 59-88 (B3-E6) | Piano (2) | 36-69 (C2-A4) | |
| 25op26no1c | {1: '2/4'} | {1: 2, 108: -1} | 179 | 178 | 356.00 | 209 | 207 | 414.50 | 901.00 | 1669 | ... | <NA> | https://viaf.org/viaf/180342111/ | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 54-88 (F#3-E6) | Piano (2) | 33-70 (A1-Bb4) | |
| 26op26no2a | {1: '3/4'} | {1: 0} | 227 | 225 | 675.00 | 454 | 450 | 1350.00 | 1887.67 | 2799 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 33-74 (A1-D5) | |
| 26op26no2b | {1: '2/2'} | {1: 0, 55: 3, 73: 0, 109: 3, 127: 0} | 193 | 174 | 703.00 | 355 | 318 | 1279.00 | 2072.83 | 3383 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 52-89 (E3-F6) | Piano (2) | 32-71 (G#1-B4) | |
| 27op26no3a | {1: '4/4'} | {1: -3} | 204 | 204 | 816.00 | 282 | 282 | 1128.00 | 2103.50 | 4002 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 34-73 (Bb1-Db5) | |
| 27op26no3b | {1: '6/8'} | {1: -3} | 54 | 54 | 162.00 | 54 | 54 | 162.00 | 559.50 | 1335 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 51-85 (Eb3-Db6) | Piano (2) | 35-70 (B1-Bb4) | |
| 27op26no3c | {1: '2/4'} | {1: -3} | 215 | 213 | 426.00 | 253 | 250 | 500.00 | 1138.50 | 2639 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 38-70 (D2-Bb4) | |
| 28op30no1a | {1: '4/4'} | {1: -2} | 154 | 152 | 608.00 | 308 | 304 | 1216.00 | 1450.00 | 2420 | ... | <NA> | https://viaf.org/viaf/181554322/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 29-72 (F1-C5) | |
| 28op30no1b | {1: '3/4'} | {1: -3} | 50 | 50 | 150.00 | 50 | 50 | 150.00 | 576.50 | 1012 | ... | <NA> | https://viaf.org/viaf/181554322/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-84 (F3-C6) | Piano (2) | 34-70 (Bb1-Bb4) | |
| 28op30no1c | {1: '2/4'} | {1: -2} | 208 | 207 | 415.00 | 208 | 207 | 415.00 | 1193.17 | 3037 | ... | <NA> | https://viaf.org/viaf/181554322/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 39-70 (Eb2-Bb4) | |
| 29op30no2a | {1: '4/4'} | {1: 1} | 195 | 195 | 780.00 | 390 | 390 | 1560.00 | 2006.00 | 3483 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 54-89 (F#3-F6) | Piano (2) | 35-67 (B1-G4) | |
| 29op30no2b | {1: '3/4'} | {1: 2} | 40 | 39 | 117.00 | 40 | 39 | 117.00 | 446.75 | 658 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 54-88 (F#3-E6) | Piano (2) | 33-73 (A1-C#5) | |
| 29op30no2c | {1: '2/4'} | {1: 1, 113: -2, 172: 1} | 209 | 206 | 412.00 | 209 | 206 | 412.00 | 1106.00 | 2793 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 55-86 (G3-D6) | Piano (2) | 35-67 (B1-G4) |
49 rows × 53 columns
mean_composition_years = utils.corpus_mean_composition_years(all_metadata)
chronological_order = mean_composition_years.index.to_list()
corpus_colors = dict(zip(chronological_order, utils.CORPUS_COLOR_SCALE))
corpus_names = {
corp: utils.get_corpus_display_name(corp) for corp in chronological_order
}
chronological_corpus_names = list(corpus_names.values())
corpus_name_colors = {
corpus_names[corp]: color for corp, color in corpus_colors.items()
}
mean_composition_years
corpus
kozeluh_sonatas 1785.918367
Name: mean_composition_year, dtype: float64
Composition dates#
This section relies on the dataset’s metadata.
valid_composed_start = pd.to_numeric(all_metadata.composed_start, errors="coerce")
valid_composed_end = pd.to_numeric(all_metadata.composed_end, errors="coerce")
print(
f"Composition dates range from {int(valid_composed_start.min())} {valid_composed_start.idxmin()} "
f"to {int(valid_composed_end.max())} {valid_composed_end.idxmax()}."
)
Composition dates range from 1784 ('kozeluh_sonatas', '09op08no1a') to 1789 ('kozeluh_sonatas', '28op30no1a').
Mean composition years per corpus#
def make_summary(metadata_df):
piece_is_annotated = metadata_df.label_count > 0
return metadata_df[piece_is_annotated].copy()
Show source
summary = make_summary(all_metadata)
bar_data = pd.concat(
[
mean_composition_years.rename("year"),
summary.groupby(level="corpus").size().rename("pieces"),
],
axis=1,
).reset_index()
N = len(summary)
fig = px.bar(
bar_data,
x="year",
y="pieces",
color="corpus",
color_discrete_map=corpus_colors,
title=f"Temporal coverage of the {N} annotated pieces in the Distant Listening Corpus",
)
fig.update_traces(width=5)
fig.update_layout(**utils.STD_LAYOUT)
fig.update_traces(width=5)
save_figure_as(fig, "pieces_timeline_bars")
fig.show()
summary
| TimeSig | KeySig | last_mc | last_mn | length_qb | last_mc_unfolded | last_mn_unfolded | length_qb_unfolded | all_notes_qb | n_onsets | ... | musicbrainz | viaf | typesetter | imslp | originalFormat | staff_1_instrument | staff_1_ambitus | staff_2_instrument | staff_2_ambitus | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| corpus | piece | |||||||||||||||||||||
| kozeluh_sonatas | 09op08no1a | {1: '6/8'} | {1: 0} | 135 | 135 | 405.00 | 194 | 194 | 582.00 | 960.00 | 2047 | ... | https://musicbrainz.org/work/0d01ac7f-61a1-401... | https://viaf.org/viaf/4934150382212213500006/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 55-86 (G3-D6) | Piano (2) | 36-69 (C2-A4) |
| 09op08no1b | {1: '2/4'} | {1: 0} | 68 | 67 | 135.00 | 68 | 67 | 135.00 | 259.50 | 941 | ... | https://musicbrainz.org/work/04f2c6d0-2202-4e6... | https://viaf.org/viaf/4934150382212213500006/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 64-88 (E4-E6) | Piano (2) | 35-62 (B1-D4) | |
| 10op08no2a | {1: '2/4'} | {1: -1} | 157 | 155 | 310.00 | 218 | 215 | 430.00 | 766.67 | 2038 | ... | https://musicbrainz.org/work/ca5925f0-8ebe-4c2... | https://viaf.org/viaf/6635150382260713500005/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 36-70 (C2-Bb4) | |
| 10op08no2b | {1: '2/4'} | {1: 0} | 73 | 73 | 146.00 | 139 | 139 | 278.00 | 374.00 | 796 | ... | https://musicbrainz.org/work/56435491-864d-43a... | https://viaf.org/viaf/6635150382260713500005/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 36-69 (C2-A4) | |
| 10op08no2c | {1: '2/4'} | {1: -1} | 182 | 156 | 312.00 | 256 | 216 | 432.00 | 691.71 | 2720 | ... | https://musicbrainz.org/work/b39254df-51a9-4a5... | https://viaf.org/viaf/6635150382260713500005/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-89 (A3-F6) | Piano (2) | 36-72 (C2-C5) | |
| 11op10no1a | {1: '4/4'} | {1: -3} | 177 | 177 | 708.00 | 354 | 354 | 1416.00 | 1592.00 | 3353 | ... | https://musicbrainz.org/work/36c08f36-5f82-499... | https://viaf.org/viaf/6150382274713500000/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 31-70 (G1-Bb4) | |
| 14op13no2a | {1: '2/4'} | {1: 1} | 171 | 171 | 342.00 | 342 | 342 | 684.00 | 789.25 | 1710 | ... | <NA> | https://viaf.org/viaf/8568150382227613500009/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 62-86 (D4-D6) | Piano (2) | 36-67 (C2-G4) | |
| 14op13no2b | {1: '6/8'} | {1: 2} | 51 | 49 | 147.00 | 102 | 98 | 294.00 | 362.17 | 777 | ... | <NA> | https://viaf.org/viaf/8568150382227613500009/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 57-86 (A3-D6) | Piano (2) | 40-69 (E2-A4) | |
| 14op13no2c | {1: '2/4'} | {1: 1} | 93 | 93 | 186.00 | 180 | 180 | 360.00 | 488.25 | 904 | ... | <NA> | https://viaf.org/viaf/8568150382227613500009/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 59-86 (B3-D6) | Piano (2) | 36-71 (C2-B4) | |
| 15op13no3a | {1: '4/4'} | {1: 1} | 137 | 137 | 548.00 | 274 | 274 | 1096.00 | 1485.25 | 2770 | ... | <NA> | https://viaf.org/viaf/778150382195013500004/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 55-88 (G3-E6) | Piano (2) | 35-71 (B1-B4) | |
| 15op13no3b | {1: '3/4'} | {1: 4} | 86 | 84 | 252.00 | 172 | 168 | 504.00 | 684.25 | 1849 | ... | <NA> | https://viaf.org/viaf/778150382195013500004/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 58-88 (A#3-E6) | Piano (2) | 37-69 (C#2-A4) | |
| 15op13no3c | {1: '6/8'} | {1: 1} | 141 | 141 | 423.00 | 282 | 282 | 846.00 | 972.50 | 2240 | ... | <NA> | https://viaf.org/viaf/778150382195013500004/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_Op.... | https://imslp.org/wiki/Special:ReverseLookup/4... | xml | Piano (2) | 55-88 (G3-E6) | Piano (2) | 35-72 (B1-C5) | |
| 16op15no1a | {1: '3/4'} | {1: -2} | 34 | 34 | 102.00 | 34 | 34 | 102.00 | 335.75 | 709 | ... | <NA> | https://viaf.org/viaf/180723133/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 60-89 (C4-F6) | Piano (2) | 38-75 (D2-Eb5) | |
| 16op15no1b | {1: '3/4'} | {1: -2} | 211 | 208 | 625.50 | 397 | 392 | 1177.50 | 1916.75 | 3230 | ... | <NA> | https://viaf.org/viaf/180723133/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 31-74 (G1-D5) | |
| 16op15no1c | {1: '2/4'} | {1: 1, 80: -2, 130: 1} | 186 | 186 | 382.75 | 186 | 186 | 382.75 | 1087.50 | 2634 | ... | <NA> | https://viaf.org/viaf/180723133/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 37-72 (C#2-C5) | |
| 17op15no2a | {1: '4/4'} | {1: 0} | 201 | 201 | 804.00 | 402 | 402 | 1608.00 | 2469.17 | 4491 | ... | <NA> | https://viaf.org/viaf/183583817/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 31-71 (G1-B4) | |
| 17op15no2b | {1: '3/4'} | {1: -1} | 42 | 40 | 120.00 | 84 | 80 | 240.00 | 392.12 | 791 | ... | <NA> | https://viaf.org/viaf/183583817/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-88 (G3-E6) | Piano (2) | 31-70 (G1-Bb4) | |
| 17op15no2c | {1: '4/4'} | {1: 0} | 160 | 160 | 640.00 | 320 | 320 | 1280.00 | 1890.00 | 2815 | ... | <NA> | https://viaf.org/viaf/183583817/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 48-89 (C3-F6) | Piano (2) | 34-76 (Bb1-E5) | |
| 19op17no1a | {1: '3/4'} | {1: -4} | 38 | 37 | 111.12 | 38 | 37 | 111.12 | 345.83 | 694 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 52-85 (E3-Db6) | Piano (2) | 35-72 (B1-C5) | |
| 19op17no1b | {1: '4/4'} | {1: -4} | 255 | 255 | 1020.00 | 361 | 361 | 1444.00 | 2887.67 | 3469 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 32-77 (Ab1-F5) | |
| 19op17no1c | {1: '2/4'} | {1: -4, 56: -1, 88: -4, 111: -1, 143: -4} | 221 | 213 | 426.50 | 302 | 289 | 578.50 | 1366.50 | 2523 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 36-73 (C2-Db5) | |
| 20op17no2a | {1: '6/8'} | {1: 3} | 226 | 226 | 678.00 | 452 | 452 | 1356.00 | 2294.00 | 3795 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 49-88 (C#3-E6) | Piano (2) | 33-76 (A1-E5) | |
| 20op17no2b | {1: '2/4'} | {1: 4, 51: 1, 83: 4} | 100 | 100 | 202.75 | 100 | 100 | 202.75 | 629.00 | 1472 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 56-88 (G#3-E6) | Piano (2) | 28-79 (E1-G5) | |
| 20op17no2c | {1: '2/4'} | {1: 3, 115: 0, 170: 3} | 218 | 218 | 440.50 | 218 | 218 | 440.50 | 1306.00 | 2563 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 57-88 (A3-E6) | Piano (2) | 36-74 (C2-D5) | |
| 21op17no3a | {1: '4/4'} | {1: -3} | 193 | 193 | 772.00 | 268 | 268 | 1072.00 | 2181.50 | 4459 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 33-74 (A1-D5) | |
| 21op17no3b | {1: '2/4'} | {1: -3} | 220 | 219 | 439.00 | 220 | 219 | 439.00 | 1305.83 | 3312 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 31-72 (G1-C5) | |
| 22op20no1a | {1: '3/4'} | {1: -1} | 171 | 171 | 513.00 | 227 | 227 | 681.00 | 1415.75 | 2374 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 50-89 (D3-F6) | Piano (2) | 34-70 (Bb1-Bb4) | |
| 22op20no1b | {1: '2/4'} | {1: -2} | 45 | 45 | 95.00 | 45 | 45 | 95.00 | 301.83 | 774 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 60-86 (C4-D6) | Piano (2) | 39-70 (Eb2-Bb4) | |
| 22op20no1c | {1: '6/8'} | {1: -1} | 150 | 150 | 451.50 | 150 | 150 | 451.50 | 1414.00 | 2007 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-86 (G3-D6) | Piano (2) | 31-70 (G1-Bb4) | |
| 23op20no2a | {1: '4/4'} | {1: 0} | 134 | 134 | 536.00 | 268 | 268 | 1072.00 | 1426.50 | 2654 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 53-87 (F3-Eb6) | Piano (2) | 29-74 (F1-D5) | |
| 23op20no2b | {1: '3/4'} | {1: -1} | 51 | 51 | 153.00 | 51 | 51 | 153.00 | 436.13 | 1017 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 55-89 (G3-F6) | Piano (2) | 36-71 (C2-B4) | |
| 23op20no2c | {1: '2/4'} | {1: 0, 73: -3, 108: 0} | 143 | 143 | 292.25 | 143 | 143 | 292.25 | 754.67 | 2092 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 53-88 (F3-E6) | Piano (2) | 31-72 (G1-C5) | |
| 24op20no3a | {1: '4/4'} | {1: -1} | 152 | 152 | 608.00 | 304 | 304 | 1216.00 | 1604.17 | 2173 | ... | <NA> | https://viaf.org/viaf/175077581/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 50-89 (D3-F6) | Piano (2) | 32-70 (G#1-Bb4) | |
| 24op20no3b | {1: '2/4'} | {1: 2} | 50 | 50 | 104.25 | 50 | 50 | 104.25 | 318.38 | 728 | ... | <NA> | https://viaf.org/viaf/175077581/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 54-88 (F#3-E6) | Piano (2) | 38-69 (D2-A4) | |
| 24op20no3c | {1: '6/8'} | {1: -1, 83: 2, 122: -1} | 160 | 159 | 482.75 | 160 | 159 | 482.75 | 1392.50 | 2287 | ... | <NA> | https://viaf.org/viaf/175077581/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas%2C_P... | https://imslp.org/wiki/Special:ReverseLookup/8... | xml | Piano (2) | 54-86 (F#3-D6) | Piano (2) | 36-70 (C2-Bb4) | |
| 25op26no1a | {1: '6/8'} | {1: 2} | 218 | 216 | 648.50 | 436 | 432 | 1297.00 | 1833.00 | 3133 | ... | <NA> | https://viaf.org/viaf/180342111/ | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 52-88 (E3-E6) | Piano (2) | 38-74 (D2-D5) | |
| 25op26no1b | {1: '2/2'} | {1: 3} | 50 | 50 | 210.00 | 67 | 67 | 278.00 | 631.25 | 947 | ... | <NA> | https://viaf.org/viaf/180342111/ | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 59-88 (B3-E6) | Piano (2) | 36-69 (C2-A4) | |
| 25op26no1c | {1: '2/4'} | {1: 2, 108: -1} | 179 | 178 | 356.00 | 209 | 207 | 414.50 | 901.00 | 1669 | ... | <NA> | https://viaf.org/viaf/180342111/ | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 54-88 (F#3-E6) | Piano (2) | 33-70 (A1-Bb4) | |
| 26op26no2a | {1: '3/4'} | {1: 0} | 227 | 225 | 675.00 | 454 | 450 | 1350.00 | 1887.67 | 2799 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 33-74 (A1-D5) | |
| 26op26no2b | {1: '2/2'} | {1: 0, 55: 3, 73: 0, 109: 3, 127: 0} | 193 | 174 | 703.00 | 355 | 318 | 1279.00 | 2072.83 | 3383 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 52-89 (E3-F6) | Piano (2) | 32-71 (G#1-B4) | |
| 27op26no3a | {1: '4/4'} | {1: -3} | 204 | 204 | 816.00 | 282 | 282 | 1128.00 | 2103.50 | 4002 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 34-73 (Bb1-Db5) | |
| 27op26no3b | {1: '6/8'} | {1: -3} | 54 | 54 | 162.00 | 54 | 54 | 162.00 | 559.50 | 1335 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 51-85 (Eb3-Db6) | Piano (2) | 35-70 (B1-Bb4) | |
| 27op26no3c | {1: '2/4'} | {1: -3} | 215 | 213 | 426.00 | 253 | 250 | 500.00 | 1138.50 | 2639 | ... | <NA> | <NA> | Daniel Bernhardsson | <NA> | <NA> | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 38-70 (D2-Bb4) | |
| 28op30no1a | {1: '4/4'} | {1: -2} | 154 | 152 | 608.00 | 308 | 304 | 1216.00 | 1450.00 | 2420 | ... | <NA> | https://viaf.org/viaf/181554322/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 29-72 (F1-C5) | |
| 28op30no1b | {1: '3/4'} | {1: -3} | 50 | 50 | 150.00 | 50 | 50 | 150.00 | 576.50 | 1012 | ... | <NA> | https://viaf.org/viaf/181554322/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-84 (F3-C6) | Piano (2) | 34-70 (Bb1-Bb4) | |
| 28op30no1c | {1: '2/4'} | {1: -2} | 208 | 207 | 415.00 | 208 | 207 | 415.00 | 1193.17 | 3037 | ... | <NA> | https://viaf.org/viaf/181554322/ | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 53-89 (F3-F6) | Piano (2) | 39-70 (Eb2-Bb4) | |
| 29op30no2a | {1: '4/4'} | {1: 1} | 195 | 195 | 780.00 | 390 | 390 | 1560.00 | 2006.00 | 3483 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 54-89 (F#3-F6) | Piano (2) | 35-67 (B1-G4) | |
| 29op30no2b | {1: '3/4'} | {1: 2} | 40 | 39 | 117.00 | 40 | 39 | 117.00 | 446.75 | 658 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 54-88 (F#3-E6) | Piano (2) | 33-73 (A1-C#5) | |
| 29op30no2c | {1: '2/4'} | {1: 1, 113: -2, 172: 1} | 209 | 206 | 412.00 | 209 | 206 | 412.00 | 1106.00 | 2793 | ... | <NA> | <NA> | Daniel Bernhardsson | https://imslp.org/wiki/3_Keyboard_Sonatas,_P.X... | https://imslp.org/wiki/Special:ReverseLookup/5... | xml | Piano (2) | 55-86 (G3-D6) | Piano (2) | 35-67 (B1-G4) |
49 rows × 53 columns
Composition years histogram#
Show source
hist_data = summary.reset_index()
hist_data.corpus = hist_data.corpus.map(corpus_names)
fig = px.histogram(
hist_data,
x="composed_end",
color="corpus",
labels=dict(
composed_end="decade",
count="pieces",
),
color_discrete_map=corpus_name_colors,
title=f"Temporal coverage of the {N} annotated pieces in the Distant Listening Corpus",
)
fig.update_traces(xbins=dict(size=10))
fig.update_layout(**utils.STD_LAYOUT)
fig.update_legends(font=dict(size=16))
save_figure_as(fig, "pieces_timeline_histogram", height=1250)
fig.show()
Dimensions#
Overview#
def make_overview_table(groupby, group_name="pieces"):
n_groups = groupby.size().rename(group_name)
absolute_numbers = dict(
measures=groupby.last_mn.sum(),
length=groupby.length_qb.sum(),
notes=groupby.n_onsets.sum(),
labels=groupby.label_count.sum(),
)
absolute = pd.DataFrame.from_dict(absolute_numbers)
absolute = pd.concat([n_groups, absolute], axis=1)
sum_row = pd.DataFrame(absolute.sum(), columns=["sum"]).T
absolute = pd.concat([absolute, sum_row])
return absolute
absolute = make_overview_table(summary.groupby("workTitle"))
# print(absolute.astype(int).to_markdown())
absolute.astype(int)
| pieces | measures | length | notes | labels | |
|---|---|---|---|---|---|
| Keyboard Sonata No. 1 in B-flat Major | 3 | 409 | 1173 | 6469 | 986 |
| Keyboard Sonata No. 1 in C Major | 2 | 202 | 540 | 2988 | 421 |
| Keyboard Sonata No. 1 in D Major | 3 | 444 | 1214 | 5749 | 907 |
| Keyboard Sonata No. 1 in E-flat Major | 1 | 177 | 708 | 3353 | 493 |
| Keyboard Sonata No. 1 in F Major | 3 | 366 | 1059 | 5155 | 682 |
| Keyboard Sonata No. 1 in F Minor | 3 | 505 | 1557 | 6686 | 984 |
| Keyboard Sonata No. 1 in G Minor | 3 | 428 | 1110 | 6573 | 1158 |
| Keyboard Sonata No. 2 in A Major | 3 | 544 | 1321 | 7830 | 1381 |
| Keyboard Sonata No. 2 in A Minor | 2 | 399 | 1378 | 6182 | 955 |
| Keyboard Sonata No. 2 in C Major | 6 | 729 | 2545 | 13860 | 2026 |
| Keyboard Sonata No. 2 in F Major | 3 | 384 | 768 | 5554 | 1014 |
| Keyboard Sonata No. 2 in G Major | 6 | 753 | 1984 | 10325 | 1597 |
| Keyboard Sonata No. 3 in D Minor | 3 | 361 | 1195 | 5188 | 925 |
| Keyboard Sonata No. 3 in E Minor | 3 | 362 | 1223 | 6859 | 967 |
| Keyboard Sonata No. 3 in E-flat Major | 5 | 883 | 2615 | 15747 | 2102 |
| sum | 49 | 6946 | 20392 | 108518 | 16598 |
def summarize_dataset(D):
all_metadata = D.get_metadata()
summary = make_summary(all_metadata)
return make_overview_table(summary.groupby(level=0))
corpus_summary = summarize_dataset(D)
print(corpus_summary.astype(int).to_markdown())
| | pieces | measures | length | notes | labels |
|:----------------|---------:|-----------:|---------:|--------:|---------:|
| kozeluh_sonatas | 49 | 6946 | 20392 | 108518 | 16598 |
| sum | 49 | 6946 | 20392 | 108518 | 16598 |
Measures#
all_measures = D.get_feature("measures")
print(
f"{len(all_measures.index)} measures over {len(all_measures.groupby(level=[0,1]))} files."
)
all_measures.head()
7028 measures over 49 files.
| mc | mn | quarterbeats | duration_qb | keysig | timesig | act_dur | mc_offset | numbering_offset | dont_count | barline | breaks | repeats | next | markers | jump_bwd | jump_fwd | play_until | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| corpus | piece | i | ||||||||||||||||||
| kozeluh_sonatas | 09op08no1a | 0 | 1 | 1 | 0 | 3.0 | 0 | 6/8 | 3/4 | 0 | <NA> | <NA> | <NA> | <NA> | firstMeasure | (2,) | <NA> | <NA> | <NA> | <NA> |
| 1 | 2 | 2 | 3 | 3.0 | 0 | 6/8 | 3/4 | 0 | <NA> | <NA> | <NA> | <NA> | <NA> | (3,) | <NA> | <NA> | <NA> | <NA> | ||
| 2 | 3 | 3 | 6 | 3.0 | 0 | 6/8 | 3/4 | 0 | <NA> | <NA> | <NA> | <NA> | <NA> | (4,) | <NA> | <NA> | <NA> | <NA> | ||
| 3 | 4 | 4 | 9 | 3.0 | 0 | 6/8 | 3/4 | 0 | <NA> | <NA> | <NA> | <NA> | <NA> | (5,) | <NA> | <NA> | <NA> | <NA> | ||
| 4 | 5 | 5 | 12 | 3.0 | 0 | 6/8 | 3/4 | 0 | <NA> | <NA> | <NA> | <NA> | <NA> | (6,) | <NA> | <NA> | <NA> | <NA> |
all_measures.get_default_analysis().plot_grouped()
Harmony labels#
All symbols, independent of the local key (the mode of which changes their semantics).
try:
all_annotations = D.get_feature("harmonylabels").df
except Exception:
all_annotations = pd.DataFrame()
n_annotations = len(all_annotations.index)
includes_annotations = n_annotations > 0
if includes_annotations:
display(all_annotations.head())
print(f"Concatenated annotation tables contains {all_annotations.shape[0]} rows.")
no_chord = all_annotations.root.isna()
if no_chord.sum() > 0:
print(
f"{no_chord.sum()} of them are not chords. Their values are:"
f" {all_annotations.label[no_chord].value_counts(dropna=False).to_dict()}"
)
all_chords = all_annotations[~no_chord].copy()
print(
f"Dataset contains {all_chords.shape[0]} tokens and {len(all_chords.chord.unique())} types over "
f"{len(all_chords.groupby(level=[0,1]))} documents."
)
all_annotations["corpus_name"] = all_annotations.index.get_level_values(0).map(
utils.get_corpus_display_name
)
all_chords["corpus_name"] = all_chords.index.get_level_values(0).map(
utils.get_corpus_display_name
)
else:
print("Dataset contains no annotations.")
| mc | mn | quarterbeats | quarterbeats_all_endings | duration_qb | mc_onset | mn_onset | timesig | staff | voice | ... | numeral_or_applied_to_numeral | intervals_over_bass | intervals_over_root | scale_degrees | scale_degrees_and_mode | scale_degrees_major | scale_degrees_minor | globalkey | localkey | chord | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| corpus | piece | i | |||||||||||||||||||||
| kozeluh_sonatas | 09op08no1a | 0 | 1 | 1 | 0 | 0 | 4.5 | 0 | 0 | 6/8 | 2 | 1 | ... | I | (M3, P5) | (M3, P5) | (1, 3, 5) | (1, 3, 5), major | (1, 3, 5) | (1, #3, 5) | C | I | I |
| 1 | 2 | 2 | 9/2 | 9/2 | 1.0 | 3/8 | 3/8 | 6/8 | 2 | 1 | ... | IV | (m3, m6) | (M3, P5) | (6, 1, 4) | (6, 1, 4), major | (6, 1, 4) | (#6, 1, 4) | C | I | IV6 | ||
| 2 | 2 | 2 | 11/2 | 11/2 | 5.0 | 5/8 | 5/8 | 6/8 | 2 | 1 | ... | I | (P4, M6) | (M3, P5) | (5, 1, 3) | (5, 1, 3), major | (5, 1, 3) | (5, 1, #3) | C | I | I64 | ||
| 3 | 4 | 4 | 21/2 | 21/2 | 1.0 | 3/8 | 3/8 | 6/8 | 2 | 1 | ... | IV | (M3, P5) | (M3, P5) | (4, 6, 1) | (4, 6, 1), major | (4, 6, 1) | (4, #6, 1) | C | I | IV | ||
| 4 | 4 | 4 | 23/2 | 23/2 | 2.0 | 5/8 | 5/8 | 6/8 | 2 | 1 | ... | I | (m3, m6) | (M3, P5) | (3, 5, 1) | (3, 5, 1), major | (3, 5, 1) | (#3, 5, 1) | C | I | I6 |
5 rows × 52 columns
Concatenated annotation tables contains 16598 rows.
1 of them are not chords. Their values are: {'@none': 1}
Dataset contains 16597 tokens and 360 types over 49 documents.