Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate dose actor #481

Merged
merged 205 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
bbd7434
opengate_test refactored, almost complete, improve on checking/disabl…
Sep 26, 2024
2bebda3
Start implementing devtools module
nkrah Sep 27, 2024
687669b
Start implementing test079_check_initcpp_exists.py
nkrah Sep 27, 2024
bbbc95f
Update docstring and print out messages in devtools.py
nkrah Sep 28, 2024
a818528
Update test079_check_initcpp_exists.py
nkrah Sep 28, 2024
bbe4dc9
Remove print out used for debugging
nkrah Sep 28, 2024
02c31c7
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Sep 28, 2024
dcf5bfc
Extend tests.utility.test_ok to handle a list of exception as optiona…
nkrah Sep 30, 2024
0b553ac
In devtools.py: split class crawling and class check; improve code
nkrah Sep 30, 2024
a3b6129
Update test079_check_initcpp_exists.py
nkrah Sep 30, 2024
e902887
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Sep 30, 2024
59953f6
mp now default; added sp evaluation for the failed jobs in mp; added …
Oct 1, 2024
e534520
added nohup.out to gitignore
Oct 1, 2024
42eef3a
Merge branch 'master' of github.com:OpenGATE/opengate into multiproce…
Oct 1, 2024
9e9769d
renamed test_id to start_id; moved out save option to the main file
Oct 2, 2024
e960657
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 2, 2024
1a1a15f
nicer print of logfilename
Oct 2, 2024
9bbcad2
run one test case before starting to trigger data download if needed
Oct 3, 2024
65f5ec3
no automatic merge possible - resolved merge conflict
Oct 3, 2024
ee3353c
filter files with dependencies on previous simulations and run them i…
Oct 3, 2024
31a2db9
explicitly declared dependency on other tests in tests
Oct 4, 2024
ac4d0ca
added empty string in dasbhoard dict for consistency with opengate_te…
Oct 4, 2024
5d9ad39
added empty str to dashbord output and cleaned unused code
Oct 4, 2024
180bef0
Remove debug print "loading opengate"
dsarrut Oct 7, 2024
864bb29
fixed github workflow?
Oct 7, 2024
30880af
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Oct 8, 2024
698d7b9
Improve ActorOutputUsingDataItemContainer.get_active()
nkrah Oct 8, 2024
e6e413d
Add FIXME
nkrah Oct 8, 2024
a3f87f9
Rename method copy_user_info to configure_like
nkrah Oct 8, 2024
ee6567f
Implement ActorBase.configure_like()
nkrah Oct 8, 2024
d1696f7
In SingleItkImageWithVariance: set variance to 0 where not possible t…
nkrah Oct 8, 2024
f7b02e2
Update DoseActor (python) to use an actor output with dose and dose_s…
nkrah Oct 8, 2024
0986054
Update GateDoseActor (C++) to use an actor output with dose and dose_…
nkrah Oct 8, 2024
18343ef
Update kwarg ignore_value from 1 to 0 in calls to tests.utility.asser…
nkrah Oct 8, 2024
14648bd
In SingleItkImageWithVariance.get_variance_or_uncertainty(): set vari…
nkrah Oct 8, 2024
d40f74b
Improve ignora_value logic in assert_images()
nkrah Oct 8, 2024
5de9c62
Update tests and tolerances in test008_dose_actor.py
nkrah Oct 8, 2024
8819ee1
Update calls to assert_images: signature has changed
nkrah Oct 8, 2024
2e1bc08
Update calls to assert_images in inactive code: signature has changed
nkrah Oct 8, 2024
4eb4e40
Optimize code in create_density_img() and let it return g/cm3
nkrah Oct 8, 2024
e0e7a03
Remove density scoring via MC from DoseActor because it is incorrect …
nkrah Oct 8, 2024
2e13b48
Update test008_dose_actor_2.py
nkrah Oct 8, 2024
f783362
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 8, 2024
5892a62
Merge pull request #480 from OpenGATE/pre-commit-ci-update-config
tbaudier Oct 8, 2024
2422107
Merge pull request #479 from OpenGATE/consolidate5
tbaudier Oct 8, 2024
97b2fce
Added option to pass and specify the number of processes in multiproc…
Oct 8, 2024
8877a08
Modifications by pre-commit
MaxTousss Oct 8, 2024
33a36f2
Implement logical check in GateObject.__setattr__
nkrah Sep 27, 2024
e3e4160
Improve warning message in GateObject.__setattr__
nkrah Sep 27, 2024
c5d80ad
Suggest close matches in GateObject.__setattr__
nkrah Sep 27, 2024
be7567d
Update imports in base.py
nkrah Sep 27, 2024
83be31f
Update docstring of process_cls
nkrah Sep 27, 2024
a6e2808
Update comment in process_cls
nkrah Sep 27, 2024
05593af
raise GateImplementationError in process_cls rather than fatal
nkrah Sep 27, 2024
734e59d
add and remove comments in process_cls()
nkrah Sep 27, 2024
7244a62
Implement wrap_init_method() and trigger it from process_cls()
nkrah Sep 27, 2024
5d01a8b
Include **kwargs in signature of Simulation.__init__
nkrah Sep 27, 2024
422dc17
Decalre expected_number_of_events in Simulation.__init__
nkrah Sep 27, 2024
a90e4e5
Implement Simulation.reset_warnings()
nkrah Sep 27, 2024
e6312ad
Implement Simulation.warn_user()
nkrah Sep 27, 2024
100c68b
Handle warnings raise during engine run (potentially in subprocess)
nkrah Sep 27, 2024
847734a
Remove explicit calls to self.__finalize_init__() (now automatic)
nkrah Sep 27, 2024
c6486b8
Enhance test078_check_userinfo.py
nkrah Sep 27, 2024
2077431
Improve comment in base.py
nkrah Sep 27, 2024
12f1765
Implement getter/setter property for simulation in GateObject
nkrah Sep 27, 2024
f9be1c6
Implement a temporary warning cache for GateObject
nkrah Sep 27, 2024
2796a54
Use dir() builtin in GateObject.__finalize_init__()
nkrah Sep 27, 2024
5fb0420
Improve warning message in GateObject.__setattr__()
nkrah Sep 27, 2024
1beeb00
Move declaration of _user_warnings to the top of init
nkrah Sep 27, 2024
ce6bb23
Remove SimulationStatisticsActor.__finalize_init__ (not needed anymore)
nkrah Sep 27, 2024
be709e6
Implement specialized __finalize_init__() in VolumeBase
nkrah Sep 27, 2024
2e3bf33
remove specialized implementation ActorBase.__finalize_init__() - not…
nkrah Sep 27, 2024
b0ef0b7
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Sep 27, 2024
0124b44
Extend test078_check_userinfo.py
nkrah Sep 28, 2024
d1685ea
Add @wraps(original_init) decorator to wrapped_init
nkrah Sep 28, 2024
c5ec2ac
Implement GateObject.has_been_processed() classmethod to make it expl…
nkrah Sep 28, 2024
446d6fb
Update comments in base.py
nkrah Sep 28, 2024
3ae49a6
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Sep 30, 2024
0a1c932
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Sep 30, 2024
a5e114f
Fix spatial blurring for parameterised volumes.
dsarrut Sep 30, 2024
3a708d1
Update actor properties and improve digitizer documentation
dsarrut Sep 30, 2024
2ce4729
Add compare_root4 for some tests
dsarrut Sep 30, 2024
c39cc7d
Rename statistical fields for consistency
dsarrut Sep 30, 2024
cbfccef
Fix typo and add attribute in geometry volumes
dsarrut Sep 30, 2024
b64f439
Refactor date attribute handling and thread statistics.
dsarrut Sep 30, 2024
e36aa33
Refactor overlap check flag naming convention
dsarrut Sep 30, 2024
f432980
print Qt and Qt version in opengate_info
dsarrut Oct 1, 2024
efa5aa0
Add type hints to Simulation class for enhanced IDE support
dsarrut Oct 1, 2024
cc27b5f
Suppress debug prints and add Geant4 Qt details
dsarrut Oct 1, 2024
caee927
Fix progress bar step calculation in GateSourceManager
dsarrut Oct 3, 2024
1a1845e
update data for bg source iec
dsarrut Oct 3, 2024
3d758a2
`read_stat_file` now guess if json or legacy format
dsarrut Oct 3, 2024
9493518
correct bg source for iec nema phantom
dsarrut Oct 3, 2024
9ff160e
fix include position in GateInfo.cpp
alexis-pereda Oct 3, 2024
905a560
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Oct 8, 2024
427d516
Remove debug print "loading opengate"
dsarrut Oct 7, 2024
b2ee356
Fix opengate_user_info.py
nkrah Oct 8, 2024
d8cf69b
Remove obsolete actors/builder.py module and update element.py
nkrah Oct 8, 2024
d236170
Fix tests that did not use if __name__ == "__main__" clause
nkrah Oct 8, 2024
bd168cc
Extend devtools.py
nkrah Oct 8, 2024
82968fc
Add test079_check_classes_are_processed.py
nkrah Oct 8, 2024
786b6f9
Add explicit process_cls calls where they were missing
nkrah Oct 8, 2024
4082c9c
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 8, 2024
55f7b10
Forgot to test case where none are available... Now it should work!
MaxTousss Oct 8, 2024
251934d
Improve apply_class_check_to_package()
nkrah Oct 8, 2024
47c091b
Implement automatic pyi file generation in devtools.py
nkrah Oct 8, 2024
ff90357
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 8, 2024
ec00a07
Fixes in automatic pyi file generation in devtools.py
nkrah Oct 8, 2024
151eeb7
Merge remote-tracking branch 'origin/devtools' into devtools
nkrah Oct 8, 2024
0dffbe3
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 8, 2024
7b42395
added test for g4 version
Oct 9, 2024
98695f4
converted test053_phid_6_it_model to _mt as it has dependency on _mt
Oct 9, 2024
9f79bea
made all test53 depending on a mt test to mt themselves
Oct 9, 2024
102d46a
Merge branch 'OpenGATE:master' into multiprocess_tests
andiresch Oct 9, 2024
b7eefd1
Merge pull request #482 from MaxTousss/g4Data_dowload_if_needed
tbaudier Oct 9, 2024
4389b3a
Enable Position Independent Code and update README
dsarrut Oct 9, 2024
9ed8f88
Restore original overlap check flag after modifications
dsarrut Oct 9, 2024
2518f8e
Add Jaszczak phantom with background source in simulation
dsarrut Oct 9, 2024
a0d0ebe
linux: workaround to remove TLS bug
dsarrut Oct 9, 2024
e361f57
redo import that were removed by mistake
dsarrut Oct 9, 2024
45359a1
fixed bug in starting failing jobs?
Oct 9, 2024
50266f6
Merge branch 'multiprocess_tests' of github.com:andiresch/opengate in…
Oct 9, 2024
0a003d9
fixed mp problem: all tests writing to the identical file; changed to…
Oct 9, 2024
0679fd2
Towards version 10.0beta09
tbaudier Oct 9, 2024
61f647e
fixed file paths test 28
Oct 9, 2024
efc5dbe
minor change
Oct 9, 2024
5593689
xMerge branch 'multiprocess_tests' of github.com:andiresch/opengate i…
Oct 9, 2024
abd2e2c
converted to unique filenames for tests
Oct 10, 2024
9bd2c7f
disentangled paths in last tests
Oct 10, 2024
7c7bead
deleted wrong file
Oct 10, 2024
ff8bc7c
Set specific random seed and update sum_tolerance
dsarrut Oct 10, 2024
539c7b4
read the expected g4 version from github workflow
Oct 11, 2024
36f9090
Remove LD_PRELOAD in the CI and in the init
tbaudier Oct 14, 2024
f48b2ff
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 14, 2024
6f0adb2
put read planned g4 version into try except statement if not available
Oct 14, 2024
d21491a
Merge pull request #483 from OpenGATE/consolidate5
tbaudier Oct 14, 2024
baeea9e
Update G4 version in developer_guide.md
tbaudier Oct 14, 2024
793c5bf
Merge pull request #487 from andiresch/multiprocess_tests
dsarrut Oct 14, 2024
c8d5eb9
Merge pull request #488 from OpenGATE/tbaudier-patch-1
tbaudier Oct 15, 2024
c9acd5c
Git ignore .pyi files
nkrah Oct 16, 2024
df26682
Merge remote-tracking branch 'origin/master' into devtools
nkrah Oct 16, 2024
926087a
Update user_guide_2_4_actors.md
jizhang02 Oct 16, 2024
6968db5
Use macos13 instead of macos12
tbaudier Oct 16, 2024
46a58c6
Merge pull request #491 from OpenGATE/macos13_githubActions
tbaudier Oct 16, 2024
68a40d5
Merge branch 'master' into devtools
tbaudier Oct 16, 2024
dff952c
Merge pull request #490 from jizhang02/master
tbaudier Oct 16, 2024
3ed7129
Add pyyaml dependency for opengate_tests
tbaudier Oct 16, 2024
842bd3c
Clearer print
tbaudier Oct 16, 2024
f9428e0
Update user_guide_2_0_simulation.md
jizhang02 Oct 16, 2024
6b53a2f
Create an opengate_core wheel whithout visu option
tbaudier Oct 9, 2024
bb97e99
Merge pull request #493 from OpenGATE/consolidate_opengate_tests
tbaudier Oct 16, 2024
d008dea
Merge pull request #468 from OpenGATE/devtools
nkrah Oct 16, 2024
4336b7f
Merge pull request #484 from OpenGATE/novis
dsarrut Oct 17, 2024
5e18fa3
Update user_guide_2_0_simulation.md
dsarrut Oct 17, 2024
72eb0a4
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 17, 2024
3e92e30
Merge pull request #495 from jizhang02/master
dsarrut Oct 17, 2024
40852b5
Revert "Create an opengate_core wheel whithout visu option"
dsarrut Oct 17, 2024
aa3d712
Merge pull request #497 from OpenGATE/revert-484-novis
dsarrut Oct 17, 2024
225c24d
Improve ActorOutputUsingDataItemContainer.get_active()
nkrah Oct 8, 2024
8cf7e34
Add FIXME
nkrah Oct 8, 2024
3b318ed
Rename method copy_user_info to configure_like
nkrah Oct 8, 2024
caeec04
Implement ActorBase.configure_like()
nkrah Oct 8, 2024
b74d772
In SingleItkImageWithVariance: set variance to 0 where not possible t…
nkrah Oct 8, 2024
4d43b3b
Update DoseActor (python) to use an actor output with dose and dose_s…
nkrah Oct 8, 2024
0591af0
Update GateDoseActor (C++) to use an actor output with dose and dose_…
nkrah Oct 8, 2024
930ed22
Update kwarg ignore_value from 1 to 0 in calls to tests.utility.asser…
nkrah Oct 8, 2024
a1bbe1f
In SingleItkImageWithVariance.get_variance_or_uncertainty(): set vari…
nkrah Oct 8, 2024
ba114fd
Improve ignora_value logic in assert_images()
nkrah Oct 8, 2024
9c2cf53
Update tests and tolerances in test008_dose_actor.py
nkrah Oct 8, 2024
b311a90
Update calls to assert_images: signature has changed
nkrah Oct 8, 2024
866e0f9
Update calls to assert_images in inactive code: signature has changed
nkrah Oct 8, 2024
7f2f052
Optimize code in create_density_img() and let it return g/cm3
nkrah Oct 8, 2024
360e9b2
Remove density scoring via MC from DoseActor because it is incorrect …
nkrah Oct 8, 2024
3a6606d
Update test008_dose_actor_2.py
nkrah Oct 8, 2024
6ad0fee
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 8, 2024
6d24ea2
Merge remote-tracking branch 'origin/consolidate_dose_actor' into con…
nkrah Oct 18, 2024
9b7a768
Make assert_images() backwards compatible - necessary for some tests
nkrah Oct 18, 2024
47ccdca
Update test073_helpers.py to changes in assert_images()
nkrah Oct 18, 2024
1ece53e
Update test059_tpsource_gantry_rot.py
nkrah Oct 18, 2024
fde3894
Fix in GateDoseActor: correctly consider density of water for dose
nkrah Oct 18, 2024
a446398
Minor code cleaning in test041_dose_actor_dose_to_water_mt.py
nkrah Oct 18, 2024
16dcabd
Update test038_gan_phsp_spect_gan_aa.py to changes in assert_images()
nkrah Oct 18, 2024
1e47d18
Update test033_rotation_spect_aa_helpers.py to changes in assert_imag…
nkrah Oct 18, 2024
942ddac
Update test028_ge_nm670_spect_4_acc_angle_helpers.py to changes in as…
nkrah Oct 18, 2024
8b6aa88
Update test029 to changes in assert_images()
nkrah Oct 18, 2024
92bb82f
Update test023_filters_iec_phantom.py to changes in assert_images()
nkrah Oct 18, 2024
37fe154
Update test020_profiling.py to changes in assert_images()
nkrah Oct 18, 2024
76cd902
Add comment in test028_ge_nm670_spect_4_acc_angle_helpers.py
nkrah Oct 18, 2024
3f11274
Update test017_repeater.py to changes in assert_images()
nkrah Oct 18, 2024
a69e281
Update test010 to changes in assert_images()
nkrah Oct 18, 2024
2c24979
Update test015 to changes in assert_images()
nkrah Oct 18, 2024
9bfbfc2
Remove obsolete test008_dose_actor_2.py
nkrah Oct 18, 2024
4994edc
Update test009 to changes in assert_images()
nkrah Oct 18, 2024
c38473b
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 18, 2024
4b2ff08
Rename ImageVolume.read_input_image() to load_input_image()
nkrah Oct 18, 2024
79e121f
In ImageVolume: Create getter for itk_image that warns user if not lo…
nkrah Oct 18, 2024
44b63c2
Update test032_voxel_vs_volume.py to changes in assert_images() and c…
nkrah Oct 18, 2024
a5cd12d
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 18, 2024
eca6b3e
Make logger show level name, e.g. WARNING
nkrah Oct 18, 2024
5745cf9
Update test028 to changes in assert_images()
nkrah Oct 18, 2024
1bc4886
Update test033_rotation_spect_aa_helpers.py to changes in assert_imag…
nkrah Oct 18, 2024
05602ac
Adapt test028_ge_nm670_spect_2_helpers.py to changes in assert_images()
nkrah Oct 19, 2024
0107d37
Adapt test009_voxels.py to changes in assert_images()
nkrah Oct 19, 2024
62ac33f
remove obsolete code and clean code
nkrah Oct 19, 2024
5698fbb
[pre-commit.ci] Automatic python and c++ formatting
pre-commit-ci[bot] Oct 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: [3.9, '3.10', '3.11', '3.12']

