Completed first version of find_pupil_edge, not yet tested.