Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

definition of fitting function in m2.py #7

Closed
SReich-EMI opened this issue Feb 17, 2022 · 3 comments
Closed

definition of fitting function in m2.py #7

SReich-EMI opened this issue Feb 17, 2022 · 3 comments

Comments

@SReich-EMI
Copy link
Contributor

SReich-EMI commented Feb 17, 2022

I like this module, as is makes analysis very easy. However, I wonder about the fitting for M2. Especially I refer to

def _beam_fit_fn_(z, d0, z0, Theta): """Fitting function for d0, z0, and Theta.""" return d0**2 + (Theta*(z-z0))**2

I understand the idea of fitting d(z)^2 = ... wwithout the sqrt. But if I change the input from d**2 to d and also the function from d0**2 + (Theta*(z-z0))**2 to np.sqrt(d0**2 + (Theta*(z-z0))**2), I get different results.

Has anyone an idea, where this change comes from and how to get the proper output? Which of the two versions is right?

@SReich-EMI
Copy link
Contributor Author

I think I have opened this issue to early. The differences are not only related to the different fitting functions, they also depend on the data set himself and consequently on the proper definitions of starting values and bounds where the fit function ends up.
Therefore, the fitting by the sqrt-function seems to be all right and I close this issue again.

@scottprahl
Copy link
Owner

You bring up an interesting point though. Changing the fitting function changes how errors in data are weighted. I have to look more carefully, but the current code might be overweighting beam size measurement made farther away from the beam waist.

@scottprahl scottprahl reopened this Feb 18, 2022
@scottprahl
Copy link
Owner

I changed the code to fit to d and not d**2. Not that much difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants