xopto / pyxopto

PyXOpto is a collection of python tools for performing Monte Carlo simulations of light propagation in turbid media.
GNU General Public License v3.0
30 stars 8 forks source link

Recording just the scattering events in the trace #3

Open dheligman opened 1 year ago

dheligman commented 1 year ago

Hi,

I was wondering if it was possible to just trace where scattering events occur and exclude the locations where the photon crosses a layer boundary?

best, Daniel

xopto commented 1 year ago

Hi, It is possible but not during the MC simulation. You would have to do custom filtering of the trace data, based on the change in the direction, location, and weight of the packet. Note that 0-degree scattering events in a nonabsorbing medium cannot be resolved from a clean propagation step.

dheligman commented 1 year ago

Would it be possible to add an extra flag to the trace flag to only record scattering events?

dheligman commented 1 year ago

I am doing some simulations that take up a lot of memory and it could reduce memory requirements

xopto commented 1 year ago

A general feature that would allow filtering of events in the kernel is planned but not yet available. Feel free to modify the kernel template to fit your needs. I am attaching a modified mcml.template.c example that illustrates this with one additional bool variable (search for packet_scattered variable). mcml.template.zip