In [16]:
import dml.data as D
import numpy as np
reload(D)
Out[16]:
In [17]:
dframe = D.index_directory("/media/ejhumphrey/tiny/timbre_sim/features/cqts/")
In [18]:
instruments = dframe.instrument.unique()
note_numbers = dframe.note_number.unique()
inst_notes = dframe.inst_note.unique()
In [22]:
# Same instrument
ihist = {i: (dframe.instrument == i).sum() for i in instruments}
counts = np.array(ihist.values())
counts.mean(), counts.std()
Out[22]:
In [23]:
# Same Pitch
nhist = {nn: (dframe.note_number == nn).sum() for nn in sorted(note_numbers)}
counts = np.array(nhist.values())
counts.mean(), counts.std()
Out[23]:
In [24]:
# Same inst & pitch
inhist = {inn: (dframe.inst_note == inn).sum() for inn in sorted(inst_notes)}
counts = np.array(inhist.values())
counts.mean(), counts.std()
Out[24]:
In [31]:
# Same inst & +/- delta pitch
indhist = {}
for i in instruments:
for nn in note_numbers:
key = "{}_{}".format(i, nn)
nidx = np.abs(dframe.note_number - nn) <= 2
iidx = (dframe.instrument == i)
c = (nidx & iidx).sum()
if c > 0:
indhist[key] = c
counts = np.array(indhist.values())
counts.mean(), counts.std()
Out[31]:
In [ ]: