Comments (4)
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.
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.
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.
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.
from mcx.
Related Issues (20)
- `cfg.bc` and `cfg.isreflect` handling does not follow the specification
- cloud-based version exemples return parse errors and display crashes HOT 2
- desktop version on macos seems brokem HOT 1
- Support simulating multiple sources of the same type
- Misleading Documentation for Gaussian Source Type HOT 1
- Replay using photon seeds saved as results_detp.jdat fails HOT 2
- Unexpected photon trajectories for very low scattering coefficients HOT 4
- Detected photon discrepancy between pmcx and mcxlab HOT 4
- Output option -F mc2 produces a .jnii file
- pmcx incorrectly set default source focal length to 1
- Build V2020 requires to fill an expired form. HOT 1
- MCX Studio build not working on MacOS Montery 12.4 HOT 7
- pmcx volume loading differs from mcx HOT 1
- Pytorch seems to be broken after calling pmcx.run()
- Tutorial on how to import arbitrary 3d shapes. HOT 1
- Error in make HOT 1
- pmcx buffer overflow error if bc parameter has 12 characters HOT 1
- "misaligned address" error when using cfg.invcdf and cfg.angleinvcdf
- Failed to apply double-float-buffer approach in #41 to `dref` cause loss of accuracy
- Tissue propoerty for different wavelenght HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcx.