Git Product home page Git Product logo

Comments (4)

fangq avatar fangq commented on July 27, 2024 1

thanks, I am able to reproduce this issue in both python and mcxlab. I agree with you both the scattering behavior and the out-of-bbx trajectories are incorrect. I will look into this and will post my updates here.

mcxlab test code is attached

%%octave

cfg.nphoton=1e4;
cfg.seed=42;

cfg.vol=permute(uint8(ones(32,32)), [3,1,2]); % from 2d to 3d
cfg.vol(1,10:22, 10:22)=2;
cfg.issrcfrom0=1;
cfg.srctype='pencil';

cfg.srcpos=[0,0,16];   % src position must be located in the 2D plane
cfg.srcdir=[0 1 0];    % src dir must align in the plan (y-z in this case)

cfg.gpuid=1;
cfg.autopilot=1;

cfg.prop=[0, 0, 1, 1,
    0.02, 1e-11, 0.9, 1,
    0.30, 80.25, 0.9, 1];
cfg.unitinmm=0.1;

cfg.tstart=0;
cfg.tend=5e-9;
cfg.tstep=5e-9;
cfg.outputtype='energy';

[flux,detp,vol,seeds,traj]=mcxlab(cfg);
sortedlines=mcxplotphotons(traj);

from mcx.

fangq avatar fangq commented on July 27, 2024

@dkalsan, again, thanks for reporting this issue.

I looked into it further, and was able to identify the cause - the handling of near-zero mus causes issues when combined with the new DDA ray-tracing approach implemented last year. The photon voxel indices (flipdir(1:3)) no longer follow the floating-point positions (p.{x,y,z}). this was not a problem before using the DDA based photon advancing.

after a one-line change, I believe this behavior has been fixed. see my above commit.

the above matlab demo code now returns correct trajectories, see below.

feel free to reopen the ticket if you see anything else is not fixed.

fixed_traj

from mcx.

fangq avatar fangq commented on July 27, 2024

Interestingly, mcxcl/mcxlabcl does not have this behavior - it uses native_divide for the affected line, which appears to be able to handle divided by 0.

from mcx.

dkalsan avatar dkalsan commented on July 27, 2024

Perfect, I will give it a test. Thanks a lot for taking the time for this!

from mcx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.