env:
Expand All @@ -33,7 +33,7 @@ jobs:
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
export GIT_SSL_NO_VERIFY=1
git submodule update --init --recursive
elif [[ ${{ matrix.os }} == "macos-12" ]]; then
elif [[ ${{ matrix.os }} == "macos-13" ]]; then
export GIT_SSL_NO_VERIFY=1
git submodule update --init --recursive
else
Expand All @@ -53,7 +53,7 @@ jobs:
varOS=`cat /etc/os-release | grep "VERSION=" | grep -oP '(?<=\").*?(?=\")'`
varOS=($varOS)
echo "release=${varOS[0]}" >> $GITHUB_OUTPUT
elif [[ ${{ matrix.os }} == "macos-12" ]]; then
elif [[ ${{ matrix.os }} == "macos-13" ]]; then
varOS=`sw_vers | grep "ProductVersion:"`
varOS="${varOS#*:}"
echo "release=${varOS:1}" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -103,18 +103,18 @@ jobs:
mv dist_opengate/* dist/
fi
- uses: conda-incubator/setup-miniconda@v3
if: (matrix.os == 'macos-12') || (matrix.os == 'windows-latest')
if: (matrix.os == 'macos-13') || (matrix.os == 'windows-latest')
with:
miniconda-version: "latest"
auto-update-conda: true
activate-environment: opengate_core
python-version: ${{ matrix.python-version }}
- name: Set up Homebrew
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-13'
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Create opengate_core Wheel Mac
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-13'
shell: bash -l {0}
run: |
brew install python@3.12 || true
Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
delocate-listdeps --all fixed_wheels/*.whl
mv fixed_wheels dist
cd dist
find . -name '*whl' -exec bash -c ' mv $0 ${0/macosx_12_0/macosx_10_9}' {} \;
find . -name '*whl' -exec bash -c ' mv $0 ${0/macosx_13_0/macosx_10_9}' {} \;
cd ../..
mv core/dist .
- name: Create opengate_core Wheel Windows
Expand Down Expand Up @@ -299,7 +299,7 @@ jobs:
# env:
# GEANT4_VERSION: 'v11.2.1'
# ITK_VERSION: 'v5.2.1'
# runs-on: macos-12
# runs-on: macos-13
# steps:
# - name: Checkout github repo
# uses: actions/checkout@v4
Expand Down Expand Up @@ -348,7 +348,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: [3.9, '3.10', '3.11', '3.12']
steps:
- uses: actions/download-artifact@v4
Expand Down Expand Up @@ -377,7 +377,7 @@ jobs:
export OSNAME="manylinux"
export PLATFORM="x86_"
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
elif [[ ${{ matrix.os }} == "macos-12" ]]; then
elif [[ ${{ matrix.os }} == "macos-13" ]]; then
export OSNAME="macosx"
export PLATFORM="x86_"
which python
Expand All @@ -397,10 +397,6 @@ jobs:
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
path=`opengate_library_path.py -p site_packages`
export LD_LIBRARY_PATH="${path}/opengate_core.libs":${LD_LIBRARY_PATH}
path=`opengate_library_path.py -p libG4processes`
export LD_PRELOAD=${path}:${LD_PRELOAD}
path=`opengate_library_path.py -p libG4geometry`
export LD_PRELOAD=${path}:${LD_PRELOAD}
fi
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
path=`opengate_library_path.py -p site_packages`
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__
.DS_Store
*.jpeg
*.save
*.pyi

/.idea/
.idea
Expand Down Expand Up @@ -163,3 +164,5 @@ singles.root
opengate/tests/src/geant4_out.txt
failing_tests.txt
opengate/tests/output_dashboard

nohup.out
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.0
rev: v19.1.1
hooks:
- id: clang-format
ci:
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See the [User Guide](https://opengate-python.readthedocs.io/en/latest/user_guide

### How to install (short version)

*Compatible with Python 3.9, 3.10, 3.11, 3.12. On Windows multithreading, Qt visualization and the "spawn new subprocess" are not (yet) available.*
*Compatible with Python 3.9, 3.10, 3.11, 3.12. On Windows multithreading and Qt visualization are not (yet) available.*

First, create an environment (not mandatory but highly advised)

Expand All @@ -23,7 +23,7 @@ source opengate_env/bin/activate
or you can use the conda environment.

```
conda create --name opengate_env python=3.9
conda create --name opengate_env python=3.12
conda activate opengate_env
```

Expand All @@ -33,6 +33,8 @@ pip install --upgrade pip
pip install --pre opengate
```

*Warning* while it is still beta, the `--pre` option is needed.

If you already installed the packages and want to upgrade to the latest version:

```
Expand All @@ -44,19 +46,24 @@ Once installed, you can run all tests:
opengate_tests
````

**WARNING** The first time you run this command, the geant4 data and the test data will be downloaded. If the download fails (on some systems), try to add the following command before running opengate_tests:
**WARNING (1)** The first time you run this command, the geant4 data and the test data will be downloaded. If the download fails (on some systems), try to add the following command before running opengate_tests:
````
export GIT_SSL_NO_VERIFY=1
````

All tests are in the folder [here](https://github.com/OpenGATE/opengate/tree/master/opengate/tests/src). The test data (binary files) are stored, for technical reasons, in this git: https://gitlab.in2p3.fr/opengamgate/gam_tests_data (which is stored as a git submodule).

**WARNING** Some tests (e.g. test034) needs [gaga-phsp](https://github.com/dsarrut/gaga-phsp) which needs [pytorch](https://pytorch.org/) that cannot really be automatically installed by the previous pip install (at least we don't know how to do). So, in order to run those tests, you will have to install both PyTorch and gaga-phsp first with
**WARNING (2)** Some tests (e.g. test034) needs [gaga-phsp](https://github.com/dsarrut/gaga-phsp) which needs [pytorch](https://pytorch.org/) that cannot really be automatically installed by the previous pip install (at least we don't know how to do). So, in order to run those tests, you will have to install both PyTorch and gaga-phsp first with
````
pip install torch
pip install gaga-phsp
````

**WARNING (3)** With some linux systems (not all), you may encounter an error similar to “cannot allocate memory in static TLS block”. In that case, you must add a specific path to the linker as follows:
````
export LD_PRELOAD=<path to libG4processes>:<path to libG4geometry>:${LD_PRELOAD}
````

The documentation is here: https://opengate-python.readthedocs.io/en/latest/user_guide.html

The test history can be visualized here: https://opengate.github.io/opengate_tests_results/
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.0beta08
10.0beta09
8 changes: 3 additions & 5 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ project(opengate_core)

set(CMAKE_CXX_STANDARD 17)

# Enable Position Independent Code for all targets (-fPIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Need Geant4
find_package(Geant4 REQUIRED OPTIONAL_COMPONENTS qt)
include(${Geant4_USE_FILE})
Expand Down Expand Up @@ -103,13 +106,8 @@ if (WIN32)
endif ()
endif ()

# correct one on OSX
#target_link_libraries(opengate_core PRIVATE pybind11::module ${Geant4_LIBRARIES} Threads::Threads ${ITK_LIBRARIES})

# additional utilities
target_include_directories(opengate_core PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/)

#set(CMAKE_VERBOSE_MAKEFILE on)
target_link_libraries(opengate_core PRIVATE pybind11::module ${Geant4_LIBRARIES} Threads::Threads ${ITK_LIBRARIES} fmt::fmt-header-only)

# Do not not add ${PYTHON_LIBRARIES}) here (seg fault)
46 changes: 16 additions & 30 deletions core/opengate_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,23 @@ def get_libG4_path(lib):
"site-packages" in pathCurrentFile
): # opengate_core is installed using wheel (for "pip install -e .", the paths are different)
reloadPython = False
if (
"LD_LIBRARY_PATH" not in os.environ
or os.path.join(get_site_packages_dir(), "opengate_core.libs")
not in os.environ["LD_LIBRARY_PATH"]
):
reloadPython = True
# if (
# "LD_LIBRARY_PATH" not in os.environ
# or os.path.join(get_site_packages_dir(), "opengate_core.libs")
# not in os.environ["LD_LIBRARY_PATH"]
# ):
# reloadPython = True

if (
"LD_PRELOAD" not in os.environ
or get_libG4_path("processes") not in os.environ["LD_PRELOAD"]
or get_libG4_path("geometry") not in os.environ["LD_PRELOAD"]
):
reloadPython = True

if reloadPython:
print(
"opengate_core is not detected. Be sure to execute these lines before to run python:"
)
print(
"export LD_LIBRARY_PATH="
+ os.path.join(get_site_packages_dir(), "opengate_core.libs")
+ ":${LD_LIBRARY_PATH}"
)
print(
"export LD_PRELOAD="
+ get_libG4_path("processes")
+ ":"
+ get_libG4_path("geometry")
+ ":${LD_PRELOAD}"
)
sys.exit(-1)
# if reloadPython:
# print(
# "opengate_core is not detected. Be sure to execute these lines before to run python:"
# )
# print(
# "export LD_LIBRARY_PATH="
# + os.path.join(get_site_packages_dir(), "opengate_core.libs")
# + ":${LD_LIBRARY_PATH}"
# )
# sys.exit(-1)
elif sys.platform == "win32":
print(os.path.dirname(pathCurrentFile))
os.add_dll_directory(os.path.dirname(pathCurrentFile))
Expand Down
60 changes: 37 additions & 23 deletions core/opengate_core/g4DataSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@

# Data for Geant4
# Geant4 11.2.1
data_packages = [
"https://cern.ch/geant4-data/datasets/G4NDL.4.7.tar.gz",
"https://cern.ch/geant4-data/datasets/G4EMLOW.8.5.tar.gz",
"https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.5.7.tar.gz",
"https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.6.tar.gz",
"https://cern.ch/geant4-data/datasets/G4PARTICLEXS.4.0.tar.gz",
"https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz",
"https://cern.ch/geant4-data/datasets/G4RealSurface.2.2.tar.gz",
"https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz",
"https://cern.ch/geant4-data/datasets/G4ABLA.3.3.tar.gz",
"https://cern.ch/geant4-data/datasets/G4INCL.1.2.tar.gz",
"https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.3.tar.gz",
]
data_packages = {
"G4NEUTRONHPDATA": "https://cern.ch/geant4-data/datasets/G4NDL.4.7.tar.gz",
"G4LEDATA": "https://cern.ch/geant4-data/datasets/G4EMLOW.8.5.tar.gz",
"G4LEVELGAMMADATA": "https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.5.7.tar.gz",
"G4RADIOACTIVEDATA": "https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.6.tar.gz",
"G4PARTICLEXSDATA": "https://cern.ch/geant4-data/datasets/G4PARTICLEXS.4.0.tar.gz",
"G4PIIDATA": "https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz",
"G4REALSURFACEDATA": "https://cern.ch/geant4-data/datasets/G4RealSurface.2.2.tar.gz",
"G4SAIDXSDATA": "https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz",
"G4ABLADATA": "https://cern.ch/geant4-data/datasets/G4ABLA.3.3.tar.gz",
"G4INCLDATA": "https://cern.ch/geant4-data/datasets/G4INCL.1.2.tar.gz",
"G4ENSDFSTATEDATA": "https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.3.tar.gz",
}


def check_g4_data():
Expand All @@ -38,12 +38,12 @@ def check_g4_data():
return
else:
# Check if the G4 data folder is up to date
consistent = check_consistency_g4_data_folders()
if consistent is False:
missing_g4_Data = get_missing_g4_data()
if len(missing_g4_Data) != 0:
print("\nI will download a fresh G4 dataset for you.")
print("This will take a moment.")
download_g4_data()
if check_consistency_g4_data_folders() is True:
download_g4_data(missing_g4_Data)
if len(get_missing_g4_data()) == 0:
print("\nGeant4 data has been set up successfully.")
else:
print("There is (still) a problem with the Geant4 data.")
Expand Down Expand Up @@ -79,12 +79,22 @@ def download_with_resume(url, out, retries=5, delay=10):


# Download Geant4 data:
def download_g4_data():
def download_g4_data(missing_g4_Data=None):
data_location = get_g4_data_folder()
data_location.mkdir(parents=True, exist_ok=True)
folder_names_from_tar = set()
for i, package in enumerate(data_packages):
print(f"\nDownloading {i + 1}/{len(data_packages)} {package}")

if missing_g4_Data is None:
data_packages_needed = list(data_packages.values())
else:
data_packages_needed = [
package
for g4_data, package in data_packages.items()
if g4_data in missing_g4_Data
]

for i, package in enumerate(data_packages_needed):
print(f"\nDownloading {i + 1}/{len(data_packages_needed)} {package}")

# download the archive (with resume if the connexion failed)
package_archive = package.split("/")[-1]
Expand Down Expand Up @@ -128,7 +138,7 @@ def check_for_non_required_files_folders():
print("\n" + 10 * "*")


def check_consistency_g4_data_folders() -> bool:
def get_missing_g4_data() -> list:
dataLocation = get_g4_data_folder()
required_paths = set(get_g4_data_paths().values())
existing_paths = set([(dataLocation / f) for f in dataLocation.iterdir()])
Expand All @@ -137,9 +147,13 @@ def check_consistency_g4_data_folders() -> bool:
print("\nSome Geant4 data folder seem to be missing, namely:")
for p in missing_paths:
print(str(p))
return False
return [
g4_data
for g4_data, folder in get_g4_data_paths().items()
if folder in missing_paths
]
else:
return True
return []


# Return Geant4 data folder:
Expand Down
Loading
Loading