In [1]:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
#import librosa
import os
import sys
from random import sample
import hdf5_getters
import numpy as np
from dtw import dtw
from numpy.linalg import norm

matplotlib.rcParams['figure.figsize'] = (10.0, 8.0)

In [2]:
def norm2(x, y):
    return norm(x - y, ord=2)

def get_song_info(h5):
    print '%s - %s | (%s) | %s bpm' % (hdf5_getters.get_artist_name(h5), hdf5_getters.get_title(h5), hdf5_getters.get_year(h5), hdf5_getters.get_tempo(h5))

In [3]:
h5list = []
pitches = []
rootdir = './data/'

for subdir, dirs, files in os.walk(rootdir):
    for f in files:
        if f.lower().endswith('.h5'):
            h5list.append(hdf5_getters.open_h5_file_read(os.path.join(subdir, f)))
#            get_song_info(h5list[-1])
            pitches.append(hdf5_getters.get_segments_pitches(h5list[-1]))
h5sample = sample(pitches, 100)

In [4]:
[ dtw(x, y, dist=norm2) for x in h5sample for y in h5sample if x != y]


The history saving thread hit an unexpected error (OperationalError('unable to open database file',)).History will not be written to the database.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.py", line 970, in get_records
  File "/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.py", line 233, in wrapped
  File "/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.py", line 267, in _fixed_getinnerframes
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 1044, in getinnerframes
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 1004, in getframeinfo
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 454, in getsourcefile
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 483, in getmodule
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 467, in getabsfile
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 364, in abspath
OSError: [Errno 24] Too many open files
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.


Unfortunately, your original traceback can not be constructed.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_code(self, code_obj, result)

/usr/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in showtraceback(self, exc_tuple, filename, tb_offset, exception_only)

/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.pyc in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)

/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.pyc in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)

/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.pyc in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)

/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.pyc in format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)

/usr/local/lib/python2.7/site-packages/IPython/core/ultratb.pyc in format_records(self, records)

TypeError: 'NoneType' object is not iterable