silx-kit / freesas

Small angle scattering tools ... but unlike most others, free.
MIT License
12 stars 11 forks source link

[BIFT] restrict the q-range for speed and less noisy data #18

Open kif opened 4 years ago

kif commented 4 years ago

Mark suggests to start at the begining of the guinier region: reasonable

But where to stop ? dq*Dmax<2pi ?

kif commented 4 years ago

Mark wants the full noise: great :)

kif commented 4 years ago

Bad idea ... High intensity region is mandatory for proper representation of the data.

maaeli commented 4 years ago

Hi Jérôme,

I am not surprised as the "Dmax" information mostly comes for the small angles. Do you have test data with low-q artifacts? Because there dropping low q might be the game changer. Looking here https://www.sasbdb.org/browse having no artifact seems to be the exception...

Cheers, Martha

kif commented 4 years ago

Hi Martha,

Nice to read you. How is your new life?

I am also disappointed by those poor results. Here are a couple of images of the same BSA dataset, reconstructed from the (B)IFT transformed data whether the region before Guinier's linerar region was discarded or not. Of course, it is always possible that there was an error in my code. image image

It is not really surprising when considering the Dmax is completely wrong after BIFT transformation: image image

maaeli commented 4 years ago

Hi Jérôme,

how do you obtain those plots? Because for me, the bift.py do look like superimposed by a zig-zag...

bsa_005_sub.out.zip

Anyways, the second data above looks a lot like smeared out sphere?

Best, Martha

kif commented 4 years ago

I agree with you, the second solution looks like a sense sphere. This can be understood as the algorithm starts with a sphere and an alpha_max parameter which would make this acceptable. Then starts the optimization process. Different scenarii have been investigated. The one currently implemented is:

Are you using the provided test-data ? because I got this: image (this is the result of freesas testdata/bsa_005_sub.dat)

maaeli commented 4 years ago

Yes, I am using the provided test data... Btw, how do you get the reciprocal space fits?

kif commented 4 years ago

IFT is an ill-posed inverse problem. This means the opposite is trivial, trivial like a dot product :) I wrote plenty of test based on synthetic data, have a look at the test_autorg there is a test_synthetic. https://github.com/kif/freesas/blob/fit_autorg/freesas/test/test_autorg.py#L68 For example to simulate the SAXS curve for spherical particles:

        R0 = 4
        npt = 1000
        I0 = 1e2
        Dmax = 2 * R0
        size = 5000
        r = numpy.linspace(0, Dmax, npt + 1)
        p = distribution_sphere(I0, Dmax, npt)
        q = numpy.linspace(0, 10, size)
        qr = numpy.outer(q, r / pi)
        T = (4 * pi * (r[-1] - r[0]) / npt) * numpy.sinc(qr)
        I = T.dot(p)
        err = numpy.sqrt(I)
        data = numpy.vstack((q, I, err)).T
maaeli commented 4 years ago

Hi Jérôme,

for me BIFT works on the BSA test set, even if I crop the pre-Guinier data: image Fit for complete data: image Fit for cropped data: image

How exactly did you remove the pre-Guinier region?

kif commented 4 years ago

You are right, it looks OK... I don't know what I did implement