ML beam test PID Meetings » History » Version 68
Richard Trotta, 07/08/2024 11:21 AM
1 | 1 | Richard Trotta | {{>toc}} |
---|---|---|---|
2 | |||
3 | h1. ML beam test PID Meetings |
||
4 | |||
5 | 3 | Richard Trotta | --- |
6 | |||
7 | 57 | Richard Trotta | h2. "Weekly Meeting Zoom Info":https://jlab-org.zoomgov.com/j/1608232612?pwd=MjJlYXRUZzE3R2U2MC83WXRKMGt5QT09 |
8 | |||
9 | * Meeting ID: 160 823 2612 |
||
10 | * Passcode: 575365 |
||
11 | |||
12 | --- |
||
13 | |||
14 | 1 | Richard Trotta | h2. Summer 2024 |
15 | 4 | Richard Trotta | |
16 | --- |
||
17 | |||
18 | 25 | Richard Trotta | h3. May 28th, 2024 |
19 | 1 | Richard Trotta | |
20 | * Darren ran with Python3.9 |
||
21 | * Docker (containerization) Definition |
||
22 | ** Containerization is a technology that allows developers to package and run applications along with all their dependencies in isolated environments called containers. This ensures that the application runs consistently across different computing environments, from a developer's laptop to testing, staging, and production. |
||
23 | ** Docker is a popular platform that simplifies containerization. It provides tools to create, deploy, and manage containers. With Docker, developers can write code locally, share their work with colleagues, and deploy to production in a seamless and efficient manner. Docker containers are lightweight, fast, and portable, making them ideal for modern software development and deployment. |
||
24 | 9 | Richard Trotta | |
25 | 39 | Richard Trotta | * "A Crash Course for Summer Research":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
26 | 17 | Richard Trotta | * "GitHub and Python Introduction":https://github.com/trottar/UVA_summer_students |
27 | 18 | Richard Trotta | ** Navigate to "python_tutorials":https://github.com/trottar/UVA_summer_students/tree/master/python_tutorials and read through the two html files ("Introduction":https://github.com/trottar/UVA_summer_students/blob/master/python_tutorials/Introduction.ipynb and "python_tutorial_2":https://github.com/trottar/UVA_summer_students/blob/master/python_tutorials/python_tutorial_2.ipynb) |
28 | *** Note, these are html files so you'll need |
||
29 | 8 | Richard Trotta | |
30 | h4. Near-term Goals |
||
31 | |||
32 | # Setup Linux Subsystem for Windows |
||
33 | # Fork the ML Beam Testing GitHub repository |
||
34 | # Containerize ML Beam Testing GitHub repository with Docker |
||
35 | 5 | Richard Trotta | |
36 | 14 | Richard Trotta | h4. Homework |
37 | |||
38 | 16 | Richard Trotta | * "Read chapters 0-3 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
39 | 14 | Richard Trotta | |
40 | 3 | Richard Trotta | --- |
41 | 19 | Richard Trotta | |
42 | 25 | Richard Trotta | h3. May 29th, 2024 |
43 | 19 | Richard Trotta | |
44 | h4. Setting Up Jupyter Notebooks in Docker |
||
45 | |||
46 | # Create a directory to store, build, and run Docker container |
||
47 | <pre><code class="bash"> |
||
48 | cd /path/to/directory |
||
49 | mkdir beamtest_dir |
||
50 | 20 | Richard Trotta | cd beamtest_dir |
51 | </code></pre> |
||
52 | 21 | Richard Trotta | # Once in the new directory, create a Dockerfile |
53 | 20 | Richard Trotta | <pre><code class="bash"> |
54 | touch Dockerfile |
||
55 | </code></pre> |
||
56 | 21 | Richard Trotta | # Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit the Dockerfile with the following information |
57 | 20 | Richard Trotta | <pre><code class="bash"> |
58 | # Use the official Python 3.9 image as the base image |
||
59 | FROM python:3.9 |
||
60 | |||
61 | # Install Jupyter Notebook and other dependencies |
||
62 | RUN pip install --no-cache-dir jupyter |
||
63 | |||
64 | # Create a working directory |
||
65 | WORKDIR /workspace |
||
66 | |||
67 | # Expose the Jupyter Notebook port |
||
68 | EXPOSE 8888 |
||
69 | |||
70 | # Set the default command to start Jupyter Notebook |
||
71 | 1 | Richard Trotta | CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"] |
72 | </code></pre> |
||
73 | 21 | Richard Trotta | # Build the Docker image (e.g., helloworld) |
74 | <pre><code class="bash"> |
||
75 | docker build -t helloworld . |
||
76 | </code></pre> |
||
77 | # Run the Docker container |
||
78 | </code></pre> |
||
79 | <pre><code class="bash"> |
||
80 | docker run -p 8888:8888 helloworld |
||
81 | </code></pre> |
||
82 | # Jupyter Notebook is now running. Navigate to a browser and type in either |
||
83 | 23 | Richard Trotta | |
84 | 21 | Richard Trotta | * The custom token authorization screen</code></pre> |
85 | <pre><code class="bash"> |
||
86 | http://localhost:8888 |
||
87 | </code></pre> |
||
88 | 22 | Richard Trotta | |
89 | 21 | Richard Trotta | * To bypass the token screen, copy/paste the URL that splashes in the terminal into your browser |
90 | 24 | Richard Trotta | |
91 | h4. Near-term Goals |
||
92 | |||
93 | # Try and get the "python tutorial":https://github.com/trottar/UVA_summer_students Jupyter notebooks working in a container. |
||
94 | |||
95 | h4. Homework |
||
96 | |||
97 | * "Read chapters 0-3 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
||
98 | 27 | Richard Trotta | |
99 | --- |
||
100 | |||
101 | h3. May 30th, 2024 |
||
102 | |||
103 | h4. Setting Up Bash Script for Running Docker |
||
104 | |||
105 | 28 | Richard Trotta | # Create a bash script |
106 | <pre><code class="bash"> |
||
107 | touch run_docker.sh |
||
108 | </code></pre> |
||
109 | 29 | Richard Trotta | # Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit run_docker.sh |
110 | <pre><code class="bash"> |
||
111 | #!/bin/bash |
||
112 | 1 | Richard Trotta | |
113 | 29 | Richard Trotta | # Build docker image ($1 is the first bash script argument) |
114 | 37 | Richard Trotta | docker build -t $1 . |
115 | 29 | Richard Trotta | |
116 | # Run the docker container (renaming it with the '_container' string) |
||
117 | docker run -p 8888:8888 --name "${1}_container" $1 |
||
118 | </code></pre> |
||
119 | # Adjust permissions with "chmod":https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/how-permissions-chmod-with-numbers-command-explained-777-rwx-unix to allow script execution |
||
120 | <pre><code class="bash"> |
||
121 | chmod 755 run_docker.sh |
||
122 | </code></pre> |
||
123 | 31 | Richard Trotta | # Execute run_docker.sh with container name (e.g., helloworld) |
124 | <pre><code class="bash"> |
||
125 | ./run_docker.sh helloworld |
||
126 | </code></pre> |
||
127 | 1 | Richard Trotta | |
128 | 31 | Richard Trotta | The docker image should be properly built and the container should be running. Follow instructions from "yesterday":https://redmine.jlab.org/projects/uva-phys-zheng/wiki/ML_beam_test_PID_Meetings#May-29th-2024 to continue. |
129 | |||
130 | h4. Setting Up Bash Script for committing Docker container |
||
131 | |||
132 | 32 | Richard Trotta | This should be done while a docker container is running and performed in another terminal. |
133 | |||
134 | 31 | Richard Trotta | # Create a bash script |
135 | <pre><code class="bash"> |
||
136 | touch commit_docker.sh |
||
137 | </code></pre> |
||
138 | # Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit commit_docker.sh |
||
139 | <pre><code class="bash"> |
||
140 | #!/bin/bash |
||
141 | |||
142 | # Create a formatted string with date to organize committed containers |
||
143 | # - `date` is a command that prints or sets the system date and time. |
||
144 | # - `+%H` extracts the hour in 24-hour format. |
||
145 | # - `+%M` extracts the minute. |
||
146 | # - `+%S` extracts the second. |
||
147 | # - `+%Y` extracts the year. |
||
148 | # - `+%m` extracts the month. |
||
149 | # - `%d` extracts the day. |
||
150 | f_date=$(date +%Y-%m-%d_h%Hm%Ms%S) |
||
151 | |||
152 | # While a docker container is running (with root name given as first argument), |
||
153 | # commit to a dated container so that changes in the container are saved |
||
154 | 38 | Richard Trotta | docker commit "${1}_container" "${1}_${f_date}" |
155 | 32 | Richard Trotta | </code></pre> |
156 | # Adjust permissions with "chmod":https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/how-permissions-chmod-with-numbers-command-explained-777-rwx-unix to allow script execution |
||
157 | <pre><code class="bash"> |
||
158 | chmod 755 commit_docker.sh |
||
159 | </code></pre> |
||
160 | # Execute run_docker.sh with container name (e.g., helloworld) |
||
161 | <pre><code class="bash"> |
||
162 | ./commit_docker.sh helloworld |
||
163 | 31 | Richard Trotta | </code></pre> |
164 | 28 | Richard Trotta | |
165 | h4. Useful Docker Commands |
||
166 | 27 | Richard Trotta | |
167 | * To see all docker images |
||
168 | <pre><code class="bash"> |
||
169 | docker images |
||
170 | </code></pre> |
||
171 | * To see all docker containers running |
||
172 | <pre><code class="bash"> |
||
173 | docker ps |
||
174 | </code></pre> |
||
175 | * To end specific docker container |
||
176 | <pre><code class="bash"> |
||
177 | 34 | Richard Trotta | docker stop <container_id> |
178 | 27 | Richard Trotta | </code></pre> |
179 | * To end all docker container |
||
180 | <pre><code class="bash"> |
||
181 | 36 | Richard Trotta | docker stop $(docker ps -q) |
182 | 27 | Richard Trotta | </code></pre> |
183 | 33 | Richard Trotta | |
184 | h4. Near-term Goals |
||
185 | |||
186 | # Try and get the "python tutorial":https://github.com/trottar/UVA_summer_students Jupyter notebooks working in a container. |
||
187 | # Take a look at the "GitHub ML Beam Test Repository":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/tree/main/aiml |
||
188 | * In particular, look at the script "solid_beamtest_hallc_2022/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/blob/main/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb |
||
189 | ** Try to get this notebook working in a container by creating a requirements.txt file (use this "site as a general guide":https://www.docker.com/blog/containerized-python-development-part-1/) |
||
190 | ** We will cover this in detail tomorrow |
||
191 | |||
192 | h4. Homework |
||
193 | |||
194 | * "Read chapters 0-3 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
||
195 | 40 | Richard Trotta | |
196 | --- |
||
197 | |||
198 | h3. May 31st, 2024 |
||
199 | |||
200 | h4. Clone a git repository into the Docker container by adding a line to the Dockerfile |
||
201 | |||
202 | 41 | Richard Trotta | * Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit the Dockerfile with the following information (the python tutorial GitHub repo is used as an example) |
203 | 40 | Richard Trotta | <pre><code class="bash"> |
204 | # Use the official Python 3.9 image as the base image |
||
205 | FROM python:3.9 |
||
206 | |||
207 | # Install Jupyter Notebook and other dependencies |
||
208 | RUN pip install --no-cache-dir jupyter |
||
209 | |||
210 | # Create a working directory |
||
211 | WORKDIR /workspace |
||
212 | |||
213 | # Clone GitHub repo |
||
214 | 1 | Richard Trotta | RUN git clone https://github.com/trottar/UVA_summer_students.git |
215 | 41 | Richard Trotta | |
216 | # Expose the Jupyter Notebook port |
||
217 | EXPOSE 8888 |
||
218 | |||
219 | # Set the default command to start Jupyter Notebook |
||
220 | CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"] |
||
221 | </code></pre> |
||
222 | |||
223 | h4. Quick requirements.txt introduction |
||
224 | |||
225 | * requirements.txt is a way to easily install many python packages by recursively reading through a text file |
||
226 | 43 | Richard Trotta | * This text file can either be generated... |
227 | ** Manually, by writing the required python packages into the text file. |
||
228 | *** Note: it is good practice to specify the version of the package. Such as... |
||
229 | <pre><code class="bash"> |
||
230 | matplotlib==3.3.4 |
||
231 | </code></pre> |
||
232 | ** Automatically, by running the following command |
||
233 | <pre><code class="bash"> |
||
234 | pip freeze > requirements.txt |
||
235 | </code></pre> |
||
236 | 47 | Richard Trotta | *** *Note:* This command will include all packages installed. |
237 | 43 | Richard Trotta | |
238 | 41 | Richard Trotta | * A Docker container can install all these packages upon building its image by adding a few lines to the Dockerfile |
239 | * Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit the Dockerfile with the following information |
||
240 | 42 | Richard Trotta | <pre><code class="bash"> |
241 | 41 | Richard Trotta | # Use the official Python 3.9 image as the base image |
242 | FROM python:3.9 |
||
243 | |||
244 | 46 | Richard Trotta | # Use the most up-to-date version of pip3.9 |
245 | RUN pip install --upgrade pip |
||
246 | 1 | Richard Trotta | |
247 | 46 | Richard Trotta | # Install git and ssh |
248 | RUN apt-get update && apt-get install -y git openssh-client |
||
249 | |||
250 | 1 | Richard Trotta | # Create a working directory |
251 | 41 | Richard Trotta | WORKDIR /workspace |
252 | |||
253 | 46 | Richard Trotta | # Clone GitHub |
254 | RUN git clone https://github.com/trottar/solid_beamtest_hallc_2022.git |
||
255 | 41 | Richard Trotta | |
256 | # copy the dependencies file to the working directory |
||
257 | COPY requirements.txt . |
||
258 | |||
259 | # install dependencies |
||
260 | RUN pip install -r requirements.txt |
||
261 | 40 | Richard Trotta | |
262 | # Expose the Jupyter Notebook port |
||
263 | EXPOSE 8888 |
||
264 | 1 | Richard Trotta | |
265 | # Set the default command to start Jupyter Notebook |
||
266 | CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"] |
||
267 | </code></pre> |
||
268 | 46 | Richard Trotta | |
269 | * *Note:* I also made some other adjustments such as... |
||
270 | ** Moved the pip installation of jupyter directly into the requirements.txt |
||
271 | ** Added an installation for git and ssh to avoid completely clean image creations. |
||
272 | ** Added a pip install --upgrade pip to assure pip is the latest version for python3.9 |
||
273 | 40 | Richard Trotta | |
274 | h4. Useful Docker Commands |
||
275 | |||
276 | * Remove all stopped containers (use with caution) |
||
277 | <pre><code class="bash"> |
||
278 | 45 | Richard Trotta | docker system prune -a |
279 | 40 | Richard Trotta | </code></pre> |
280 | |||
281 | h4. Near-term Goals |
||
282 | |||
283 | # Take a look at the "GitHub ML Beam Test Repository":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/tree/main/aiml |
||
284 | * In particular, look at the script "solid_beamtest_hallc_2022/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/blob/main/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb |
||
285 | ** Try to get this notebook working in a container by creating a requirements.txt file (use this "site as a general guide":https://www.docker.com/blog/containerized-python-development-part-1/) |
||
286 | |||
287 | h4. Homework |
||
288 | |||
289 | * "Read chapters 0-3 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
||
290 | 48 | Richard Trotta | |
291 | --- |
||
292 | |||
293 | h3. June 3rd, 2024 |
||
294 | |||
295 | h4. First Time General Docker Procedure |
||
296 | |||
297 | # Clear out previous images and containers |
||
298 | <pre><code class="bash"> |
||
299 | docker system prune -a |
||
300 | </code></pre> |
||
301 | # Build the Docker image and run the container with bash script |
||
302 | <pre><code class="bash"> |
||
303 | ./run_docker.sh beamtest |
||
304 | </code></pre> |
||
305 | # While the container is running, create snapshots of changes by committing |
||
306 | <pre><code class="bash"> |
||
307 | ./commit_docker.sh beamtest |
||
308 | </code></pre> |
||
309 | 49 | Richard Trotta | # *IMPORTANT* Properly stop a container by checking its ID with _docker ps_ then |
310 | 48 | Richard Trotta | <pre><code class="bash"> |
311 | docker stop <contatiner_ID> |
||
312 | </code></pre> |
||
313 | |||
314 | h4. Running a snapshot |
||
315 | |||
316 | * Snapshots are built images so no rebuilding required |
||
317 | * To run a container of a snapshot... |
||
318 | # Check out all built images/snapshots |
||
319 | <pre><code class="bash"> |
||
320 | 50 | Richard Trotta | docker images |
321 | 48 | Richard Trotta | </code></pre> |
322 | # Run the specific snapshot |
||
323 | <pre><code class="bash"> |
||
324 | docker run -p 8888:8888 <snapshot_name> |
||
325 | </code></pre> |
||
326 | # While the container of snapshot is running, create further snapshots of changes by committing |
||
327 | <pre><code class="bash"> |
||
328 | ./commit_docker.sh beamtest |
||
329 | </code></pre> |
||
330 | 51 | Richard Trotta | # *IMPORTANT* Properly stop a container by checking its ID with _docker ps_ then |
331 | 48 | Richard Trotta | <pre><code class="bash"> |
332 | docker stop <contatiner_ID> |
||
333 | </code></pre> |
||
334 | |||
335 | h4. Near-term Goals |
||
336 | |||
337 | # Take a look at the "GitHub ML Beam Test Repository":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/tree/main/aiml |
||
338 | * In particular, look at the script "solid_beamtest_hallc_2022/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/blob/main/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb |
||
339 | ** Try to get this notebook working in a container by creating a requirements.txt file (use this "site as a general guide":https://www.docker.com/blog/containerized-python-development-part-1/) |
||
340 | * Compare the plots in this notebook with those in "Darren's report":https://wordpress.its.virginia.edu/zhenggroup/files/2023/10/SoLID_beamtest_ML_PID_Upton.pdf to try and get an understanding. |
||
341 | |||
342 | h4. Homework |
||
343 | |||
344 | 52 | Richard Trotta | * "Read chapters 0-4 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
345 | 53 | Richard Trotta | |
346 | --- |
||
347 | |||
348 | h3. June 4th, 2024 |
||
349 | |||
350 | h4. In a Docker container, grab CSV files from a download link to use in Jupyter scripts |
||
351 | 54 | Richard Trotta | |
352 | 53 | Richard Trotta | * Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit the Dockerfile with the following information |
353 | <pre><code class="bash"> |
||
354 | # Use the official Python 3.9 image as the base image |
||
355 | FROM python:3.9 |
||
356 | |||
357 | # Use the most up-to-date version of pip3.9 |
||
358 | RUN pip install --upgrade pip |
||
359 | |||
360 | # Install git and ssh |
||
361 | RUN apt-get update && apt-get install -y git openssh-client |
||
362 | |||
363 | # Create a working directory |
||
364 | WORKDIR /workspace |
||
365 | |||
366 | # Clone GitHub |
||
367 | RUN git clone https://github.com/trottar/solid_beamtest_hallc_2022.git |
||
368 | |||
369 | # copy the dependencies file to the working directory |
||
370 | COPY requirements.txt . |
||
371 | |||
372 | # install dependencies |
||
373 | RUN pip install -r requirements.txt |
||
374 | |||
375 | # Create new directory (Sim_CSV) to store data files for simulations |
||
376 | RUN mkdir -p /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV |
||
377 | |||
378 | # Grab CSV files from OneDrive |
||
379 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Bkg_CherChannels.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/Ee9RmPVcNwdIjUTFcES0XXIB7H0mNnieXicFxWfVobY0vg?e=8TJFbN&download=1" |
||
380 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_CherChannels.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/EbeTrS8gka9GpzQx3ZMjev4BvrqUJMogjMQ6WfiaVdn7JA?e=N50RL9&download=1" |
||
381 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_CherChannels_500k.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/ESutJhLkFyFLqOTwHNPYy9YB50Tvwmx2La2MZrgTLtTUww?e=PPbXln&download=1" |
||
382 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_Pencil.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/EbWm9NHCFh1MhpPM72nkXQIBF4D23Y62KGDNK38-hr_kgA?e=iGtYba&download=1" |
||
383 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_Pencil_AllEvents.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/EaBQxnnHPcZFgVI3gizyWtcBzjLd9NNvToYnUmFREopwSA?e=kLX1Sd&download=1" |
||
384 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_Pencil_AllEvents_TID1.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/EYqKKiXhdIxNo1EuUhzuDYcB7PhYbD0Cuv0fiG1CfiJwdQ?e=a6XeeS&download=1" |
||
385 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_Pencil_Bkg.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/EbDFEIyjgPxDkMEd4gJYHFEB6fmfdPkbuNYGGC6QBM4hBQ?e=n1gIEW&download=1" |
||
386 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_Pencil_CherChannels_AllEvents.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/EQBKDvJ9_TxLoNTXfZfMxcIBFmFaDHdhfTILSv-C5hExhA?e=BZ2dfM&download=1" |
||
387 | RUN wget -O /workspace/solid_beamtest_hallc_2022/aiml/Pencil_Beam/Sim_CSV/Sim_Pencil_CherChannels_AllEvents_TID1.csv "https://myuva-my.sharepoint.com/:x:/g/personal/nar2rk_virginia_edu/EZRZ9H7IDdNMukCrELRv7SwB_QIORnLSUCDUJgZ2s_tj6g?e=GjLuwX&download=1" |
||
388 | |||
389 | # Expose the Jupyter Notebook port |
||
390 | EXPOSE 8888 |
||
391 | |||
392 | # Set the default command to start Jupyter Notebook |
||
393 | CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"] |
||
394 | </code></pre> |
||
395 | |||
396 | 55 | Richard Trotta | * At this point, everything should be ready to fully run the first script, "solid_beamtest_hallc_2022/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/blob/main/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb |
397 | * *Note:* These are huge CSV files (2-9 GB) so Jupyter may crash when reading these into Pandas. I am working on ways to limit the burden on your PCs, but, in the meantime, you can update the following cell |
||
398 | <pre><code class="python"> |
||
399 | %%time |
||
400 | |||
401 | # Set the maximum number of rows to read in from the CSV |
||
402 | lim_rows = 50000 |
||
403 | |||
404 | #Full |
||
405 | raw_sim_df = pd.read_csv("Sim_CSV/Sim_Pencil_AllEvents_TID1.csv", nrows=lim_rows) |
||
406 | raw_bkg_df = pd.read_csv("Sim_CSV/Sim_Pencil_Bkg.csv", nrows=lim_rows) |
||
407 | |||
408 | #Cher Arrays |
||
409 | raw_sim_cher = pd.read_csv("Sim_CSV/Sim_Pencil_CherChannels_AllEvents_TID1.csv", |
||
410 | names=np.core.defchararray.add(np.array(16*["Cher"]), np.arange(0,16,1).astype(str)), nrows=lim_rows) |
||
411 | raw_sim_cher["pid"] = raw_sim_df["pid"] |
||
412 | |||
413 | raw_bkg_cher = pd.read_csv("Sim_CSV/Bkg_CherChannels.csv", |
||
414 | names=np.core.defchararray.add(np.array(16*["Cher"]), np.arange(0,16,1).astype(str)), nrows=lim_rows) |
||
415 | raw_bkg_cher["pid"] = raw_bkg_df["pid"] |
||
416 | |||
417 | #raw_sim_df["Npesum"] = raw_sim_df.iloc[:,] |
||
418 | |||
419 | sim_df = raw_sim_df #[raw_sim_df["GEM00_Edep"]>35e-6]#[(raw_sim_df["PreShSum"]>0)].reset_index(drop=1) |
||
420 | bkg_df = raw_bkg_df #[GEM00_Edep >35e-6]#[(raw_bkg_df["PreShSum"]>0)&(raw_bkg_df["ShowerSum"]>0)].reset_index(drop=1) |
||
421 | |||
422 | sim_cher = raw_sim_cher |
||
423 | bkg_cher = raw_bkg_cher |
||
424 | |||
425 | sim_df |
||
426 | </code></pre> |
||
427 | |||
428 | * *WARNING:* Limiting the number of entries in this way will break some things later on. In particular, see how this changes the plots compared to Darren's. If you're feeling daring, try to debug these errors. +HINT+: The number of entries in the column PID will change, which effects some loops. |
||
429 | |||
430 | 53 | Richard Trotta | h4. Near-term Goals |
431 | |||
432 | # Take a look at the "GitHub ML Beam Test Repository":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/tree/main/aiml |
||
433 | * In particular, look at the script "solid_beamtest_hallc_2022/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb":https://github.com/JeffersonLab/solid_beamtest_hallc_2022/blob/main/aiml/Pencil_Beam/Pencil_Cher_ML.ipynb |
||
434 | ** Try to get this notebook working in a container by creating a requirements.txt file (use this "site as a general guide":https://www.docker.com/blog/containerized-python-development-part-1/) |
||
435 | * Compare the plots in this notebook with those in "Darren's report":https://wordpress.its.virginia.edu/zhenggroup/files/2023/10/SoLID_beamtest_ML_PID_Upton.pdf to try and get an understanding. |
||
436 | |||
437 | h4. Homework |
||
438 | |||
439 | * "Read chapters 0-4 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
||
440 | 56 | Richard Trotta | |
441 | --- |
||
442 | |||
443 | h3. June 11th, 2024 |
||
444 | |||
445 | h4. Introduction: PID Using Machine-Learning Methods for SoLID Beam Test Analysis |
||
446 | |||
447 | * attachment:IntroPIDUsingMachineLearningMethodsforSoLIDBeamTestAnalysis_2024.pdf |
||
448 | 58 | Richard Trotta | |
449 | --- |
||
450 | |||
451 | h3. June 25th, 2024 |
||
452 | |||
453 | 63 | Richard Trotta | h4. SoLID Workshop slides |
454 | 65 | Richard Trotta | |
455 | 63 | Richard Trotta | * "Richard's ECal/SPD":https://indico.phy.anl.gov/event/51/contributions/279/attachments/205/562/ECal_SPD_2024.pdf |
456 | * "Ye Tian's Simulations":https://indico.phy.anl.gov/event/51/contributions/264/attachments/197/545/06212024_collaboration_meeting_Ye.pdf |
||
457 | |||
458 | h4. Today's presentation |
||
459 | 65 | Richard Trotta | |
460 | 62 | Richard Trotta | * Mohhamed's slides |
461 | ** attachment:6_25_2024_Mohhamed_ML_PID.pdf |
||
462 | 66 | Richard Trotta | |
463 | h4. Near-term Goals |
||
464 | |||
465 | # Read through the physics material and collect some questions for next weeks meeting. |
||
466 | 67 | Richard Trotta | |
467 | h4. Homework |
||
468 | |||
469 | * "Read chapters 0-4 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |
||
470 | 68 | Richard Trotta | |
471 | |||
472 | --- |
||
473 | |||
474 | h3. July 8th, 2024 |
||
475 | |||
476 | h4. Uproot information |
||
477 | |||
478 | * "Starting guide":https://uproot.readthedocs.io/en/latest/basic.html |
||
479 | * "Tutorial presentation":https://indico.cern.ch/event/686137/contributions/2814517/attachments/1575846/2488415/pivarski-1.pdf |
||
480 | * "Tutorial lesson":https://masonproffitt.github.io/uproot-tutorial/03-trees/index.html |
||
481 | * "Uproot to Pandas/Numpy":https://indico.cern.ch/event/686641/contributions/2894906/attachments/1606247/2548596/pivarski-uproot.pdf |
||
482 | * "TTree handling":https://web.archive.org/web/20180812013645/http://uproot.readthedocs.io/en/latest/ttree-handling.html |
||
483 | * "Uproot and awkward array tutorial":https://indico.bnl.gov/event/8242/ |
||
484 | |||
485 | h4. Near-term Goals |
||
486 | |||
487 | * Mohhamed: |
||
488 | ** Read root data with uproot and begin training data |
||
489 | ** Make list of all necessary root leaves |
||
490 | * Taylor: |
||
491 | ** Once Richard gives you the Beam Test CSV data, begin applying classical PID cuts. Eventually, the goal is to reproduce Spencer's results. |
||
492 | * Kadosa: |
||
493 | ** Keep practicing in python for class. Once comfortable, move onto classical PID cuts. |
||
494 | |||
495 | h4. Homework |
||
496 | |||
497 | * "Read chapters 0-4 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing |