You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
###### code ########
#%% []
import numpy as np
import pmcx
import matplotlib.pyplot as plt
from struct import unpack
#%%[]
print(pmcx.__version__)
cfg={}
cfg['nphoton']=1e1
cfg['vol']=np.ones([60, 60, 60], dtype='uint8')
cfg['vol'][20:40, 30:40, 20:30]=2
cfg['tstart']=0
cfg['tend']=5e-9
cfg['tstep']=5e-9
cfg['srcpos']=[30,30,0]
cfg['srcdir']=[0,0,1]
cfg['prop']=[[0, 0, 1, 1], [0.005, 1, 0.01, 1.37], [0.1, 10, 0.9, 1]]
cfg['detpos']=[[30,20,0,1]] # to detect photons, one must first define detectors
cfg['debuglevel'] = 'M'
res = pmcx.mcxlab(cfg)
print(res.keys())
print(res['traj'].keys())
print(np.all(res['traj']['id'] == 0))
### 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)
structAr = np.asarray(res['traj']['data'][0], order = 'C')
lenstr = str(len(structAr))
traj_id = np.array( unpack( lenstr + 'I', structAr))
print(np.all(traj_id == 0))
plt.figure()
plt.plot(res['traj']['id'])
plt.show()
res2 = pmcx.run(cfg)
print(res.keys())
print(res2['traj'].shape)
### 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)
structAr = np.asarray(res2['traj'][0], order = 'C')
lenstr = str(len(structAr))
traj_id = np.array( unpack( lenstr + 'I', structAr))
print(np.all(traj_id == 0))
plt.figure()
plt.plot(traj_id)
plt.show()
The text was updated successfully, but these errors were encountered:
please see the bug report by Gijs Buist in this mailing list post:
https://groups.google.com/g/mcx-users/c/O79Yk4G8_xM
the example to reproduce the issue
The text was updated successfully, but these errors were encountered: