Thanks Arthur for pointing that out. I have included a link to the python code for the nelder mead simplex algorithm used here. I have also tried to better explain some of the graphs showing the results.