This is scipy code for the celnav algorithm