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

multiple scattering (Trac #1067) #246

Open
pkienzle opened this issue Mar 30, 2019 · 4 comments
Open

multiple scattering (Trac #1067) #246

pkienzle opened this issue Mar 30, 2019 · 4 comments

Comments

@pkienzle
Copy link
Contributor

sasmodels/explore/multiscat.py demonstrates how to do a multiple scattering calculation with an FFT.

This code is not ready to go into sasview.

(1) There needs to be some code clean up in sasview/sasmodels before this can apply. I set up the calculation as a resolution function, but background needs careful handling. True background needs to be moved out of the I(q) calculation. "Background" due to incoherent scattering in the sample is subject to multiple scattering, and will need to be applied beforehand. The instrumental resolution will apply after the multiple scattering calculation, so resolutions need to stack. This will require a reorganization of resolution and q-samples is sasmodels (#839 and others). Oriented USANS (#742) will be easy to implement after reorg.

(2) The calculation is slow (1.5 s for multiple scattering vs. 0.001 s for single scattering in cylinder model). There should be lots of room for speedup using GPUs. I put some code into multiscat.py which shows how this might be implemented, but didn't try to make it run.

(3) Rather than moving data back and forth between the GPU for calculating the model then calculating the resolution, we can rearrange the code so that it stays there the whole time. The reorganization in (1) should be done with this in mind. The existing resolution functions will need to be updated to make use of the GPU, including SESANS.

Migrated from http://trac.sasview.org/ticket/1067

{
    "status": "new",
    "changetime": "2019-03-28T23:21:34",
    "_ts": "2019-03-28 23:21:34.268138+00:00",
    "description": "{{{sasmodels/explore/multiscat.py}}} demonstrates how to do a multiple scattering calculation with an FFT.\n\nThis code is not ready to go into sasview.\n\n(1) There needs to be some code clean up in sasview/sasmodels before this can apply.   I set up the calculation as a resolution function, but background needs careful handling.  True background needs to be moved out of the I(q) calculation.  \"Background\" due to incoherent scattering in the sample _is_ subject to multiple scattering, and will need to be applied beforehand.  The instrumental resolution will apply after the multiple scattering calculation, so resolutions need to stack.  This will require a reorganization of resolution and q-samples is sasmodels (#717 and others). Oriented USANS (#610) will be easy to implement after reorg.\n\n(2) The calculation is slow (1.5 s for multiple scattering vs. 0.001 s for single scattering in cylinder model).  There should be lots of room for speedup using GPUs.  I put some code into multiscat.py which shows how this might be implemented, but didn't try to make it run.\n\n(3) Rather than moving data back and forth between the GPU for calculating the model then calculating the resolution, we can rearrange the code so that it stays there the whole time.  The reorganization in (1) should be done with this in mind.  The existing resolution functions will need to be updated to make use of the GPU, including SESANS.\n",
    "reporter": "pkienzle",
    "cc": "",
    "resolution": "",
    "workpackage": "SasView Bug Fixing",
    "time": "2018-01-31T21:51:45",
    "component": "SasView",
    "summary": "multiple scattering",
    "priority": "major",
    "keywords": "",
    "milestone": "SasView 5.0.0",
    "owner": "",
    "type": "enhancement"
}
@RichardHeenan
Copy link
Contributor

Trac update at 2018/02/05 17:49:45: richardh commented:

Thank you Paul (K) this looks very interesting. Any chance you could render the docs to a page on the trac wiki to make them easier to read.

How reliable is the method ? e.g. will it deal well with sharp Bragg peaks on top of a relatively smooth SANS pattern.

Would be good to make sure that we save the raw I(Q) before the multiple scatter smearing.

@smk78
Copy link
Contributor

smk78 commented Mar 30, 2019

Trac update at 2018/02/12 12:02:28: smk78 commented:

Grethe Jensen noted that the coefficients for the different scattering orders needed modifying.

@smk78
Copy link
Contributor

smk78 commented Mar 30, 2019

Trac update at 2018/02/12 12:03:39: smk78 commented:

From: pkienzle
Sent: 08 February 2018

I added Grethe's corrections for the weights for the individual scattering powers. It is now available from

github.com/SasView/sasmodels/blob/master/explore/multiscat.py

I reshuffled the code somewhat and changed the calculation for the max scattering term. I quick check of the cylinder model shows that it is computing the same result.

@pkienzle
Copy link
Contributor Author

Trac update at 2019/03/28 23:21:34: pkienzle commented:

SESANS could is now using a log-space hankel transform. Could those ideas be used to speed up the 1-D case?

@ricleal ricleal transferred this issue from SasView/sasview Apr 23, 2019
@butlerpd butlerpd added this to the sasmodels 1.1 milestone May 2, 2021
@caitwolf caitwolf self-assigned this Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants