gundam-organization/gundam

[LTS/1.8.x] NaN saved in output

Closed this issue · 4 comments

Running a fit NaN values are saved for the pion FSI parameters. This was not observed before and may be related to the configuration files, but it could be avoided by adding a protection against it. I have identified the following lines where this protection can go: L943 and L944 in MinimizerInterface.cpp. I was thinking of adding a simple if(not std::isnan(par.getParameterValue()) ) before setting the bin content and if( not std::isnan((*covMatrix_)[par.getParameterIndex()][par.getParameterIndex()]) ) before setting the parameter errors. The exception can be that the bin is set to zero and an error is printed in the log. Feedback on my proposal is welcome!

I thinking seeing NaN is a very clear indication something went wrong; unless this causes crashes I'd be tempted to leave it so the underlying problem isn't missed. If it does cause issues, I think an exception like you propose above works. I'd probably set the value to something like -999 so it's still very obvious that something went wrong, 0 could be overlooked if people don't check carefully.

I pushed a test branch LTS/testbed/OnlyValidParameters that will throw if a NaN parameter is used. It should also print the name of the parameter. I would go further than @tadoyle and say using any invalid parameters should be treated as a full "cannot continue" situation.

I've tested this version and it throws an error as expected what(): exception thrown by the logger: std::isnan(_parameterValue_)

Based on discussions: The actual issue is that disabled parameters are being saved into the output. Disabled parameters should not be saved. If there are ENABLED parameters with a NaN value, that should be an error.