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

Update source files for photon emitter, custom ptracer, and relevant examples #2

Merged
merged 21 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
eaa9313
Add source files for photon emitter and custom ptracer
andrewgait Oct 8, 2024
4c2b66d
Add MPhys directory with previous results and update scripts and note…
andrewgait Oct 9, 2024
2e1bca5
More updates to match current mitsuba3 master branch
andrewgait Oct 10, 2024
35b5afc
Update script for running scaling tests
andrewgait Oct 10, 2024
0f7be73
Tidy up Single_Emitter directory by moving images / csv / xml to sepa…
andrewgait Oct 11, 2024
9ec2e3a
Add previous work images to the png directory
andrewgait Oct 11, 2024
ea09a02
Update new single emitter test
andrewgait Oct 15, 2024
0446ea9
Merge branch 'dev' into 1-update-to-include-manchester-photon-emitter…
andrewgait Oct 15, 2024
d4ff195
Minor adjustments to xml and notebooks so that notebook size is reduced
andrewgait Oct 15, 2024
18efcd6
Save diff pngs to png directory; update gitignore
andrewgait Oct 16, 2024
4446c2d
Update "old" photon emitter on old file name to preserve history
andrewgait Oct 16, 2024
8088696
Rename file to photon_emitter_old
andrewgait Oct 16, 2024
e4b79d8
Address majority of review comments:
andrewgait Oct 17, 2024
20a71ad
This file isn't needed either
andrewgait Oct 17, 2024
7cbf451
More tidying up of the MPhys directory structure
andrewgait Oct 17, 2024
3d6bb04
Change to log-log plots in scaling / performance graphs
andrewgait Oct 17, 2024
b5a55f5
Update directory structure to keep copies of local and cluster data
andrewgait Oct 17, 2024
264c49e
Updates to separate timing plots into a different script, and run loc…
andrewgait Oct 22, 2024
f4d5a17
Add error box-plots to plots
andrewgait Oct 23, 2024
d824577
Add results from cluster runs
andrewgait Oct 24, 2024
9d45fa5
Add tests / experiments folder in single emitter directory and copy r…
andrewgait Oct 24, 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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/.vs

# Jupyter
/.ipynb_checkpoints
*.ipynb_checkpoints

# Python
__pycache__
Expand All @@ -28,3 +28,8 @@ __pycache__
/docs/src/quickstart
/docs/src/generated
/docs/resources

