When testing the output of the pmxc.mcxlab(cfg) (version 0.2.6) function for the trajectory output mode ( cfg['debuglevel'] = 'M') the id array contained only zeros, code below. When porting this function from matlab to pmcx I suspect a bug was introduced.
I also tried to construct an id array from the 'data' array in both the pmcx.run() and pmcx.mcxlab() cases which only worked for the pmcx.run() method.
cfg['detpos']=[[30,20,0,1]] # to detect photons, one must first define detectors
### output is c struct that needs to be converted to integers in the photon id case (other cases are floats which numpy automatically assumes I guess)
### output is c struct that needs to be converted to integers in the photon id case (other cases are floats which numpy automatically assumes I guess)
0.2.6
nphoton: 10
tstart: 0
tstep: 5e-09
tend: 5e-09
srcpos: [30, 30, 0, 1]
srcdir: [0, 0, 1, 0]
dict_keys(['traj', 'flux', 'stat'])
dict_keys(['pos', 'id', 'data'])
True
True
nphoton: 10
tstart: 0
tstep: 5e-09
tend: 5e-09
srcpos: [30, 30, 0, 1]
srcdir: [0, 0, 1, 0]
dict_keys(['traj', 'flux', 'stat'])
(6, 1720)
False
###############################################################################
# Monte Carlo eXtreme (MCX) -- CUDA #
# Copyright (c) 2009-2023 Qianqian Fang <q.fang at
neu.edu> #
#
https://mcx.space/ &
https://neurojson.org/ #
# #
# Computational Optics & Translational Imaging (COTI) Lab-
http://fanglab.org #
# Department of Bioengineering, Northeastern University, Boston, MA, USA #
###############################################################################
# The MCX Project is funded by the NIH/NIGMS under grant R01-GM114365 #
###############################################################################
# Open-source codes and reusable scientific data are essential for research, #
# MCX proudly developed human-readable JSON-based data formats for easy reuse,#
# Please consider using JSON (
https://neurojson.org/) for your research data #
###############################################################################
$Rev::996580$ v2023 $Date::2023-09-23 00:39:39 -04$ by $Author::Qianqian Fang$
###############################################################################
- code name: [Fermi MCX] compiled by nvcc [10.2] for CUDA-arch [350] on [Sep 23 2023]
- compiled with: RNG [xorshift128+] with Seed Length [4]
GPU=1 (NVIDIA GeForce RTX 3080 Ti) threadph=0 extra=10 np=10 nthread=327680 maxgate=1 repetition=1
initializing streams ...
init complete : 1 ms
requesting 1536 bytes of shared memory
launching MCX simulation for time window [0.00e+00ns 5.00e+00ns] ...
simulation run# 1 ...
kernel complete:
101 ms
retrieving fields ...
saved 1720 trajectory positions, total: 1720
detected 0 photons, total: 0
transfer complete:
109 ms
normalizing raw data ...
source 1, normalization factor alpha=20000000.000000
data normalization complete : 113 ms
simulated 10 photons (10) with 327680 threads (repeat x1)
MCX simulation speed: 2.00 photon/ms
total simulated energy: 10.00
absorbed: 39.98276%
(loss due to initial specular reflection is excluded in the total)
###############################################################################
# Monte Carlo eXtreme (MCX) -- CUDA #
# Copyright (c) 2009-2023 Qianqian Fang <q.fang at
neu.edu> #
#
https://mcx.space/ &
https://neurojson.org/ #
# #
# Computational Optics & Translational Imaging (COTI) Lab-
http://fanglab.org #
# Department of Bioengineering, Northeastern University, Boston, MA, USA #
###############################################################################
# The MCX Project is funded by the NIH/NIGMS under grant R01-GM114365 #
###############################################################################
# Open-source codes and reusable scientific data are essential for research, #
# MCX proudly developed human-readable JSON-based data formats for easy reuse,#
# Please consider using JSON (
https://neurojson.org/) for your research data #
###############################################################################
$Rev::996580$ v2023 $Date::2023-09-23 00:39:39 -04$ by $Author::Qianqian Fang$
###############################################################################
- code name: [Fermi MCX] compiled by nvcc [10.2] for CUDA-arch [350] on [Sep 23 2023]
- compiled with: RNG [xorshift128+] with Seed Length [4]
GPU=1 (NVIDIA GeForce RTX 3080 Ti) threadph=0 extra=10 np=10 nthread=327680 maxgate=1 repetition=1
initializing streams ...
init complete : 1 ms
requesting 1536 bytes of shared memory
launching MCX simulation for time window [0.00e+00ns 5.00e+00ns] ...
simulation run# 1 ...
kernel complete:
101 ms
retrieving fields ...
saved 1720 trajectory positions, total: 1720
detected 0 photons, total: 0
transfer complete:
110 ms
normalizing raw data ...
source 1, normalization factor alpha=20000000.000000
data normalization complete : 114 ms
simulated 10 photons (10) with 327680 threads (repeat x1)
MCX simulation speed: 2.00 photon/ms
total simulated energy: 10.00
absorbed: 39.98276%
(loss due to initial specular reflection is excluded in the total)