Internal testing and prelim sampling routines in Cython