blond-org / blond_common

Collection of common functions and interfaces
GNU General Public License v3.0
3 stars 5 forks source link

What return type of fit profile functions? #25

Closed MarkusSchwarz1980 closed 5 years ago

MarkusSchwarz1980 commented 5 years ago

Presently, the fit profile routines (gaussianFit, waterbagFit, etc.) return a tuple of bunchPosition, bunchLength, extraFitParameters. I think it would be better that they just return an array with the fit parameters. The user could then either use these directly or create the corresponding distribution object (gaussian, waterbag, etc.) that calculates all quantities (e.g. RMS, fullBunchLength, etc.). The advantage I see is that there is only one place, where 'the' bunch length and position is calculated, namely the distribution object. Otherwise, it is not clear what 'bunch length' is supposed to mean (similarly, if we want to introduce 'skewed' distributions, is 'bunch position' supposed to be the maximum, center of gravity,...?). Even if the returned bunch length is always defined to be, say, RMS, this is not very flexible.

alasheen commented 5 years ago

I agree with this, the fitting functions should simply return the fitted parameters.

To get the various parameters we want for the studies (e.g. full bunch length, rms, rescaled values of fwhm), we can follow your original suggestion to use objects allowing to get explicitely the definition we want (switching from one to another through setters/getters), and not an implicit one through a generic "bunch_length" definition.

I propose we move this discussion to a more general issue concerning the expected input/output of the whole fitting package: #26