rewrite using numpy
remove unused imports
change pytables to h5py
improve tests