Furthor speed optimizations:

Added caching of density lookup table
Directly use byte buffer when converting to ndarray
Version 0.3