Replies: 3 comments 3 replies
-
|
I think that model.length_a_pd_type = "lognormal" should do it. |
Beta Was this translation helpful? Give feedback.
-
|
There is the help in the user documentation (see https://www.sasview.org/docs/user/qtgui/Perspectives/Fitting/scripting.html). I am not aware of other sources of information for this, but perhaps someone else will be able to add them (tutorials/examples used in schools or something else). If you are interested, I can send you an example of a relatively complex script that I wrote with a colleague at the ILL to fit simultaneously several sets of data with some constraints (but we did not do much to make it understandable, so I am not sure if it could be of any help). |
Beta Was this translation helpful? Give feedback.
-
|
I am not sure that this still works, and certainly it could be simplified and written better, but hopefully the ideas are still useful: This was used to fit the size and Li content of the nanoparticles formed during several electrochemical cycles, represented by a multi-shell core model + a power law. The idea (if I remember correctly) is that in the first cycle (key=0) there is no lithiation and some of the common parameters for all the cycles are defined (R_CORE, SLD_CORE, etc.), in the next cycle (key=1) there is already a Li shell and some parameters are defined in terms of the common parameters, and then in the following cycles (key=2) the Li shell simply grows at the expense of the other shells. Finally, the soft constraints was a way of introducing inequality constraints by adding a big penalty to the fit whenever the inequality is not respected. PS: Drop me a mail (gonzalezm.at.ill.fr) if you want to discuss in person at the ILL at some point. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I was wondering how one could specify in a python script which type of distribution use when calculating polydispersity? I have copied part of the script from the jupyter notebook example (https://github.com/SasView/documents/blob/master/Notebooks/sasmodels_fitting.ipynb):
plt.figure()
kernel = load_model('parallelepiped')
pars = dict(scale=0.0241207,background=0.13,sld=2.0,
sld_solvent=6.38,length_a=80,length_a_pd=0.0855571,length_b=25,length_c=1300)
model = Model(kernel, **pars)
SET THE FITTING PARAMETERS
#model.background.range(0.10, 0.2)
#model.scale.range(0.001, 1)
#model.length_a_pd.range(0,1)
model.length_b.range(1,200)
#model.length_b_pd.range(0,1)
M = Experiment(data=test_data, model=model)
problem = FitProblem(M)
print(f"Initial chisq {problem.chisq()}")
#problem.plot()
result = fit(problem)
problem.show()
problem.plot()
so let's say I want to change the length_a_pd distribution from gaussian to lognormal, how would I go about that? thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions