Bunch of changes here; I probably waited too long for the pull request. A guide to what changed:
I factored out the stuff in HilbertMatrix into two other subclasses to make testing easier and to hopefully make the classes more reusable. First there's a HilbertBase class, which just handles distances based on cell number. It's pretty basic. Then there's a HilbertNormalized class that subclasses HilbertBase and which simply converts it into a matrix that represents arbitrary lengths (e.g., genomic bp), handling the norm_factor stuff. Finally, the existing HilbertMatrix subclasses the HilbertNormalized class and works the same as it did before.
the update() method now optionally takes an arbitrary function. By default the function is np.add to make it consistent with the existing code (i.e., incrementing). Hopefully this will allow some pretty sophisticated stuff down the line. Actually, your issue #11 could be implemented just by passing np.random.random to the update() method.
some basic low-level tests in hilbert_test.py
the annotated_hilbert script for remembering which cell is which
graphical_test.py, a toy script that I found really useful for working out tests
I've merged all your changes up through 5d1ad4587ef0ee9d5b8ed18a7a88320cfa89642f. Meld was awesome for this.
Fantastic! Thanks for the refactoring of the Hilbert class, I think that will be very help as you say for more sophisticated representations of the data. Awesome.
Bunch of changes here; I probably waited too long for the pull request. A guide to what changed:
I've merged all your changes up through 5d1ad4587ef0ee9d5b8ed18a7a88320cfa89642f. Meld was awesome for this.