OpenGATE / opengate

Gate 10 (beta)
http://www.opengatecollaboration.org
GNU Lesser General Public License v3.0
46 stars 40 forks source link

TP source and Dose actor new features - squash #307

Closed tbaudier closed 8 months ago

tbaudier commented 11 months ago

Squash of PR https://github.com/OpenGATE/opengate/pull/293

Add a commit to modify the test to deal with master

I did a test on Mac to check time with test009_voxel and x100 for activity:

andiresch commented 11 months ago

After this pull request is merged we need to update the documentation -> me and @MartiDvrk can do that.

tbaudier commented 10 months ago

I updated with master branch. I had some problem with some tests and the function insert_suffix_before_extension, could you check on your side please? Thank you

tbaudier commented 9 months ago

Some tests still have errors:

test059_tpsource_weights

Importing opengate (thread 2513909) ... done
Simulation: create RunManager (single thread)
Simulation: initialize Geometry
Simulation: initialize Physics
Simulation: initialize Source
No source: no particle will be generated
Simulation: initialize Actors
Simulation: initialize G4RunManager
Simulation: check volumes overlap
--------------------------------------------------------------------------------
Simulation: START 
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1.mhd

/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1.mhd
edep
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
You try to compute statistical errors with only one or zero event ! The uncertainty value for all voxels has been fixed at 1
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
uncertainty
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep-uncertainty.mhd
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2.mhd

/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2.mhd
edep
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2-edep.mhd
You try to compute statistical errors with only one or zero event ! The uncertainty value for all voxels has been fixed at 1
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2-edep.mhd
uncertainty
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2-edep-uncertainty.mhd
Simulation: STOP. Run: 1. Time: 1.3 seconds.
--------------------------------------------------------------------------------
Runs      1
Events    1
Tracks    1
Step      0
Init      1.312985  1.31299 s  
Duration  2.376851  2.37685 s  
PPS       0
TPS       0
SPS       0
Start     Tue Jan  9 15:56:45 2024
Stop      Tue Jan  9 15:56:49 2024
Sim start 0 ps 
Sim end   1 s  
Threads   1
Arch      Darwin
Python    3.9.7
Track types: {'geantino': 1}
Compare tps Edep to single pb sources
 --------------------------------------- 
Images with same size/spacing/origin/dir ? True
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Img sums 0.0 vs 0.0 : 0.00 %  (tol 5.00 %)
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image diff computed on 62500/62500 
SAD (per event/total): 0.00 %  (tolerance is 70.00 %)
Save image test figure : /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep_test.png
Images with same size/spacing/origin/dir ? True
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Img sums 0.0 vs 0.0 : 0.00 %  (tol 5.00 %)
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image diff computed on 62500/62500 
SAD (per event/total): 0.00 %  (tolerance is 70.00 %)
Save image test figure : /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep_test.png
 --------------------------------------- 
Compare ratio of the two spots with expected ratio
invalid value encountered in divide

Sum energy dep for phantom 1:  0.0
MSum energy dep for phantom 2:  0.0
Ratio is:  nan
Expected ratio is:  2
 Ratio not as expected 

Error during the tests !

test069_rotation_DICOM_RT_plan

...
Area from theoretical calculation for all CP (mm2):  [448.625 354.275 485.625 335.775]
Area from MC simulations for all CP: (mm2) [423.25 423.25 423.25 423.25]

-> In test069, the dose actor need to be rotated?

MartiDvrk commented 9 months ago

Some tests still have errors:

test059_tpsource_weights

Importing opengate (thread 2513909) ... done
Simulation: create RunManager (single thread)
Simulation: initialize Geometry
Simulation: initialize Physics
Simulation: initialize Source
No source: no particle will be generated
Simulation: initialize Actors
Simulation: initialize G4RunManager
Simulation: check volumes overlap
--------------------------------------------------------------------------------
Simulation: START 
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1.mhd

/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1.mhd
edep
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
You try to compute statistical errors with only one or zero event ! The uncertainty value for all voxels has been fixed at 1
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
uncertainty
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep-uncertainty.mhd
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2.mhd

/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2.mhd
edep
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2-edep.mhd
You try to compute statistical errors with only one or zero event ! The uncertainty value for all voxels has been fixed at 1
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2-edep.mhd
uncertainty
/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_2-edep-uncertainty.mhd
Simulation: STOP. Run: 1. Time: 1.3 seconds.
--------------------------------------------------------------------------------
Runs      1
Events    1
Tracks    1
Step      0
Init      1.312985    1.31299 s  
Duration  2.376851    2.37685 s  
PPS       0
TPS       0
SPS       0
Start     Tue Jan  9 15:56:45 2024
Stop      Tue Jan  9 15:56:49 2024
Sim start 0 ps 
Sim end   1 s  
Threads   1
Arch      Darwin
Python    3.9.7
Track types: {'geantino': 1}
Compare tps Edep to single pb sources
 --------------------------------------- 
Images with same size/spacing/origin/dir ? True
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Img sums 0.0 vs 0.0 : 0.00 %  (tol 5.00 %)
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image diff computed on 62500/62500 
SAD (per event/total): 0.00 %  (tolerance is 70.00 %)
Save image test figure : /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep_test.png
Images with same size/spacing/origin/dir ? True
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] 
Img sums 0.0 vs 0.0 : 0.00 %  (tol 5.00 %)
Image1: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image2: [250 250   1] [0.4 0.4 2. ] [-49.8 -49.8   0. ] /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep.mhd
Image diff computed on 62500/62500 
SAD (per event/total): 0.00 %  (tolerance is 70.00 %)
Save image test figure : /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/output_test059_rtp/phantom_a_1-edep_test.png
 --------------------------------------- 
Compare ratio of the two spots with expected ratio
invalid value encountered in divide

Sum energy dep for phantom 1:  0.0
MSum energy dep for phantom 2:  0.0
Ratio is:  nan
Expected ratio is:  2
 Ratio not as expected 

Error during the tests !

test069_rotation_DICOM_RT_plan

...
Area from theoretical calculation for all CP (mm2):  [448.625 354.275 485.625 335.775]
Area from MC simulations for all CP: (mm2) [423.25 423.25 423.25 423.25]

-> In test069, the dose actor need to be rotated?

Test059 works for me. Is it possible that the .txt plan file for this test is not up to date? I can share here the file we use. TreatmentPlan2Spots.txt

MartiDvrk commented 8 months ago

@tbaudier I think now the only tests that are failing are the ones with MT on the Windows OS. I think we are getting close to closing this PR :)

dsarrut commented 8 months ago

tests with multithread must be named with "_mt" (lower case) to be ignored on windows

dsarrut commented 8 months ago

I changed the tolerance for test059_tpsource_abs_dose : is it ok for you @MartiDvrk @andiresch ?

Still tolerance issue with test059_tpsource_optics : @nkrah @guneet19 I did not change it yet, can you check please ?

guneet19 commented 7 months ago

@dsarrut I believe this testcase belongs to a different team. We have only worked on test013_phys_lists_6.