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

'wp' output is not consistent with detp.nscat #92

Closed
andreafarina opened this issue Sep 1, 2024 · 2 comments
Closed

'wp' output is not consistent with detp.nscat #92

andreafarina opened this issue Sep 1, 2024 · 2 comments

Comments

@andreafarina
Copy link
Contributor

Dear @fangq , sorry again to bother but I'm going to checking also the Jacobian for mus now and I've found an issue.
The situation is the same discussed in #91 , simple slab homogeneous.
I run the reference simulation with mua = 0 to be sure that the initial weights in the replay are 1 for each photon. From the output of detp.nscat, I obtain the distribution of total scattering events by binning and histogramming the photons based on their time-of-flight.

After that, I replay the detected photons with 'wp'.

  1. The first thing that is strange to me is that the data obtained are floating points. With replyweight = [1,1,..] wp, as described in your paper, should exactly be the number of scattering events in the element/node. I suppose that, due to the discretization, there is some kind of internal interpolation.
  2. By summing all the wp data in the elements/nodes I rigorously have to obtain the same distribution I calculated from detp.nscat. This is not the case. wp always overestimates the total scattering events and this seems to depend both on mus and on the number of elements/nodes. It is like some scattering events are shared among the elements.

This error propagates in the final calculation of the Jacobian mus.

I attach the MATLAB code, together with the function I use for Extracting and binning.
Here is the screenshot including also the comparison of wl discussed in #91 that is solved by forcing the current mua = 0 also for mua>0.

Thanks a lot for your support.

Best regards

Andrea

Screenshot 2024-09-01 at 16 17 41

demo_example_replay_AF2.zip

@fangq
Copy link
Owner

fangq commented Sep 1, 2024

hi @andreafarina, the wp output is not accumulative scattering event counts in each cell, but the weighted average - each replayed photon packet has different weight, and their detected weights have to be considered in the replay.

the raw output of wp mode is the \bar{p} item described in our replay paper, see Eq 9 in the replay paper.

image

to form the Jacobian of mus, one should divide \bar{p} by mus in each cell, and add the Jacobian of the mua (-\bar{L}).

we have implemented these in our provided mmcjmus.m script, please see the post-processing of the wp output here

https://github.com/fangq/mmc/blob/v2024.2/matlab/mmcjmus.m#L61-L72

let me know if this matches your expectations.

@andreafarina
Copy link
Contributor Author

andreafarina commented Sep 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants