dkriegner / xrayutilities

xrayutilities - a package with useful scripts for X-ray diffraction physicists
http://xrayutilities.sourceforge.io
GNU General Public License v2.0
83 stars 29 forks source link

New example for fitting MBE grown heterostructure #166

Closed VeryBitter closed 1 year ago

VeryBitter commented 1 year ago

I had a bit of a struggle before making a good modeling and fitting of my experimental results. I would like to add another example file so that newcomers could use it to fit their data within a short amount of time. I hope it will be helpful.

Aristide

dkriegner commented 1 year ago

/AzurePipelines run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
VeryBitter commented 1 year ago

Hi I did all the cleaning requested. I was able to use AlGaAs.ContentBtsym. Regarding the "values for keyword argument 'method'" error, I reinstalled xrayutilities, downgraded lmfit to 1.2.0, still working. I don't understand why it doesn't work on your configuration. Actually, I was able to use successfully the fit_kws = {'method': 'differential_evolution'} parameter only after you updated the fit.py file very recently.

dkriegner commented 1 year ago

thanks for all the fixes. I'll need a bit of time to come back to you. Please stay tuned.

/AzurePipelines run

dkriegner commented 1 year ago

/AzurePipelines run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
VeryBitter commented 1 year ago

Hi Dominique do you expect me to do something at this point? I fully agree with your suggestion.

dkriegner commented 1 year ago

/AzurePipelines run

azure-pipelines[bot] commented 1 year ago
Azure Pipelines successfully started running 1 pipeline(s).
dkriegner commented 1 year ago

Hi Dominique do you expect me to do something at this point? I fully agree with your suggestion.

Hi, I think I just performed the remaining changes. let's see what the tests are saying now.

dkriegner commented 1 year ago

Unfortunately it seems the unit tests have the same error I experience locally. I look into it.

dkriegner commented 1 year ago

I have a fix for the issue with the method keyword argument. Basically one has to pass it via the lmfit_kws instead of fit_kws. But before I upload it I have a question: Why you want to use method='differential_evolution'. In my tests the script needs 30 times longer with differential_evolution than when using leastsq. Also the resulting chi-square is slightly worse. So I see no reason to use a special optimization method here. What am i missing?

VeryBitter commented 1 year ago

I first used the leastsq method. But the fit was not that good, looking like it was stuck in secondary minimum. Switching to differential_evolution gave me much better results. However, based on you comment, setting the min/max for each parameter might have be the true reason for the fit improvement. So probably we could comment this line. Although not necessary, it would give a hint on how to change the fit model and other parameters. Or remove it completely. Up to you.

dkriegner commented 1 year ago

I think commenting the line is the best option. I’ll push a corresponding commit later and this should conclude this PR.

On Mon 17. 7. 2023 at 19:56, VeryBitter @.***> wrote:

I first used the leastsq method. But the fit was not that good, looking like it was stuck in secondary minimum. Switching to differential_evolution gave me much better results. However, based on you comment, setting the min/max for each parameter might have be the true reason for the fit improvement. So probably we could comment this line. Although not necessary, it would give a hint on how to change the fit model and other parameters. Or remove it completely. Up to you.

— Reply to this email directly, view it on GitHub https://github.com/dkriegner/xrayutilities/pull/166#issuecomment-1638612941, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACKZJFMUEAPT2P2XK6N5UELXQV4DFANCNFSM6AAAAAAZ7AU4IY . You are receiving this because you commented.Message ID: @.***>

dkriegner commented 1 year ago

/AzurePipelines run

azure-pipelines[bot] commented 1 year ago

No commit pushedDate could be found for PR 166 in repo dkriegner/xrayutilities

dkriegner commented 1 year ago

/AzurePipelines run

azure-pipelines[bot] commented 1 year ago

No commit pushedDate could be found for PR 166 in repo dkriegner/xrayutilities