Fixed the problem! The infinite case now agrees perfectly with the python script. Will now work on cleaning up the code.