Hi, Before making the changes, I have some points. Especially about your point 1).
Thanks for all the suggestions for correcting the error cathing. I am looking into it, and I am very happy that you catch my errors.
No problems. Code review is always useful! Pity no one sees all the bugs I add to the code.
The reason why I did not split up the commit in two, as you have suggested several times now, was that I would not have been able to do the return command. But that was rubbish thinking!!! I could have implemented the return command first for all models, and then afterwards do all the error catching. That could have made it easy for myself to revert the commits which only deals with the error catching. Sigh...., my logic thinking suffers from late night working. And my stubbornness have here back-fired.
Oh well, that happens. The practice with the late night working will probably be useful when you are into the thesis writing state, so not all is lost.
And I am also sorry for the trouble this causes, when you have to review all the commits to be put into the announcement with the list of code changes. One can probably not fathom this amount of work, and cursing, before one have done itself. :-)
Well, if you have time one day and have interest, you could give it a go yourself, following the instructions at docs/Release_Checklist. The current relax 3.2.0 CHANGES file is huge right now and it is many hours of work to sort that one out - deleting insignificant message, fixing links, spelling mistakes, missing punctuation, capitalisation, spacing, etc. The minor releases are always a lot easier.
Allright. Line-up of work. 1) I will compare with trunk, and I will only implement the error cathing which was as before.
Actually, you don't have to do this for all. Implementing 2) below will mean that most tests will now be redundant and removing them will make the code faster :)
2) I will add: # Catch parameter values that will result in no exchange, returning flat R2eff = R20 lines. if dw == 0.0 or pA == 1.0 or kex == 0.0: return array([R20]*num_points)
This would need some modification for R1rho and when R20A != R20B. And for models which have different parameter sets. It might be possible to come up with some other original parameter checks at the start so that all the later checks can be eliminated.
3) I will keep this check, as a "last line of defense". # Catch errors, taking a sum over array is the fastest way to check for # +/- inf (infinity) and nan (not a number). if not isfinite(sum(R2eff)): R2eff = array([1e100]*num_points)
This is useful. If an optimisation algorithm hits an Inf or NaN value, it will often never be able to recover. Maybe I should have added such error checking to minfx itself (https://gna.org/projects/minfx/) as I was developing it (as an aside, did you know that I spent an entire year of my PhD reading the book "Numerical optimization" by Nocedal and Wright, implementing each algorithm one-by-one to learn everything about optimisation so that I could understand why the other model-free optimisation software was so often failing).
I hope you can bear with me, and I will again try to switch on the brain. :-)
It's ok as everything is in a branch, so there are no breakages in the trunk! Regards, Edward