Skip to content

Commit

Permalink
compare
Browse files Browse the repository at this point in the history
  • Loading branch information
plexoos committed Oct 1, 2024
1 parent bd07126 commit 12d6356
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency:
cancel-in-progress: true

jobs:
build:
build-n-test:
runs-on: [gpu]

container:
Expand All @@ -24,14 +24,19 @@ jobs:

- name: Build
shell: bash
env:
GEOM: testgeom
OPTICKS_EVENT_MODE: DebugLite
run: |
cmake -S . -B build
cmake --build build
- name: Test
shell: bash
env:
GEOM: fakegeom
OPTICKS_EVENT_MODE: DebugLite
run: |
QCurandState_SPEC=3:0:0 /usr/local/opticks/lib/QCurandStateTest
build/src/simtox
build/src/simg4ox -g geom/raindrop.gdml -m run.mac
ls -la /tmp/GEOM/testgeom/simg4ox/ALL0/A000
ls -la /tmp/GEOM/testgeom/simg4ox/ALL0/B000
ls -la /tmp/GEOM/fakegeom/simg4ox/ALL0/A000
ls -la /tmp/GEOM/fakegeom/simg4ox/ALL0/B000
python tests/compare_ab.py
15 changes: 15 additions & 0 deletions tests/compare_ab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import numpy as np
import opticks.sysrap.sevt as s

a = s.SEvt.Load("/tmp/GEOM/fakegeom/simg4ox/ALL0/A000/")
b = s.SEvt.Load("/tmp/GEOM/fakegeom/simg4ox/ALL0/B000/")

#np.allclose(a.f.record[:,1:], b.f.record[:,0:-1], rtol=0, atol=1e-5)

assert len(a.f.record) == len(b.f.record)

diff = [i for i, (a, b) in enumerate(zip(a.f.record[:, 1:], b.f.record[:, 0:-1])) if not np.allclose(a, b, rtol=0, atol=1e-5)]
print(diff)

assert diff == [14, 21, 22, 36, 40, 54, 64, 81]

0 comments on commit 12d6356

Please sign in to comment.