|
30 | 30 | "# │ output. │\n", |
31 | 31 | "# │ │\n", |
32 | 32 | "# │ │\n", |
33 | | - "# │ import PyVista and editor │\n", |
| 33 | + "# │ Import notebook helpers │\n", |
34 | 34 | "# │ Copy basic/b2 example to local directory │\n", |
35 | 35 | "# └────────────────────────────────────────────────────────────────────────┘\n", |
36 | 36 | "\n", |
37 | | - "import subprocess, warnings, sys, vtk\n", |
38 | | - "import pyvista as pv\n", |
39 | | - "vtk.vtkObject.GlobalWarningDisplayOff() # suppress warnings\n", |
40 | | - "\n", |
41 | | - "from pygemc.api.run_geometry import run_geometry\n", |
| 37 | + "import subprocess\n", |
| 38 | + "import sys\n", |
42 | 39 | "from pathlib import Path\n", |
| 40 | + "from IPython.display import Image, display\n", |
| 41 | + "\n", |
43 | 42 | "sys.path.insert(0, str(Path.cwd().parent))\n", |
44 | 43 | "from notebook_tools import edit, setup_example\n", |
| 44 | + "\n", |
| 45 | + "from pygemc.api.run_geometry import run_geometry\n", |
45 | 46 | "setup_example(\"examples/basic/b2\")\n" |
46 | 47 | ], |
47 | 48 | "id": "eefd95102f38a3f2" |
|
77 | 78 | "# │ - Display generated screenshot if present │\n", |
78 | 79 | "# └─────────────────────────────────────────────────────────┘\n", |
79 | 80 | "\n", |
80 | | - "from pathlib import Path\n", |
81 | | - "from IPython.display import Image, display\n", |
82 | | - "\n", |
83 | 81 | "yaml='b2.yaml'\n", |
84 | 82 | "driver='-g4view=[{driver: TOOLSSG_OFFSCREEN}]'\n", |
85 | 83 | "camera='-g4camera=[{phi: -10*deg, theta: 250*deg}]'\n", |
86 | 84 | "light='-g4light=[{phi: 160*deg, theta: 120*deg}]'\n", |
87 | | - "nevents=\"-n=1000\"\n", |
| 85 | + "nevents=\"-n=50\"\n", |
88 | 86 | "nthreads=\"-nthreads=1\"\n", |
89 | 87 | "\n", |
90 | 88 | "result = subprocess.run([\"gemc\", yaml, driver, camera, light, nevents, nthreads], capture_output=True, text=True)\n", |
|
99 | 97 | " display(Image(filename=str(image_file)))\n", |
100 | 98 | "else:\n", |
101 | 99 | " print(f\"No GEMC image found: {image_file}\")\n", |
102 | | - " \n", |
103 | | - " \n", |
104 | | - "result = subprocess.run(\n", |
105 | | - "\t[\"ls\", \"-l\"],\n", |
106 | | - "\tcapture_output=True,\n", |
107 | | - "\ttext=True,\n", |
108 | | - ")\n", |
109 | | - "\n", |
110 | | - "print(result.stdout)\n" |
| 100 | + "\n" |
111 | 101 | ], |
112 | 102 | "id": "d4569ba806553c65" |
113 | 103 | }, |
|
124 | 114 | "# │ histogram. │\n", |
125 | 115 | "# └───────────────────────────────────────────────────────────────────────┘\n", |
126 | 116 | "\n", |
127 | | - "from pygemc import read_output, plot_variable; plot_variable(read_output(\"CO2_t0_digitized.csv\"), \"totEdep\", data=\"digitized\", bins=50, logy=False, show=True)\n" |
| 117 | + "from pygemc import read_output, plot_variable\n", |
| 118 | + "plot_variable(read_output(\"CO2_t0_digitized.csv\"), \"totEdep\", data=\"digitized\", bins=50, logy=True, show=True)\n" |
128 | 119 | ], |
129 | 120 | "id": "b2-plot-totEdep-code" |
130 | 121 | }, |
|
141 | 132 | "# │ histogram. │\n", |
142 | 133 | "# └───────────────────────────────────────────────────────────────────────┘\n", |
143 | 134 | "\n", |
144 | | - "from pygemc import read_output, plot_variable; plot_variable(read_output(\"CO2_t0_true_info.csv\"), \"vz\", data=\"true_info\", bins=50, logy=False, show=True)\n" |
| 135 | + "from pygemc import read_output, plot_variable\n", |
| 136 | + "plot_variable(read_output(\"CO2_t0_true_info.csv\"), \"vz\", data=\"true_info\", bins=50, logy=False, show=True)\n" |
145 | 137 | ], |
146 | 138 | "id": "b2-plot-pid-code" |
147 | 139 | }, |
|
0 commit comments