Git Product home page Git Product logo

Comments (4)

fangq avatar fangq commented on July 27, 2024 1

the nan issue is now fixed. it was due to the transmission function - I thought testing Rtotal<1 is enough to ensure the sqrt() is always positive inside, but this was not true after multiplying n1/n2.

https://github.com/fangq/mcx/blob/master/src/mcx_core.cu#L1305

the negative z-dir sign issue is not fixed though. This is a bigger problem - it appears that my algorithm for determining flipdir is problematic. for the incorrect direction vector outputs, the flipdir mostly 0, 1 (meaning that the photon exiting the domain via the x or y-plane, which is not expected).

this need to modify hitgrid and determine flipdir more rigorously.

from mcx.

fangq avatar fangq commented on July 27, 2024 1

problem fixed. I revert the code back to various previous versions, and found out that the issue appears after commit 95b4370, and the only line in that commit related to this is unset isdet value when a photon moves outside of the bounding box. After placing this line back, the erroneous detected photons are gone.

closing the issue.

from mcx.

yaoruoyang avatar yaoruoyang commented on July 27, 2024

I tried mmclab quite a few times and don't see similar photon angle issues there. Maybe by comparing the implementation of flipdir in mmc/mcx we are able to find something.

from mcx.

fangq avatar fangq commented on July 27, 2024

yes, flipdir is unique to mcx - because in mcx, the boundary is always parallel to x/y/z plane.

here is a sample subset of the problematic photons from your test script:

        px        py         pz         flipdir         vy          vz
  27.9998779  36.9893112  -0.0000505           0   0.9087040   0.2857881
  26.9998779  39.1745987  -0.0000450           0  -0.3674004   0.4359206
  27.9998779  39.1239052  -0.0000027           0   0.3945841   0.5882843
  31.4349670  41.0001221  -0.0000350   1.0000000   0.6205006   0.2128905
  28.9998779  38.4230690  -0.0000168           0   0.0702995   0.6735473
  30.4717197  37.0001221  -0.0000498   1.0000000   0.5363353   0.6355564
  28.9998779  38.2464218  -0.0000009           0  -0.8422259   0.2530095
  30.3554649  38.5345802  -0.0000204   2.0000000   0.6326571   0.6573589
  29.9998779  41.9801216  -0.0000196           0   0.5621805   0.0599955
  29.9998779  38.4932899  -0.0000314           0  -0.6609473   0.3100340

for example, for the first photon, mcx determines that the photon exits the domain through x-plane (flipdir=0), but it looks like it actually has either already exited the domain through z-plane (because z is negative) before this step, or made a mistake.

it was these misjudged exit photons that causes the incorrect vz sign.

when plotting the positions, I also saw some scattered points that are not on the detector aperture. I don't think I've seen these before.

bad_exit_positions

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.