In [16]:
import dml.data as D
import numpy as np
reload(D)


Out[16]:
<module 'dml.data' from 'dml/data.py'>

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]:
(5000.0, 0.0)

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]:
(1411.7647058823529, 1049.1014827495319)

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]:
(119.76047904191617, 61.830901612233482)

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]:
(538.16621743036842, 254.41099151838688)

In [ ]: