adaptation for raw data file reading and minor fit routine modifications#28
adaptation for raw data file reading and minor fit routine modifications#28mohamedfaresslim merged 9 commits intomainfrom
Conversation
loichuder
left a comment
There was a problem hiding this comment.
I will have a look at the failing tests
| optimal_parametersVD = np.ones_like(initialGuessVD) | ||
| covarianceVD = np.ones( | ||
| (5 * nbPeaksInBoxes[i], 5 * nbPeaksInBoxes[i]) | ||
| ) |
There was a problem hiding this comment.
I would need more info on the problem you want to solve here.
Is the problem that if a fit fails, it completely stops the program ? I don't know if having ones as parameters/covariance is the best way to communicate that a fit has failed. Perhaps we should instead completely skip the saving of the fit ?
In any case, I think it is worth putting a print to warn the user. Something like:
print(f"Peak {i} could not be fitted ! Filling fit parameters with ones")
There was a problem hiding this comment.
Q: Is the problem that if a fit fails, it completely stops the program ?
A: Yes.
Q: Perhaps we should instead completely skip the saving of the fit ?
A: It can be done like that also but then we have to adapt all the rest of the function to that modification. The idea by putting a matrix of ones is that if the fit fails the user of the routine will see immediately that there is something wrong with that point when plotting the results for example.
In any case, I think it is worth putting a print to warn the user --> Totally agree with you for this point. We must do it.
There was a problem hiding this comment.
All right. What about putting something more explicit such as NaN or zeros instead of ones ?
There was a problem hiding this comment.
Zeros, I would avoid because it can cause some other issues for the next tasks as for example dividing by zero ....
NaN, it can also be an option but I do not know if it could also crush the next steps if we want to do operations on NaN values.
There was a problem hiding this comment.
Normally, operations on NaN will yield NaN. Which is good because we will be able to know in subsequent steps that a fit failed.
Then, at some point in the processing (when regrouping?), we should filter out NaN to avoid processing the data where the fit failed.
…into fit_minor_modifs
Modifications done: