Rewrote _get_lattices. It is not almost entirely in numpy. Substantial speedup