# new png output / csv input
/MPhys/Single_Emitter/png/*
*1000000*csv
/MPhys/Single_Emitter/cluster*
1 change: 1 addition & 0 deletions MPhys/Direct import/photons_detected_spectral.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
9,3.31874,-0.104399,106.604,1066.64,0.00247168,0.0478558,0.998851,270.5980936414827
10,3.31874,-0.136313,113.606,1136.73,0.0439212,0.0743342,0.996266,383.72751894873835
11,3.31874,-0.122911,110.665,1107.29,-0.0439221,0.125615,0.991106,402.6323520971465

4 changes: 4 additions & 0 deletions MPhys/Direct import/python input.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"cells": [
{
"cell_type": "code",
<<<<<<< HEAD
andrewgait marked this conversation as resolved.
Show resolved Hide resolved
"execution_count": 1,
=======
"execution_count": 3,
>>>>>>> dev
"id": "a07ccfc1",
"metadata": {},
"outputs": [],
Expand Down
12 changes: 6 additions & 6 deletions MPhys/Rich_Geometry/One emitter for One photon .ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"\n",
"#load data from original G4 output (csv format)\n",
"column_names = [\"time (ps)\", \"x\", \"y\", \"z\", \"px\", \"py\", \"pz\", \"E (MeV)\"]\n",
"photon_data_full = pd.read_csv('/hepgpu6-data1/kevans/Photons_1000000_filtered.csv', names = column_names, nrows=100000)\n",
"photon_data_full = pd.read_csv('./test_data/Photons_1000000_filtered.csv', names = column_names, nrows=100000)\n",
"initial_number_of_photons = photon_data_full.count()[0]\n",
"\n",
"def ev_to_nm (energy):\n",
Expand Down Expand Up @@ -81,7 +81,7 @@
"photon_detected.reset_index(drop=True, inplace= True)\n",
"\n",
"#Can be removed later. Outputs characteristics of saved photons.\n",
"photon_detected.to_csv('./photons_detected_spectral.csv' )\n",
"photon_detected.to_csv('./test_photons_detected_spectral.csv' )\n",
andrewgait marked this conversation as resolved.
Show resolved Hide resolved
"final_number_of_photons = photon_detected.count()[0]\n",
"fraction_detected = final_number_of_photons/initial_number_of_photons\n",
"print (\"{0:.4} of emitted photon in G4 are actually detected.\".format(fraction_detected))"
Expand Down Expand Up @@ -118,7 +118,7 @@
"metadata": {},
"outputs": [],
"source": [
"tree = ET.parse('base_geometry.xml')\n",
"tree = ET.parse('test_data/base_geometry.xml')\n",
"root = tree.getroot()\n",
"for emitter in root.iter('emitter'):\n",
" print(emitter.attrib)"
Expand All @@ -141,7 +141,7 @@
],
"source": [
"# parse the xml file to get information from the 1st mirror\n",
"tree = ET.parse('base_geometry.xml')\n",
"tree = ET.parse('test_data/base_geometry.xml')\n",
"root = tree.getroot()\n",
"for shape in root.iter('shape'):\n",
" if shape.get('id') == 'mirror_spherical':\n",
Expand Down Expand Up @@ -241,7 +241,7 @@
"def add_spot_emitter(x, z, y, x_target, z_target, y_target, cutoff_angle):\n",
" \n",
" # parsing the xml file of the scene\n",
" tree = ET.parse('base_geometry.xml')\n",
" tree = ET.parse('test_data/base_geometry.xml')\n",
" root = tree.getroot()\n",
" # add a spot emitter to the scene\n",
" ### here, the y and z axis are switched (because the scene is rotated by 90 degrees?) ###\n",
Expand Down Expand Up @@ -316,7 +316,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
148 changes: 148 additions & 0 deletions MPhys/Rich_Geometry/full_geometry.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions MPhys/Single_Emitter/Write_binary_file.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"\n",
"#load data from original G4 output (csv format)\n",
"column_names = [\"time (ps)\", \"x\", \"y\", \"z\", \"px\", \"py\", \"pz\", \"E (MeV)\"]\n",
"photon_data_full = pd.read_csv('/hepgpu6-data1/kevans/Photons_1000000_filtered.csv', names = column_names)\n",
"photon_data_full = pd.read_csv('./Photons_1000000_filtered.csv', names = column_names)\n",
andrewgait marked this conversation as resolved.
Show resolved Hide resolved
"initial_number_of_photons = photon_data_full.count()[0]\n",
"\n",
"def ev_to_nm (energy):\n",
Expand Down Expand Up @@ -118,7 +118,7 @@
"source": [
"import struct\n",
"\n",
"with open(\"photon_geometry.bin\", \"wb\") as f:\n",
"with open(\"test_photon_geometry.bin\", \"wb\") as f:\n",
andrewgait marked this conversation as resolved.
Show resolved Hide resolved
" f.write(struct.pack(\"<Q\", len(x_position))) # Use 'Q' format for 64-bit unsigned integer (size_t)\n",
" for x1, y1, z1, x2, y2, z2 in zip(x_position, y_position, z_position, x_target, y_target, z_target):\n",
" f.write(struct.pack(\"<f\", x1))\n",
Expand Down
Binary file added MPhys/Single_Emitter/cbox.exr
Binary file not shown.
48 changes: 48 additions & 0 deletions MPhys/Single_Emitter/cluster_instructions_history.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
History of instructions run on noether HEP cluster to setup and run the Single_Emitter example script.
andrewgait marked this conversation as resolved.
Show resolved Hide resolved

1000 exit
1001 cd
1002 cd PhotonPropagation/mitsuba3-manchester/build_view_LCG105/
1003 source /cvmfs/sft.cern.ch/lcg/views/LCG_105/x86_64-el9-clang16-opt/setup.sh
1004 env
1005 env | grep LD_LIBRARY_PATH
1006 env | grep LD_LIBRARY_PATH | grep unknown
1007 export LD_LIBRARY_PATH=/cvmfs/sft.cern.ch/lcg/releases/clang/16.0.3-9dda8/x86_64-el9/lib/x86_64-unknown-linux-gnu/:${LD_LIBRARY_PATH)
1008 export LD_LIBRARY_PATH=/cvmfs/sft.cern.ch/lcg/releases/clang/16.0.3-9dda8/x86_64-el9/lib/x86_64-unknown-linux-gnu:${LD_LIBRARY_PATH)
1009 export LD_LIBRARY_PATH=/cvmfs/sft.cern.ch/lcg/releases/clang/16.0.3-9dda8/x86_64-el9/lib/x86_64-unknown-linux-gnu:${LD_LIBRARY_PATH}
1010 env
1011 env | grep LD_LIBRARY_PATH
1012 ls
1013 cmake -GNinja ..
1014 vi mitsuba.conf
1015 cmake -GNinja ..
1016 ninja
1017 ls
1018 source setpath.sh
1019 cd ..
1020 ls
1021 cd MPhys/
1022 ls
1023 cd Rich_Geometry/
1024 ls
1025 cd ../Direct\ import/
1026 ls
1027 cd ../Single_Emitter/
1028 ls
1029 python
1030 pip
1031 pip list
1032 python
1033 ls
1034 python single_emitter_test_new.py
1035 ls
1036 mkdir cluster_new_and_diff
1037 mv diff\ image* new\* cluster_new_and_diff/
1038 ls
1039 ls cluster_new_and_diff/
1040 mv new\ intensity\ \=\ * cluster_new_and_diff/
1041 ls
1042 mv new\ emit\ to\ the\ right\ wall.png cluster_new_and_diff/
1043 ls
1044 ls -ltr
1045 history
9 changes: 9 additions & 0 deletions MPhys/Single_Emitter/concatenate_pandas_photon_dataframes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pandas as pd
andrewgait marked this conversation as resolved.
Show resolved Hide resolved

photon_detected = pd.read_csv('test_new_photons_detected_spectral.csv')

# There were just under 10^6 elements in this dataset, so to get to 10^8, concatenate 110 of these together...

photon_detected_large = pd.concat([photon_detected for _ in range(110)])

photon_detected_large.to_csv('test_new_photons_detected_spectral_100000000.csv')
10 changes: 10 additions & 0 deletions MPhys/Single_Emitter/csv/llvm_mono_timing_for_n_photons.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1.000000000000000000e+00,1.978044509887695243e-02,5.607190132141113420e-02,8.485283851623535156e-01
1.000000000000000000e+01,1.936111450195312361e-02,5.309574604034424106e-02,1.049047136306762606e+00
1.000000000000000000e+02,2.888579368591308663e-02,7.119491100311278742e-02,1.225476455688476518e+00
1.000000000000000000e+03,1.932477951049804688e-02,4.470925331115722934e-02,8.123323678970336692e-01
1.000000000000000000e+04,2.192444801330566476e-02,5.377616882324218889e-02,9.610966920852661577e-01
1.000000000000000000e+05,3.175868988037109514e-02,7.066752910614013117e-02,1.037675070762634322e+00
1.000000000000000000e+06,1.672561883926391713e-01,2.040284633636474665e-01,1.135952997207641646e+00
1.000000000000000000e+07,7.786815166473388672e-01,8.227706670761107954e-01,1.780820298194885298e+00
1.869004000000000000e+07,2.066783022880554377e+00,2.117531561851501376e+00,3.189863014221191229e+00
1.869004000000000000e+07,2.178409934043884277e+00,2.264196181297302157e+00,3.304263281822204412e+00
Loading