<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SoniaEscribano</id>
	<title>PBTWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SoniaEscribano"/>
	<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/wiki/Special:Contributions/SoniaEscribano"/>
	<updated>2026-04-10T03:40:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/Inventory&amp;diff=5983</id>
		<title>Proton Calorimetry/Inventory</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/Inventory&amp;diff=5983"/>
		<updated>2025-08-27T09:53:34Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Inventory of things&lt;br /&gt;
&lt;br /&gt;
* Scintillators&lt;br /&gt;
&lt;br /&gt;
* Photodiodes&lt;br /&gt;
&lt;br /&gt;
* DDC Boards&lt;br /&gt;
&lt;br /&gt;
* USB-C cables&lt;br /&gt;
&lt;br /&gt;
* FPGA&lt;br /&gt;
&lt;br /&gt;
* Raspberry pi&lt;br /&gt;
&lt;br /&gt;
* Tools&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5967</id>
		<title>ELogs/SoniaEscribano</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5967"/>
		<updated>2025-08-05T14:16:26Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To Do */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Sonia Escribano&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Analysis&#039;&#039;&#039;&lt;br /&gt;
* Analysis of QuARC as a beam monitor&lt;br /&gt;
* Compare beam monitor results with PPTC&lt;br /&gt;
* Create a git repository with latest analysis codes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raspberry pi 5 + GUI&#039;&#039;&#039;&lt;br /&gt;
* Modify live visualisation and calibration codes to include facility&lt;br /&gt;
* Add more info to error messages on the status box&lt;br /&gt;
* Add saturation error message?&lt;br /&gt;
* Replay codes?&lt;br /&gt;
* Duplicate latest version of code to new SD cards&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lab&#039;&#039;&#039;&lt;br /&gt;
* Organise all cables &lt;br /&gt;
* Create a spare set up for Trento Bem Test&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== GUI ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All the repositories can. be found here: https://github.com/UCL-Proton-Beam-Therapy/GUI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version displays the data from a file selected via a dropdown menu (using php), the Kelleter and Bortfeld curves, and the energy and range of the beam as a legend.&lt;br /&gt;
[https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/ https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/]&lt;br /&gt;
&lt;br /&gt;
* Create a file with Manchester data&lt;br /&gt;
* Fix cache busting in Google Chrome&lt;br /&gt;
* Overlap between users in different browsers&lt;br /&gt;
* Determine number of points per PD for files&lt;br /&gt;
* Responsivity in different devices is not considered&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.06&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.06 has a unique start/stop button and displays live data when running a shell script via terminal.&lt;br /&gt;
* Zooming issue: PDdata and fitted data do not scale at the same rate, when zooming there is a shifting between the two -&amp;gt; Use linear scales for both ✓&lt;br /&gt;
* When clicking stop freeze the graph but do not make it dissapear  ✓&lt;br /&gt;
* Modify code to give - instead of 0 when fit not performed ✓&lt;br /&gt;
* Plot data with 20 points ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.05&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.05 has two separate start and stop button&lt;br /&gt;
&lt;br /&gt;
* Upload files to new directory ✓&lt;br /&gt;
* Modify position of error bars ✓&lt;br /&gt;
* x-axis zooming problem: only some numbers work ✓&lt;br /&gt;
* Fix misalignment between PDdata and FITdata ✓&lt;br /&gt;
* Test access from NUC PC ✓&lt;br /&gt;
&lt;br /&gt;
== Knowledge Transfer ==&lt;br /&gt;
- Future work in QuARC: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work]&lt;br /&gt;
&lt;br /&gt;
- Summary : [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information]&lt;br /&gt;
&lt;br /&gt;
== Replay + Fit ==&lt;br /&gt;
Two different codes are used for the data analysis: replay.py and fit.cpp, their functionalities are described below.&lt;br /&gt;
&lt;br /&gt;
replay.py code calibrates and subtracts the background of each measurement, generating an output text file with header information, all the individual calibrated measurements and the average of them all. An example file with data from Clatterbridge Hospital of what the generated file looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_calibrated.txt], every individual run fit takes ~3.3s on a MacBook to be completed. All of them can be processed together by running the shell script ./replayshell.sh. To run this code we need the following arguments:&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
fit.cpp averages the data at a user specified frequency (or generic 25 Hz) and then performs Bortfeld and Kelleter fits to the data. After the fitting, the beam energy and range are extracted for each of those averaged measurements. All of them can be processed together by running the shell script ./fitshell.sh An example of what the output of fit.cpp looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_fitted_25Hz.txt]. This code needs to be compiled, and then run with the appropriate arguments.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)&lt;br /&gt;
&lt;br /&gt;
To show these data in the GUI a shell script that iterates through the lines of the fitted output file is necessary.&lt;br /&gt;
&lt;br /&gt;
Previously both of the codes were developed in cpp. The replay.cpp replays the DDC232 acquisition by either stepping through each measurement or averaging measurements at specified frame rate, while fit.cpp performs the fit on calibrated and background subtracted data.&lt;br /&gt;
&lt;br /&gt;
== Done ==&lt;br /&gt;
&lt;br /&gt;
* PARTREC pictures uploaded to: /unix/pbt/data/partrec/20221125/Pictures&lt;br /&gt;
* Cut Mylar foil sheets for Manchester experiment &lt;br /&gt;
* Talk to Derek about Mylar foil.&lt;br /&gt;
* Probation meeting with Simon (fill form)&lt;br /&gt;
* Set up new MacBook Pro: might need dual booting (talk to Tony Hoare about Windows).&lt;br /&gt;
* Set up Geant4 simulations of detector → copied and running&lt;br /&gt;
* Port Saad&#039;s FPGA data replay code to Python → copied&lt;br /&gt;
* Duplicate functionality of Fern&#039;s GUI in D3.&lt;br /&gt;
&lt;br /&gt;
== Quick-start ==&lt;br /&gt;
* Send a copy of pasport/ID so they can set up a contract (Bonita Carboo). Then a videocall needs to be arranged to check passport.&lt;br /&gt;
* Proof of right to work (share code via gov.uk)&lt;br /&gt;
* Sign online contract. Your employee number is here.&lt;br /&gt;
* Once you have an employee number you can check your user ID and email account [https://myaccount.ucl.ac.uk/new-staff]&lt;br /&gt;
* Welcome email with infromation for new staff member, probation and guidance [https://www.ucl.ac.uk/human-resources/ucl-induction-and-probation-policy#Policy]&lt;br /&gt;
* Check and complete the induction checklist (received on the welcome email)&lt;br /&gt;
* Get ID card: book appointment online ✓&lt;br /&gt;
* Mandatory safety training courses: Safety Induction + Fire Safety ✓&lt;br /&gt;
* Book departamental safety induction with Lee Bebbington ✓&lt;br /&gt;
* Mandatory training courses: GDPR, information security, freedom of information, DSE, diversity, unconscious bias, ✓&lt;br /&gt;
* Create a wiki account ✓&lt;br /&gt;
* Register for an account on the HEP Linux cluster (email support@hep.ucl.ac.uk) ✓&lt;br /&gt;
* Install Geant4 (instructions: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Detector_Simulation]) ✓&lt;br /&gt;
* Set up bank details online on myHR ✓&lt;br /&gt;
&lt;br /&gt;
== Important Dates ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Date&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Event&lt;br /&gt;
|-&lt;br /&gt;
|26th-27th October 2023|| Ion Imaging Workshop London&lt;br /&gt;
|-&lt;br /&gt;
|11th-13th October 2023|| ACCMED course Pavia&lt;br /&gt;
|-&lt;br /&gt;
|25th-28th July 2023|| FPGA Course RAL&lt;br /&gt;
|-&lt;br /&gt;
|3rd-7th July 2023|| HIT Online course&lt;br /&gt;
|-&lt;br /&gt;
|10th-16th June 2023|| PTCOG Conference Madrid&lt;br /&gt;
|-&lt;br /&gt;
|18th May 2023|| Clatterbridge beam test&lt;br /&gt;
|-&lt;br /&gt;
|5th Apr 2023|| PGI Seminar @Queen Mary&lt;br /&gt;
|-&lt;br /&gt;
|8th Feb 2023 || QuARC Seminar @Bristol &lt;br /&gt;
|-&lt;br /&gt;
|20th Jan 2023 || PhD Graduation York&lt;br /&gt;
|-&lt;br /&gt;
|30th Nov -  2nd Dec 2022 || FRPT Conference Barcelona&lt;br /&gt;
|-&lt;br /&gt;
|24-25th Nov 2022 || Groningen beam test &lt;br /&gt;
|-&lt;br /&gt;
|25-26th Oct 2022 || Manchester beam test&lt;br /&gt;
|-&lt;br /&gt;
|21st Oct 2022 || HEP Seminar&lt;br /&gt;
|-&lt;br /&gt;
|20th Oct 2022 || Prague&lt;br /&gt;
|-&lt;br /&gt;
|23rd Sep 2022 || VIVA York&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5966</id>
		<title>ELogs/SoniaEscribano</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5966"/>
		<updated>2025-08-05T14:15:47Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Sonia Escribano&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Analysis&#039;&#039;&#039;&lt;br /&gt;
* Analysis of QuARC as a beam monitor&lt;br /&gt;
* Compare beam monitor results with PPTC&lt;br /&gt;
* Create a git repository with latest analysis codes&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raspberry pi 5 + GUI&#039;&#039;&#039;&lt;br /&gt;
* Modify live visualisation and calibration codes to include facility&lt;br /&gt;
* Add more info to error messages on the status box&lt;br /&gt;
* Add saturation error message?&lt;br /&gt;
* Replay codes?&lt;br /&gt;
* Duplicate latest version of code to new SD cards&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lab&#039;&#039;&#039;&lt;br /&gt;
* Organise all cables &lt;br /&gt;
* Create a spare set up for Trento Bem Test&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== GUI ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All the repositories can. be found here: https://github.com/UCL-Proton-Beam-Therapy/GUI&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version displays the data from a file selected via a dropdown menu (using php), the Kelleter and Bortfeld curves, and the energy and range of the beam as a legend.&lt;br /&gt;
[https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/ https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/]&lt;br /&gt;
&lt;br /&gt;
* Create a file with Manchester data&lt;br /&gt;
* Fix cache busting in Google Chrome&lt;br /&gt;
* Overlap between users in different browsers&lt;br /&gt;
* Determine number of points per PD for files&lt;br /&gt;
* Responsivity in different devices is not considered&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.06&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.06 has a unique start/stop button and displays live data when running a shell script via terminal.&lt;br /&gt;
* Zooming issue: PDdata and fitted data do not scale at the same rate, when zooming there is a shifting between the two -&amp;gt; Use linear scales for both ✓&lt;br /&gt;
* When clicking stop freeze the graph but do not make it dissapear  ✓&lt;br /&gt;
* Modify code to give - instead of 0 when fit not performed ✓&lt;br /&gt;
* Plot data with 20 points ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.05&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.05 has two separate start and stop button&lt;br /&gt;
&lt;br /&gt;
* Upload files to new directory ✓&lt;br /&gt;
* Modify position of error bars ✓&lt;br /&gt;
* x-axis zooming problem: only some numbers work ✓&lt;br /&gt;
* Fix misalignment between PDdata and FITdata ✓&lt;br /&gt;
* Test access from NUC PC ✓&lt;br /&gt;
&lt;br /&gt;
== Knowledge Transfer ==&lt;br /&gt;
- Future work in QuARC: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work]&lt;br /&gt;
&lt;br /&gt;
- Summary : [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information]&lt;br /&gt;
&lt;br /&gt;
== Replay + Fit ==&lt;br /&gt;
Two different codes are used for the data analysis: replay.py and fit.cpp, their functionalities are described below.&lt;br /&gt;
&lt;br /&gt;
replay.py code calibrates and subtracts the background of each measurement, generating an output text file with header information, all the individual calibrated measurements and the average of them all. An example file with data from Clatterbridge Hospital of what the generated file looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_calibrated.txt], every individual run fit takes ~3.3s on a MacBook to be completed. All of them can be processed together by running the shell script ./replayshell.sh. To run this code we need the following arguments:&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
fit.cpp averages the data at a user specified frequency (or generic 25 Hz) and then performs Bortfeld and Kelleter fits to the data. After the fitting, the beam energy and range are extracted for each of those averaged measurements. All of them can be processed together by running the shell script ./fitshell.sh An example of what the output of fit.cpp looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_fitted_25Hz.txt]. This code needs to be compiled, and then run with the appropriate arguments.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)&lt;br /&gt;
&lt;br /&gt;
To show these data in the GUI a shell script that iterates through the lines of the fitted output file is necessary.&lt;br /&gt;
&lt;br /&gt;
Previously both of the codes were developed in cpp. The replay.cpp replays the DDC232 acquisition by either stepping through each measurement or averaging measurements at specified frame rate, while fit.cpp performs the fit on calibrated and background subtracted data.&lt;br /&gt;
&lt;br /&gt;
== Done ==&lt;br /&gt;
&lt;br /&gt;
* PARTREC pictures uploaded to: /unix/pbt/data/partrec/20221125/Pictures&lt;br /&gt;
* Cut Mylar foil sheets for Manchester experiment &lt;br /&gt;
* Talk to Derek about Mylar foil.&lt;br /&gt;
* Probation meeting with Simon (fill form)&lt;br /&gt;
* Set up new MacBook Pro: might need dual booting (talk to Tony Hoare about Windows).&lt;br /&gt;
* Set up Geant4 simulations of detector → copied and running&lt;br /&gt;
* Port Saad&#039;s FPGA data replay code to Python → copied&lt;br /&gt;
* Duplicate functionality of Fern&#039;s GUI in D3.&lt;br /&gt;
&lt;br /&gt;
== Quick-start ==&lt;br /&gt;
* Send a copy of pasport/ID so they can set up a contract (Bonita Carboo). Then a videocall needs to be arranged to check passport.&lt;br /&gt;
* Proof of right to work (share code via gov.uk)&lt;br /&gt;
* Sign online contract. Your employee number is here.&lt;br /&gt;
* Once you have an employee number you can check your user ID and email account [https://myaccount.ucl.ac.uk/new-staff]&lt;br /&gt;
* Welcome email with infromation for new staff member, probation and guidance [https://www.ucl.ac.uk/human-resources/ucl-induction-and-probation-policy#Policy]&lt;br /&gt;
* Check and complete the induction checklist (received on the welcome email)&lt;br /&gt;
* Get ID card: book appointment online ✓&lt;br /&gt;
* Mandatory safety training courses: Safety Induction + Fire Safety ✓&lt;br /&gt;
* Book departamental safety induction with Lee Bebbington ✓&lt;br /&gt;
* Mandatory training courses: GDPR, information security, freedom of information, DSE, diversity, unconscious bias, ✓&lt;br /&gt;
* Create a wiki account ✓&lt;br /&gt;
* Register for an account on the HEP Linux cluster (email support@hep.ucl.ac.uk) ✓&lt;br /&gt;
* Install Geant4 (instructions: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Detector_Simulation]) ✓&lt;br /&gt;
* Set up bank details online on myHR ✓&lt;br /&gt;
&lt;br /&gt;
== Important Dates ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Date&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Event&lt;br /&gt;
|-&lt;br /&gt;
|26th-27th October 2023|| Ion Imaging Workshop London&lt;br /&gt;
|-&lt;br /&gt;
|11th-13th October 2023|| ACCMED course Pavia&lt;br /&gt;
|-&lt;br /&gt;
|25th-28th July 2023|| FPGA Course RAL&lt;br /&gt;
|-&lt;br /&gt;
|3rd-7th July 2023|| HIT Online course&lt;br /&gt;
|-&lt;br /&gt;
|10th-16th June 2023|| PTCOG Conference Madrid&lt;br /&gt;
|-&lt;br /&gt;
|18th May 2023|| Clatterbridge beam test&lt;br /&gt;
|-&lt;br /&gt;
|5th Apr 2023|| PGI Seminar @Queen Mary&lt;br /&gt;
|-&lt;br /&gt;
|8th Feb 2023 || QuARC Seminar @Bristol &lt;br /&gt;
|-&lt;br /&gt;
|20th Jan 2023 || PhD Graduation York&lt;br /&gt;
|-&lt;br /&gt;
|30th Nov -  2nd Dec 2022 || FRPT Conference Barcelona&lt;br /&gt;
|-&lt;br /&gt;
|24-25th Nov 2022 || Groningen beam test &lt;br /&gt;
|-&lt;br /&gt;
|25-26th Oct 2022 || Manchester beam test&lt;br /&gt;
|-&lt;br /&gt;
|21st Oct 2022 || HEP Seminar&lt;br /&gt;
|-&lt;br /&gt;
|20th Oct 2022 || Prague&lt;br /&gt;
|-&lt;br /&gt;
|23rd Sep 2022 || VIVA York&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5965</id>
		<title>ELogs/SoniaEscribano</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5965"/>
		<updated>2025-08-05T14:11:16Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To Do */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Sonia Escribano&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Analysis&#039;&#039;&#039;&lt;br /&gt;
* Analysis of QuARC as a beam monitor&lt;br /&gt;
* Compare beam monitor results with PPTC&lt;br /&gt;
* Create a git repository with latest analysis codes&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raspberry pi 5 + GUI&#039;&#039;&#039;&lt;br /&gt;
* Modify live visualisation and calibration codes to include facility&lt;br /&gt;
* Add more info to error messages on the status box&lt;br /&gt;
* Add saturation error message?&lt;br /&gt;
* Replay codes?&lt;br /&gt;
* Duplicate latest version of code to new SD cards&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lab&#039;&#039;&#039;&lt;br /&gt;
* Organise all cables &lt;br /&gt;
* Create a spare set up for Trento Bem Test&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== GUI ==&lt;br /&gt;
&#039;&#039;&#039;Version 2.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version displays the data from a file selected via a dropdown menu (using php), the Kelleter and Bortfeld curves, and the energy and range of the beam as a legend.&lt;br /&gt;
[https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/ https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/]&lt;br /&gt;
&lt;br /&gt;
* Create a file with Manchester data&lt;br /&gt;
* Fix cache busting in Google Chrome&lt;br /&gt;
* Overlap between users in different browsers&lt;br /&gt;
* Determine number of points per PD for files&lt;br /&gt;
* Responsivity in different devices is not considered&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.06&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.06 has a unique start/stop button and displays live data when running a shell script via terminal.&lt;br /&gt;
* Zooming issue: PDdata and fitted data do not scale at the same rate, when zooming there is a shifting between the two -&amp;gt; Use linear scales for both ✓&lt;br /&gt;
* When clicking stop freeze the graph but do not make it dissapear  ✓&lt;br /&gt;
* Modify code to give - instead of 0 when fit not performed ✓&lt;br /&gt;
* Plot data with 20 points ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.05&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.05 has two separate start and stop button&lt;br /&gt;
&lt;br /&gt;
* Upload files to new directory ✓&lt;br /&gt;
* Modify position of error bars ✓&lt;br /&gt;
* x-axis zooming problem: only some numbers work ✓&lt;br /&gt;
* Fix misalignment between PDdata and FITdata ✓&lt;br /&gt;
* Test access from NUC PC ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Knowledge Transfer ==&lt;br /&gt;
- Future work in QuARC: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work]&lt;br /&gt;
&lt;br /&gt;
- Summary : [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information]&lt;br /&gt;
&lt;br /&gt;
== Replay + Fit ==&lt;br /&gt;
Two different codes are used for the data analysis: replay.py and fit.cpp, their functionalities are described below.&lt;br /&gt;
&lt;br /&gt;
replay.py code calibrates and subtracts the background of each measurement, generating an output text file with header information, all the individual calibrated measurements and the average of them all. An example file with data from Clatterbridge Hospital of what the generated file looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_calibrated.txt], every individual run fit takes ~3.3s on a MacBook to be completed. All of them can be processed together by running the shell script ./replayshell.sh. To run this code we need the following arguments:&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
fit.cpp averages the data at a user specified frequency (or generic 25 Hz) and then performs Bortfeld and Kelleter fits to the data. After the fitting, the beam energy and range are extracted for each of those averaged measurements. All of them can be processed together by running the shell script ./fitshell.sh An example of what the output of fit.cpp looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_fitted_25Hz.txt]. This code needs to be compiled, and then run with the appropriate arguments.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)&lt;br /&gt;
&lt;br /&gt;
To show these data in the GUI a shell script that iterates through the lines of the fitted output file is necessary.&lt;br /&gt;
&lt;br /&gt;
Previously both of the codes were developed in cpp. The replay.cpp replays the DDC232 acquisition by either stepping through each measurement or averaging measurements at specified frame rate, while fit.cpp performs the fit on calibrated and background subtracted data.&lt;br /&gt;
&lt;br /&gt;
== Done ==&lt;br /&gt;
&lt;br /&gt;
* PARTREC pictures uploaded to: /unix/pbt/data/partrec/20221125/Pictures&lt;br /&gt;
* Cut Mylar foil sheets for Manchester experiment &lt;br /&gt;
* Talk to Derek about Mylar foil.&lt;br /&gt;
* Probation meeting with Simon (fill form)&lt;br /&gt;
* Set up new MacBook Pro: might need dual booting (talk to Tony Hoare about Windows).&lt;br /&gt;
* Set up Geant4 simulations of detector → copied and running&lt;br /&gt;
* Port Saad&#039;s FPGA data replay code to Python → copied&lt;br /&gt;
* Duplicate functionality of Fern&#039;s GUI in D3.&lt;br /&gt;
&lt;br /&gt;
== Quick-start ==&lt;br /&gt;
* Send a copy of pasport/ID so they can set up a contract (Bonita Carboo). Then a videocall needs to be arranged to check passport.&lt;br /&gt;
* Proof of right to work (share code via gov.uk)&lt;br /&gt;
* Sign online contract. Your employee number is here.&lt;br /&gt;
* Once you have an employee number you can check your user ID and email account [https://myaccount.ucl.ac.uk/new-staff]&lt;br /&gt;
* Welcome email with infromation for new staff member, probation and guidance [https://www.ucl.ac.uk/human-resources/ucl-induction-and-probation-policy#Policy]&lt;br /&gt;
* Check and complete the induction checklist (received on the welcome email)&lt;br /&gt;
* Get ID card: book appointment online ✓&lt;br /&gt;
* Mandatory safety training courses: Safety Induction + Fire Safety ✓&lt;br /&gt;
* Book departamental safety induction with Lee Bebbington ✓&lt;br /&gt;
* Mandatory training courses: GDPR, information security, freedom of information, DSE, diversity, unconscious bias, ✓&lt;br /&gt;
* Create a wiki account ✓&lt;br /&gt;
* Register for an account on the HEP Linux cluster (email support@hep.ucl.ac.uk) ✓&lt;br /&gt;
* Install Geant4 (instructions: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Detector_Simulation]) ✓&lt;br /&gt;
* Set up bank details online on myHR ✓&lt;br /&gt;
&lt;br /&gt;
== Important Dates ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Date&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Event&lt;br /&gt;
|-&lt;br /&gt;
|26th-27th October 2023|| Ion Imaging Workshop London&lt;br /&gt;
|-&lt;br /&gt;
|11th-13th October 2023|| ACCMED course Pavia&lt;br /&gt;
|-&lt;br /&gt;
|25th-28th July 2023|| FPGA Course RAL&lt;br /&gt;
|-&lt;br /&gt;
|3rd-7th July 2023|| HIT Online course&lt;br /&gt;
|-&lt;br /&gt;
|10th-16th June 2023|| PTCOG Conference Madrid&lt;br /&gt;
|-&lt;br /&gt;
|18th May 2023|| Clatterbridge beam test&lt;br /&gt;
|-&lt;br /&gt;
|5th Apr 2023|| PGI Seminar @Queen Mary&lt;br /&gt;
|-&lt;br /&gt;
|8th Feb 2023 || QuARC Seminar @Bristol &lt;br /&gt;
|-&lt;br /&gt;
|20th Jan 2023 || PhD Graduation York&lt;br /&gt;
|-&lt;br /&gt;
|30th Nov -  2nd Dec 2022 || FRPT Conference Barcelona&lt;br /&gt;
|-&lt;br /&gt;
|24-25th Nov 2022 || Groningen beam test &lt;br /&gt;
|-&lt;br /&gt;
|25-26th Oct 2022 || Manchester beam test&lt;br /&gt;
|-&lt;br /&gt;
|21st Oct 2022 || HEP Seminar&lt;br /&gt;
|-&lt;br /&gt;
|20th Oct 2022 || Prague&lt;br /&gt;
|-&lt;br /&gt;
|23rd Sep 2022 || VIVA York&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5964</id>
		<title>ELogs/SoniaEscribano</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5964"/>
		<updated>2025-08-05T14:10:26Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To Do */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Sonia Escribano&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Analysis&#039;&#039;&#039;&lt;br /&gt;
* Analysis of QuARC as a beam monitor&lt;br /&gt;
* Compare beam monitor results with PPTC&lt;br /&gt;
* Create a git repository with latest analysis codes&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raspberry pi 5&#039;&#039;&#039;&lt;br /&gt;
* Modify live visualisation and calibration codes to include facility&lt;br /&gt;
* Add more info to error messages on the status box&lt;br /&gt;
* Add saturation error message?&lt;br /&gt;
* Duplicate latest version of code to new SD cards&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lab&#039;&#039;&#039;&lt;br /&gt;
* Organise all cables &lt;br /&gt;
* Create a spare set up for Trento Bem Test&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== GUI ==&lt;br /&gt;
&#039;&#039;&#039;Version 2.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version displays the data from a file selected via a dropdown menu (using php), the Kelleter and Bortfeld curves, and the energy and range of the beam as a legend.&lt;br /&gt;
[https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/ https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/]&lt;br /&gt;
&lt;br /&gt;
* Create a file with Manchester data&lt;br /&gt;
* Fix cache busting in Google Chrome&lt;br /&gt;
* Overlap between users in different browsers&lt;br /&gt;
* Determine number of points per PD for files&lt;br /&gt;
* Responsivity in different devices is not considered&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.06&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.06 has a unique start/stop button and displays live data when running a shell script via terminal.&lt;br /&gt;
* Zooming issue: PDdata and fitted data do not scale at the same rate, when zooming there is a shifting between the two -&amp;gt; Use linear scales for both ✓&lt;br /&gt;
* When clicking stop freeze the graph but do not make it dissapear  ✓&lt;br /&gt;
* Modify code to give - instead of 0 when fit not performed ✓&lt;br /&gt;
* Plot data with 20 points ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.05&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.05 has two separate start and stop button&lt;br /&gt;
&lt;br /&gt;
* Upload files to new directory ✓&lt;br /&gt;
* Modify position of error bars ✓&lt;br /&gt;
* x-axis zooming problem: only some numbers work ✓&lt;br /&gt;
* Fix misalignment between PDdata and FITdata ✓&lt;br /&gt;
* Test access from NUC PC ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Knowledge Transfer ==&lt;br /&gt;
- Future work in QuARC: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work]&lt;br /&gt;
&lt;br /&gt;
- Summary : [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information]&lt;br /&gt;
&lt;br /&gt;
== Replay + Fit ==&lt;br /&gt;
Two different codes are used for the data analysis: replay.py and fit.cpp, their functionalities are described below.&lt;br /&gt;
&lt;br /&gt;
replay.py code calibrates and subtracts the background of each measurement, generating an output text file with header information, all the individual calibrated measurements and the average of them all. An example file with data from Clatterbridge Hospital of what the generated file looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_calibrated.txt], every individual run fit takes ~3.3s on a MacBook to be completed. All of them can be processed together by running the shell script ./replayshell.sh. To run this code we need the following arguments:&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
fit.cpp averages the data at a user specified frequency (or generic 25 Hz) and then performs Bortfeld and Kelleter fits to the data. After the fitting, the beam energy and range are extracted for each of those averaged measurements. All of them can be processed together by running the shell script ./fitshell.sh An example of what the output of fit.cpp looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_fitted_25Hz.txt]. This code needs to be compiled, and then run with the appropriate arguments.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)&lt;br /&gt;
&lt;br /&gt;
To show these data in the GUI a shell script that iterates through the lines of the fitted output file is necessary.&lt;br /&gt;
&lt;br /&gt;
Previously both of the codes were developed in cpp. The replay.cpp replays the DDC232 acquisition by either stepping through each measurement or averaging measurements at specified frame rate, while fit.cpp performs the fit on calibrated and background subtracted data.&lt;br /&gt;
&lt;br /&gt;
== Done ==&lt;br /&gt;
&lt;br /&gt;
* PARTREC pictures uploaded to: /unix/pbt/data/partrec/20221125/Pictures&lt;br /&gt;
* Cut Mylar foil sheets for Manchester experiment &lt;br /&gt;
* Talk to Derek about Mylar foil.&lt;br /&gt;
* Probation meeting with Simon (fill form)&lt;br /&gt;
* Set up new MacBook Pro: might need dual booting (talk to Tony Hoare about Windows).&lt;br /&gt;
* Set up Geant4 simulations of detector → copied and running&lt;br /&gt;
* Port Saad&#039;s FPGA data replay code to Python → copied&lt;br /&gt;
* Duplicate functionality of Fern&#039;s GUI in D3.&lt;br /&gt;
&lt;br /&gt;
== Quick-start ==&lt;br /&gt;
* Send a copy of pasport/ID so they can set up a contract (Bonita Carboo). Then a videocall needs to be arranged to check passport.&lt;br /&gt;
* Proof of right to work (share code via gov.uk)&lt;br /&gt;
* Sign online contract. Your employee number is here.&lt;br /&gt;
* Once you have an employee number you can check your user ID and email account [https://myaccount.ucl.ac.uk/new-staff]&lt;br /&gt;
* Welcome email with infromation for new staff member, probation and guidance [https://www.ucl.ac.uk/human-resources/ucl-induction-and-probation-policy#Policy]&lt;br /&gt;
* Check and complete the induction checklist (received on the welcome email)&lt;br /&gt;
* Get ID card: book appointment online ✓&lt;br /&gt;
* Mandatory safety training courses: Safety Induction + Fire Safety ✓&lt;br /&gt;
* Book departamental safety induction with Lee Bebbington ✓&lt;br /&gt;
* Mandatory training courses: GDPR, information security, freedom of information, DSE, diversity, unconscious bias, ✓&lt;br /&gt;
* Create a wiki account ✓&lt;br /&gt;
* Register for an account on the HEP Linux cluster (email support@hep.ucl.ac.uk) ✓&lt;br /&gt;
* Install Geant4 (instructions: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Detector_Simulation]) ✓&lt;br /&gt;
* Set up bank details online on myHR ✓&lt;br /&gt;
&lt;br /&gt;
== Important Dates ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Date&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Event&lt;br /&gt;
|-&lt;br /&gt;
|26th-27th October 2023|| Ion Imaging Workshop London&lt;br /&gt;
|-&lt;br /&gt;
|11th-13th October 2023|| ACCMED course Pavia&lt;br /&gt;
|-&lt;br /&gt;
|25th-28th July 2023|| FPGA Course RAL&lt;br /&gt;
|-&lt;br /&gt;
|3rd-7th July 2023|| HIT Online course&lt;br /&gt;
|-&lt;br /&gt;
|10th-16th June 2023|| PTCOG Conference Madrid&lt;br /&gt;
|-&lt;br /&gt;
|18th May 2023|| Clatterbridge beam test&lt;br /&gt;
|-&lt;br /&gt;
|5th Apr 2023|| PGI Seminar @Queen Mary&lt;br /&gt;
|-&lt;br /&gt;
|8th Feb 2023 || QuARC Seminar @Bristol &lt;br /&gt;
|-&lt;br /&gt;
|20th Jan 2023 || PhD Graduation York&lt;br /&gt;
|-&lt;br /&gt;
|30th Nov -  2nd Dec 2022 || FRPT Conference Barcelona&lt;br /&gt;
|-&lt;br /&gt;
|24-25th Nov 2022 || Groningen beam test &lt;br /&gt;
|-&lt;br /&gt;
|25-26th Oct 2022 || Manchester beam test&lt;br /&gt;
|-&lt;br /&gt;
|21st Oct 2022 || HEP Seminar&lt;br /&gt;
|-&lt;br /&gt;
|20th Oct 2022 || Prague&lt;br /&gt;
|-&lt;br /&gt;
|23rd Sep 2022 || VIVA York&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5963</id>
		<title>ELogs/SoniaEscribano</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5963"/>
		<updated>2025-08-05T14:10:15Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To Do */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Sonia Escribano&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Analysis&#039;&#039;&#039;&lt;br /&gt;
* Analysis of QuARC as a beam monitor&lt;br /&gt;
* Compare beam monitor results with PPTC&lt;br /&gt;
* Create a git repository with latest analysis codes&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raspberry pi 5&#039;&#039;&#039;&lt;br /&gt;
- Modify live visualisation and calibration codes to include facility&lt;br /&gt;
- Add more info to error messages on the status box&lt;br /&gt;
- Add saturation error message?&lt;br /&gt;
- Duplicate latest version of code to new SD cards&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lab&#039;&#039;&#039;&lt;br /&gt;
* Organise all cables &lt;br /&gt;
* Create a spare set up for Trento Bem Test&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== GUI ==&lt;br /&gt;
&#039;&#039;&#039;Version 2.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version displays the data from a file selected via a dropdown menu (using php), the Kelleter and Bortfeld curves, and the energy and range of the beam as a legend.&lt;br /&gt;
[https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/ https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/]&lt;br /&gt;
&lt;br /&gt;
* Create a file with Manchester data&lt;br /&gt;
* Fix cache busting in Google Chrome&lt;br /&gt;
* Overlap between users in different browsers&lt;br /&gt;
* Determine number of points per PD for files&lt;br /&gt;
* Responsivity in different devices is not considered&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.06&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.06 has a unique start/stop button and displays live data when running a shell script via terminal.&lt;br /&gt;
* Zooming issue: PDdata and fitted data do not scale at the same rate, when zooming there is a shifting between the two -&amp;gt; Use linear scales for both ✓&lt;br /&gt;
* When clicking stop freeze the graph but do not make it dissapear  ✓&lt;br /&gt;
* Modify code to give - instead of 0 when fit not performed ✓&lt;br /&gt;
* Plot data with 20 points ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.05&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.05 has two separate start and stop button&lt;br /&gt;
&lt;br /&gt;
* Upload files to new directory ✓&lt;br /&gt;
* Modify position of error bars ✓&lt;br /&gt;
* x-axis zooming problem: only some numbers work ✓&lt;br /&gt;
* Fix misalignment between PDdata and FITdata ✓&lt;br /&gt;
* Test access from NUC PC ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Knowledge Transfer ==&lt;br /&gt;
- Future work in QuARC: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work]&lt;br /&gt;
&lt;br /&gt;
- Summary : [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information]&lt;br /&gt;
&lt;br /&gt;
== Replay + Fit ==&lt;br /&gt;
Two different codes are used for the data analysis: replay.py and fit.cpp, their functionalities are described below.&lt;br /&gt;
&lt;br /&gt;
replay.py code calibrates and subtracts the background of each measurement, generating an output text file with header information, all the individual calibrated measurements and the average of them all. An example file with data from Clatterbridge Hospital of what the generated file looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_calibrated.txt], every individual run fit takes ~3.3s on a MacBook to be completed. All of them can be processed together by running the shell script ./replayshell.sh. To run this code we need the following arguments:&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
fit.cpp averages the data at a user specified frequency (or generic 25 Hz) and then performs Bortfeld and Kelleter fits to the data. After the fitting, the beam energy and range are extracted for each of those averaged measurements. All of them can be processed together by running the shell script ./fitshell.sh An example of what the output of fit.cpp looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_fitted_25Hz.txt]. This code needs to be compiled, and then run with the appropriate arguments.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)&lt;br /&gt;
&lt;br /&gt;
To show these data in the GUI a shell script that iterates through the lines of the fitted output file is necessary.&lt;br /&gt;
&lt;br /&gt;
Previously both of the codes were developed in cpp. The replay.cpp replays the DDC232 acquisition by either stepping through each measurement or averaging measurements at specified frame rate, while fit.cpp performs the fit on calibrated and background subtracted data.&lt;br /&gt;
&lt;br /&gt;
== Done ==&lt;br /&gt;
&lt;br /&gt;
* PARTREC pictures uploaded to: /unix/pbt/data/partrec/20221125/Pictures&lt;br /&gt;
* Cut Mylar foil sheets for Manchester experiment &lt;br /&gt;
* Talk to Derek about Mylar foil.&lt;br /&gt;
* Probation meeting with Simon (fill form)&lt;br /&gt;
* Set up new MacBook Pro: might need dual booting (talk to Tony Hoare about Windows).&lt;br /&gt;
* Set up Geant4 simulations of detector → copied and running&lt;br /&gt;
* Port Saad&#039;s FPGA data replay code to Python → copied&lt;br /&gt;
* Duplicate functionality of Fern&#039;s GUI in D3.&lt;br /&gt;
&lt;br /&gt;
== Quick-start ==&lt;br /&gt;
* Send a copy of pasport/ID so they can set up a contract (Bonita Carboo). Then a videocall needs to be arranged to check passport.&lt;br /&gt;
* Proof of right to work (share code via gov.uk)&lt;br /&gt;
* Sign online contract. Your employee number is here.&lt;br /&gt;
* Once you have an employee number you can check your user ID and email account [https://myaccount.ucl.ac.uk/new-staff]&lt;br /&gt;
* Welcome email with infromation for new staff member, probation and guidance [https://www.ucl.ac.uk/human-resources/ucl-induction-and-probation-policy#Policy]&lt;br /&gt;
* Check and complete the induction checklist (received on the welcome email)&lt;br /&gt;
* Get ID card: book appointment online ✓&lt;br /&gt;
* Mandatory safety training courses: Safety Induction + Fire Safety ✓&lt;br /&gt;
* Book departamental safety induction with Lee Bebbington ✓&lt;br /&gt;
* Mandatory training courses: GDPR, information security, freedom of information, DSE, diversity, unconscious bias, ✓&lt;br /&gt;
* Create a wiki account ✓&lt;br /&gt;
* Register for an account on the HEP Linux cluster (email support@hep.ucl.ac.uk) ✓&lt;br /&gt;
* Install Geant4 (instructions: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Detector_Simulation]) ✓&lt;br /&gt;
* Set up bank details online on myHR ✓&lt;br /&gt;
&lt;br /&gt;
== Important Dates ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Date&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Event&lt;br /&gt;
|-&lt;br /&gt;
|26th-27th October 2023|| Ion Imaging Workshop London&lt;br /&gt;
|-&lt;br /&gt;
|11th-13th October 2023|| ACCMED course Pavia&lt;br /&gt;
|-&lt;br /&gt;
|25th-28th July 2023|| FPGA Course RAL&lt;br /&gt;
|-&lt;br /&gt;
|3rd-7th July 2023|| HIT Online course&lt;br /&gt;
|-&lt;br /&gt;
|10th-16th June 2023|| PTCOG Conference Madrid&lt;br /&gt;
|-&lt;br /&gt;
|18th May 2023|| Clatterbridge beam test&lt;br /&gt;
|-&lt;br /&gt;
|5th Apr 2023|| PGI Seminar @Queen Mary&lt;br /&gt;
|-&lt;br /&gt;
|8th Feb 2023 || QuARC Seminar @Bristol &lt;br /&gt;
|-&lt;br /&gt;
|20th Jan 2023 || PhD Graduation York&lt;br /&gt;
|-&lt;br /&gt;
|30th Nov -  2nd Dec 2022 || FRPT Conference Barcelona&lt;br /&gt;
|-&lt;br /&gt;
|24-25th Nov 2022 || Groningen beam test &lt;br /&gt;
|-&lt;br /&gt;
|25-26th Oct 2022 || Manchester beam test&lt;br /&gt;
|-&lt;br /&gt;
|21st Oct 2022 || HEP Seminar&lt;br /&gt;
|-&lt;br /&gt;
|20th Oct 2022 || Prague&lt;br /&gt;
|-&lt;br /&gt;
|23rd Sep 2022 || VIVA York&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5962</id>
		<title>ELogs/SoniaEscribano</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/SoniaEscribano&amp;diff=5962"/>
		<updated>2025-08-05T14:08:54Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To Do */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Sonia Escribano&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
* Data analysis:&lt;br /&gt;
- Analysis of QuARC as a beam monitor&lt;br /&gt;
- Compare beam monitor results with PPTC&lt;br /&gt;
- Create a git repository with latest analysis codes&lt;br /&gt;
&lt;br /&gt;
* Raspberry pi 5:&lt;br /&gt;
- Modify live visualisation and calibration codes to include facility&lt;br /&gt;
- Add more info to error messages on the status box&lt;br /&gt;
- Add saturation error message?&lt;br /&gt;
- Duplicate latest version of code to new SD cards&lt;br /&gt;
&lt;br /&gt;
== GUI ==&lt;br /&gt;
&#039;&#039;&#039;Version 2.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version displays the data from a file selected via a dropdown menu (using php), the Kelleter and Bortfeld curves, and the energy and range of the beam as a legend.&lt;br /&gt;
[https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/ https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.1/]&lt;br /&gt;
&lt;br /&gt;
* Create a file with Manchester data&lt;br /&gt;
* Fix cache busting in Google Chrome&lt;br /&gt;
* Overlap between users in different browsers&lt;br /&gt;
* Determine number of points per PD for files&lt;br /&gt;
* Responsivity in different devices is not considered&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.06&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.06 has a unique start/stop button and displays live data when running a shell script via terminal.&lt;br /&gt;
* Zooming issue: PDdata and fitted data do not scale at the same rate, when zooming there is a shifting between the two -&amp;gt; Use linear scales for both ✓&lt;br /&gt;
* When clicking stop freeze the graph but do not make it dissapear  ✓&lt;br /&gt;
* Modify code to give - instead of 0 when fit not performed ✓&lt;br /&gt;
* Plot data with 20 points ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Version 2.05&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Version 2.05 has two separate start and stop button&lt;br /&gt;
&lt;br /&gt;
* Upload files to new directory ✓&lt;br /&gt;
* Modify position of error bars ✓&lt;br /&gt;
* x-axis zooming problem: only some numbers work ✓&lt;br /&gt;
* Fix misalignment between PDdata and FITdata ✓&lt;br /&gt;
* Test access from NUC PC ✓&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Knowledge Transfer ==&lt;br /&gt;
- Future work in QuARC: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Future_Work]&lt;br /&gt;
&lt;br /&gt;
- Summary : [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Equipment/QuARC_General_Information]&lt;br /&gt;
&lt;br /&gt;
== Replay + Fit ==&lt;br /&gt;
Two different codes are used for the data analysis: replay.py and fit.cpp, their functionalities are described below.&lt;br /&gt;
&lt;br /&gt;
replay.py code calibrates and subtracts the background of each measurement, generating an output text file with header information, all the individual calibrated measurements and the average of them all. An example file with data from Clatterbridge Hospital of what the generated file looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_calibrated.txt], every individual run fit takes ~3.3s on a MacBook to be completed. All of them can be processed together by running the shell script ./replayshell.sh. To run this code we need the following arguments:&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
fit.cpp averages the data at a user specified frequency (or generic 25 Hz) and then performs Bortfeld and Kelleter fits to the data. After the fitting, the beam energy and range are extracted for each of those averaged measurements. All of them can be processed together by running the shell script ./fitshell.sh An example of what the output of fit.cpp looks like can be found here [https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/Run001_fitted_25Hz.txt]. This code needs to be compiled, and then run with the appropriate arguments.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)&lt;br /&gt;
&lt;br /&gt;
To show these data in the GUI a shell script that iterates through the lines of the fitted output file is necessary.&lt;br /&gt;
&lt;br /&gt;
Previously both of the codes were developed in cpp. The replay.cpp replays the DDC232 acquisition by either stepping through each measurement or averaging measurements at specified frame rate, while fit.cpp performs the fit on calibrated and background subtracted data.&lt;br /&gt;
&lt;br /&gt;
== Done ==&lt;br /&gt;
&lt;br /&gt;
* PARTREC pictures uploaded to: /unix/pbt/data/partrec/20221125/Pictures&lt;br /&gt;
* Cut Mylar foil sheets for Manchester experiment &lt;br /&gt;
* Talk to Derek about Mylar foil.&lt;br /&gt;
* Probation meeting with Simon (fill form)&lt;br /&gt;
* Set up new MacBook Pro: might need dual booting (talk to Tony Hoare about Windows).&lt;br /&gt;
* Set up Geant4 simulations of detector → copied and running&lt;br /&gt;
* Port Saad&#039;s FPGA data replay code to Python → copied&lt;br /&gt;
* Duplicate functionality of Fern&#039;s GUI in D3.&lt;br /&gt;
&lt;br /&gt;
== Quick-start ==&lt;br /&gt;
* Send a copy of pasport/ID so they can set up a contract (Bonita Carboo). Then a videocall needs to be arranged to check passport.&lt;br /&gt;
* Proof of right to work (share code via gov.uk)&lt;br /&gt;
* Sign online contract. Your employee number is here.&lt;br /&gt;
* Once you have an employee number you can check your user ID and email account [https://myaccount.ucl.ac.uk/new-staff]&lt;br /&gt;
* Welcome email with infromation for new staff member, probation and guidance [https://www.ucl.ac.uk/human-resources/ucl-induction-and-probation-policy#Policy]&lt;br /&gt;
* Check and complete the induction checklist (received on the welcome email)&lt;br /&gt;
* Get ID card: book appointment online ✓&lt;br /&gt;
* Mandatory safety training courses: Safety Induction + Fire Safety ✓&lt;br /&gt;
* Book departamental safety induction with Lee Bebbington ✓&lt;br /&gt;
* Mandatory training courses: GDPR, information security, freedom of information, DSE, diversity, unconscious bias, ✓&lt;br /&gt;
* Create a wiki account ✓&lt;br /&gt;
* Register for an account on the HEP Linux cluster (email support@hep.ucl.ac.uk) ✓&lt;br /&gt;
* Install Geant4 (instructions: [https://www.hep.ucl.ac.uk/pbt/wiki/Proton_Calorimetry/Detector_Simulation]) ✓&lt;br /&gt;
* Set up bank details online on myHR ✓&lt;br /&gt;
&lt;br /&gt;
== Important Dates ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Date&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Event&lt;br /&gt;
|-&lt;br /&gt;
|26th-27th October 2023|| Ion Imaging Workshop London&lt;br /&gt;
|-&lt;br /&gt;
|11th-13th October 2023|| ACCMED course Pavia&lt;br /&gt;
|-&lt;br /&gt;
|25th-28th July 2023|| FPGA Course RAL&lt;br /&gt;
|-&lt;br /&gt;
|3rd-7th July 2023|| HIT Online course&lt;br /&gt;
|-&lt;br /&gt;
|10th-16th June 2023|| PTCOG Conference Madrid&lt;br /&gt;
|-&lt;br /&gt;
|18th May 2023|| Clatterbridge beam test&lt;br /&gt;
|-&lt;br /&gt;
|5th Apr 2023|| PGI Seminar @Queen Mary&lt;br /&gt;
|-&lt;br /&gt;
|8th Feb 2023 || QuARC Seminar @Bristol &lt;br /&gt;
|-&lt;br /&gt;
|20th Jan 2023 || PhD Graduation York&lt;br /&gt;
|-&lt;br /&gt;
|30th Nov -  2nd Dec 2022 || FRPT Conference Barcelona&lt;br /&gt;
|-&lt;br /&gt;
|24-25th Nov 2022 || Groningen beam test &lt;br /&gt;
|-&lt;br /&gt;
|25-26th Oct 2022 || Manchester beam test&lt;br /&gt;
|-&lt;br /&gt;
|21st Oct 2022 || HEP Seminar&lt;br /&gt;
|-&lt;br /&gt;
|20th Oct 2022 || Prague&lt;br /&gt;
|-&lt;br /&gt;
|23rd Sep 2022 || VIVA York&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5697</id>
		<title>Proton Calorimetry</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5697"/>
		<updated>2024-12-11T17:03:13Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Inventory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains information about the UCL Proton Calorimetry project.&lt;br /&gt;
&lt;br /&gt;
== [[/Experimental Runs|Experimental Runs]] ==&lt;br /&gt;
&lt;br /&gt;
Details of each of the experimental runs made with the Proton Calorimetry detector can be found on the [[/Experimental Runs|Experimental Runs]] page.&lt;br /&gt;
&lt;br /&gt;
== [[/Equipment|Detector Equipment]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the hardware used for the Proton Calorimetry systems.&lt;br /&gt;
&lt;br /&gt;
== [[/Inventory|Inventory]] ==&lt;br /&gt;
Inventory of QuARC thingsss&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Analysis|Detector Analysis]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the code used for the QuARC data Analysis.&lt;br /&gt;
&lt;br /&gt;
== [[/User Interface|Graphical User Interface]] ==&lt;br /&gt;
&lt;br /&gt;
Details of the setup and design of the QuARC GUI.&lt;br /&gt;
&lt;br /&gt;
== [[/QuARC Data Files|QuARC Data File Format]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the structure of the data files produced by the QuARC.&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Simulation|Detector Simulation]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the Geant4 code used for Proton Calorimetry simulation.&lt;br /&gt;
&lt;br /&gt;
== [[/Meetings|Meeting Minutes]] ==&lt;br /&gt;
&lt;br /&gt;
For minutes of Proton Calorimetry Meetings, see the [[/Meetings|Meeting Minutes]] page.&lt;br /&gt;
&lt;br /&gt;
== [[ELogs|Electronic Logs]] ==&lt;br /&gt;
&lt;br /&gt;
ELogs for each person working on a PBT-related research project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [[/Future Work|Future Work]] ==&lt;br /&gt;
&lt;br /&gt;
Future work for the QuARC&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/Inventory&amp;diff=5696</id>
		<title>Proton Calorimetry/Inventory</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/Inventory&amp;diff=5696"/>
		<updated>2024-12-11T17:01:29Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: Created page with &amp;quot;Inventory of things&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Inventory of things&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5695</id>
		<title>Proton Calorimetry</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5695"/>
		<updated>2024-12-11T17:01:14Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Inventory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains information about the UCL Proton Calorimetry project.&lt;br /&gt;
&lt;br /&gt;
== [[/Experimental Runs|Experimental Runs]] ==&lt;br /&gt;
&lt;br /&gt;
Details of each of the experimental runs made with the Proton Calorimetry detector can be found on the [[/Experimental Runs|Experimental Runs]] page.&lt;br /&gt;
&lt;br /&gt;
== [[/Equipment|Detector Equipment]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the hardware used for the Proton Calorimetry systems.&lt;br /&gt;
&lt;br /&gt;
== [[/Inventory|Inventory]] ==&lt;br /&gt;
Inventory of QuARC things&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Analysis|Detector Analysis]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the code used for the QuARC data Analysis.&lt;br /&gt;
&lt;br /&gt;
== [[/User Interface|Graphical User Interface]] ==&lt;br /&gt;
&lt;br /&gt;
Details of the setup and design of the QuARC GUI.&lt;br /&gt;
&lt;br /&gt;
== [[/QuARC Data Files|QuARC Data File Format]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the structure of the data files produced by the QuARC.&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Simulation|Detector Simulation]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the Geant4 code used for Proton Calorimetry simulation.&lt;br /&gt;
&lt;br /&gt;
== [[/Meetings|Meeting Minutes]] ==&lt;br /&gt;
&lt;br /&gt;
For minutes of Proton Calorimetry Meetings, see the [[/Meetings|Meeting Minutes]] page.&lt;br /&gt;
&lt;br /&gt;
== [[ELogs|Electronic Logs]] ==&lt;br /&gt;
&lt;br /&gt;
ELogs for each person working on a PBT-related research project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [[/Future Work|Future Work]] ==&lt;br /&gt;
&lt;br /&gt;
Future work for the QuARC&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Inventory&amp;diff=5694</id>
		<title>Inventory</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Inventory&amp;diff=5694"/>
		<updated>2024-12-11T17:00:33Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: Created page with &amp;quot;Cables:&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cables:&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5693</id>
		<title>Proton Calorimetry</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5693"/>
		<updated>2024-12-11T17:00:24Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Inventory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains information about the UCL Proton Calorimetry project.&lt;br /&gt;
&lt;br /&gt;
== [[/Experimental Runs|Experimental Runs]] ==&lt;br /&gt;
&lt;br /&gt;
Details of each of the experimental runs made with the Proton Calorimetry detector can be found on the [[/Experimental Runs|Experimental Runs]] page.&lt;br /&gt;
&lt;br /&gt;
== [[/Equipment|Detector Equipment]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the hardware used for the Proton Calorimetry systems.&lt;br /&gt;
&lt;br /&gt;
== [[Inventory|Inventory]] ==&lt;br /&gt;
Inventory of QuARC things&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Analysis|Detector Analysis]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the code used for the QuARC data Analysis.&lt;br /&gt;
&lt;br /&gt;
== [[/User Interface|Graphical User Interface]] ==&lt;br /&gt;
&lt;br /&gt;
Details of the setup and design of the QuARC GUI.&lt;br /&gt;
&lt;br /&gt;
== [[/QuARC Data Files|QuARC Data File Format]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the structure of the data files produced by the QuARC.&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Simulation|Detector Simulation]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the Geant4 code used for Proton Calorimetry simulation.&lt;br /&gt;
&lt;br /&gt;
== [[/Meetings|Meeting Minutes]] ==&lt;br /&gt;
&lt;br /&gt;
For minutes of Proton Calorimetry Meetings, see the [[/Meetings|Meeting Minutes]] page.&lt;br /&gt;
&lt;br /&gt;
== [[ELogs|Electronic Logs]] ==&lt;br /&gt;
&lt;br /&gt;
ELogs for each person working on a PBT-related research project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [[/Future Work|Future Work]] ==&lt;br /&gt;
&lt;br /&gt;
Future work for the QuARC&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5692</id>
		<title>Proton Calorimetry</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry&amp;diff=5692"/>
		<updated>2024-12-11T17:00:12Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Detector Equipment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains information about the UCL Proton Calorimetry project.&lt;br /&gt;
&lt;br /&gt;
== [[/Experimental Runs|Experimental Runs]] ==&lt;br /&gt;
&lt;br /&gt;
Details of each of the experimental runs made with the Proton Calorimetry detector can be found on the [[/Experimental Runs|Experimental Runs]] page.&lt;br /&gt;
&lt;br /&gt;
== [[/Equipment|Detector Equipment]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the hardware used for the Proton Calorimetry systems.&lt;br /&gt;
&lt;br /&gt;
== [[Inventory|Inventory]] ==&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Analysis|Detector Analysis]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the code used for the QuARC data Analysis.&lt;br /&gt;
&lt;br /&gt;
== [[/User Interface|Graphical User Interface]] ==&lt;br /&gt;
&lt;br /&gt;
Details of the setup and design of the QuARC GUI.&lt;br /&gt;
&lt;br /&gt;
== [[/QuARC Data Files|QuARC Data File Format]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the structure of the data files produced by the QuARC.&lt;br /&gt;
&lt;br /&gt;
== [[/Detector Simulation|Detector Simulation]] ==&lt;br /&gt;
&lt;br /&gt;
Information on the Geant4 code used for Proton Calorimetry simulation.&lt;br /&gt;
&lt;br /&gt;
== [[/Meetings|Meeting Minutes]] ==&lt;br /&gt;
&lt;br /&gt;
For minutes of Proton Calorimetry Meetings, see the [[/Meetings|Meeting Minutes]] page.&lt;br /&gt;
&lt;br /&gt;
== [[ELogs|Electronic Logs]] ==&lt;br /&gt;
&lt;br /&gt;
ELogs for each person working on a PBT-related research project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [[/Future Work|Future Work]] ==&lt;br /&gt;
&lt;br /&gt;
Future work for the QuARC&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5691</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5691"/>
		<updated>2024-12-06T13:30:09Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To do list for GUI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.3:&lt;br /&gt;
- Upload versions to github&lt;br /&gt;
&lt;br /&gt;
- Update wiki&lt;br /&gt;
&lt;br /&gt;
- Check errors&lt;br /&gt;
&lt;br /&gt;
- Check differences between live calibration and post calibration&lt;br /&gt;
&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php ✓&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI &lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.✓&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.✓&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.✓&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.1 and 3.2==&lt;br /&gt;
These two versions had some issues because of the FTDI code, so they are skipped.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
FTDI code: combination of Sonia&#039;s + Matt’s -&amp;gt; FTDI_GUI.cpp&lt;br /&gt;
&lt;br /&gt;
Calibrate code: calibrate_fit.cpp&lt;br /&gt;
&lt;br /&gt;
Fit code: sudo ./fit_average false 100 UCLH UCLH/20240418 Run022.txt 25&lt;br /&gt;
&lt;br /&gt;
- DAQ.js + DAQ.html: show data live&lt;br /&gt;
- Replay.js + Replay.html: show data averaged at desired frequency.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead of killing process just execute it based on a word read from a text file. The js calls the button_message.php, that writes the message to a file called buttonStatus.txt&lt;br /&gt;
&lt;br /&gt;
File will either be stopping or running, based on what DAQ is doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
when live data is being acquired, the change in average.csv is so quick that calibration can’t cope with the speed and skips some measurements &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
- Automated File name: we want to start automatically with Run001, and increase it with every run. The increase will happen when the filename box is clicked, but still allow for name modifications if desired.&lt;br /&gt;
&lt;br /&gt;
– Status Messages: adding a textbox where status messages will be display.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.04==&lt;br /&gt;
NUC PC +&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5690</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5690"/>
		<updated>2024-12-06T13:29:25Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To do list for GUI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php ✓&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI &lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.✓&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.✓&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.✓&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.1 and 3.2==&lt;br /&gt;
These two versions had some issues because of the FTDI code, so they are skipped.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
FTDI code: combination of Sonia&#039;s + Matt’s -&amp;gt; FTDI_GUI.cpp&lt;br /&gt;
&lt;br /&gt;
Calibrate code: calibrate_fit.cpp&lt;br /&gt;
&lt;br /&gt;
Fit code: sudo ./fit_average false 100 UCLH UCLH/20240418 Run022.txt 25&lt;br /&gt;
&lt;br /&gt;
- DAQ.js + DAQ.html: show data live&lt;br /&gt;
- Replay.js + Replay.html: show data averaged at desired frequency.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead of killing process just execute it based on a word read from a text file. The js calls the button_message.php, that writes the message to a file called buttonStatus.txt&lt;br /&gt;
&lt;br /&gt;
File will either be stopping or running, based on what DAQ is doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
when live data is being acquired, the change in average.csv is so quick that calibration can’t cope with the speed and skips some measurements &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
- Automated File name: we want to start automatically with Run001, and increase it with every run. The increase will happen when the filename box is clicked, but still allow for name modifications if desired.&lt;br /&gt;
&lt;br /&gt;
– Status Messages: adding a textbox where status messages will be display.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.04==&lt;br /&gt;
NUC PC +&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5689</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5689"/>
		<updated>2024-12-06T11:03:23Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI version 2.05 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.1 and 3.2==&lt;br /&gt;
These two versions had some issues because of the FTDI code, so they are skipped.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
FTDI code: combination of Sonia&#039;s + Matt’s -&amp;gt; FTDI_GUI.cpp&lt;br /&gt;
&lt;br /&gt;
Calibrate code: calibrate_fit.cpp&lt;br /&gt;
&lt;br /&gt;
Fit code: sudo ./fit_average false 100 UCLH UCLH/20240418 Run022.txt 25&lt;br /&gt;
&lt;br /&gt;
- DAQ.js + DAQ.html: show data live&lt;br /&gt;
- Replay.js + Replay.html: show data averaged at desired frequency.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead of killing process just execute it based on a word read from a text file. The js calls the button_message.php, that writes the message to a file called buttonStatus.txt&lt;br /&gt;
&lt;br /&gt;
File will either be stopping or running, based on what DAQ is doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
when live data is being acquired, the change in average.csv is so quick that calibration can’t cope with the speed and skips some measurements &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
- Automated File name: we want to start automatically with Run001, and increase it with every run. The increase will happen when the filename box is clicked, but still allow for name modifications if desired.&lt;br /&gt;
&lt;br /&gt;
– Status Messages: adding a textbox where status messages will be display.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.04==&lt;br /&gt;
NUC PC +&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5688</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5688"/>
		<updated>2024-12-03T11:19:42Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Components inside the box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the peli case===&lt;br /&gt;
&lt;br /&gt;
:1. 4x detector modules:&lt;br /&gt;
::1.1 128 polished scintillator sheets of 100x100x3mm (32 x module)&lt;br /&gt;
::1.2 132 mylar foil sheets of 100x100x0.006mm (1 at the beginning of each module + 1 after each scintillator)&lt;br /&gt;
::1.3 4x scintillator holders&lt;br /&gt;
&lt;br /&gt;
:2. Electronics:&lt;br /&gt;
::2.1 256 photodiodes (32 sheets x 4 modules x 2 sides)&lt;br /&gt;
::2.2 8 DDC232 revE boards &lt;br /&gt;
::2.3 1 x Zmod daughter board&lt;br /&gt;
::2.4 1 x FPGA USB104 &lt;br /&gt;
&lt;br /&gt;
:3. DAQ and cabling:&lt;br /&gt;
::3.1 Raspberry pi5 for DAQ&lt;br /&gt;
::3.2 8 usb C cables: 7 to daisy chain the scintillator modules + 1 for connection with Zmod&lt;br /&gt;
::3.3 (Not confirmed yet) 7.5V power supplier for Zmod board (we need to test if it can be powered directly by the FPGA from the Zmod connection or not)&lt;br /&gt;
::3.4 5V power supply cable for FPGA&lt;br /&gt;
::3.5 USB for FPGA-Raspberry pi connection&lt;br /&gt;
::3.6 Power cable for raspberry pi5&lt;br /&gt;
::3.7 Ethernet cable for pi5&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5687</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5687"/>
		<updated>2024-12-03T11:16:57Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Components inside the box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the box ===&lt;br /&gt;
&lt;br /&gt;
:1. 4x detector modules:&lt;br /&gt;
::1.1 128 polished scintillator sheets of 100x100x3mm (32 x module)&lt;br /&gt;
::1.2 132 mylar foil sheets of 100x100x0.006mm (1 at the beginning of each module + 1 after each scintillator)&lt;br /&gt;
::1.3 4x scintillator holders&lt;br /&gt;
&lt;br /&gt;
:2. Electronics:&lt;br /&gt;
::2.1 256 photodiodes (32 sheets x 4 modules x 2 sides)&lt;br /&gt;
::2.2 8 DDC232 revE boards &lt;br /&gt;
::2.3 1 x Zmod daughter board&lt;br /&gt;
::2.4 1 x FPGA USB104 &lt;br /&gt;
&lt;br /&gt;
:3. DAQ and cabling:&lt;br /&gt;
::3.1 Raspberry pi5 for DAQ&lt;br /&gt;
::3.2 8 usb C cables: 7 to daisy chain the scintillator modules + 1 for connection with Zmod&lt;br /&gt;
::3.3 (Not confirmed yet) 7.5V power supplier for Zmod board (we need to test if it can be powered directly by the FPGA from the Zmod connection or not)&lt;br /&gt;
::3.4 5V power supply cable for FPGA&lt;br /&gt;
::3.5 USB for FPGA-Raspberry pi connection&lt;br /&gt;
::3.6 Power cable for raspberry pi5&lt;br /&gt;
::3.7 Ethernet cable for pi5&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5686</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5686"/>
		<updated>2024-12-03T11:15:41Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Components inside the box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the box ===&lt;br /&gt;
&lt;br /&gt;
:1. 4x detector modules:&lt;br /&gt;
::1.1 128 polished scintillator sheets of 100x100x3mm (32 x module)&lt;br /&gt;
::1.2 132 mylar foil sheets of 100x100x0.006mm (1 at the beginning of each module + 1 after each scintillator)&lt;br /&gt;
::1.3 4x scintillator holders&lt;br /&gt;
&lt;br /&gt;
:2. Electronics:&lt;br /&gt;
::2.1 256 photodiodes (32 sheets x 4 modules x 2 sides)&lt;br /&gt;
::2.2 8 DDC232 revE boards &lt;br /&gt;
::2.3 1 x Zmod daughter board&lt;br /&gt;
::2.4 1 x FPGA USB104 &lt;br /&gt;
&lt;br /&gt;
:3. DAQ and cabling:&lt;br /&gt;
::3.1 Raspberry pi5 for DAQ&lt;br /&gt;
::3.2 8 usb C cables: 7 to daisy chain the scintillator modules + 1 for connection with Zmod&lt;br /&gt;
::3.3 ?? Potential 7.5V external power supplier for Zmod board (we need to test if it can be powered directly by the FPGA from the Zmod connection or not)&lt;br /&gt;
::3.4 5V power supply cable for FPGA&lt;br /&gt;
::3.5 USB for FPGA-Raspberry pi connection&lt;br /&gt;
::3.6 Power cable for raspberry pi5&lt;br /&gt;
::3.7 Ethernet cable for pi5&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5685</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5685"/>
		<updated>2024-12-03T11:08:23Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Components inside the box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the box ===&lt;br /&gt;
#1. 4x detector modules:&lt;br /&gt;
&lt;br /&gt;
#* 1.1 128 polished scintillator sheets of 100x100x3mm (32 x module)&lt;br /&gt;
&lt;br /&gt;
1.2 132 mylar foil sheets of 100x100x0.006mm (1 at the beginning of each module + 1 after each scintillator)&lt;br /&gt;
&lt;br /&gt;
1.3 4x scintillator holders&lt;br /&gt;
&lt;br /&gt;
2. Electronics:&lt;br /&gt;
2.1 256 photodiodes (32 sheets x 4 modules x 2 sides)&lt;br /&gt;
2.2 8 DDC232 revE boards &lt;br /&gt;
2.3 1 x Zmod daughter board&lt;br /&gt;
2.4 1 x FPGA USB104 &lt;br /&gt;
&lt;br /&gt;
3. DAQ and cabling:&lt;br /&gt;
3.1 Raspberry pi5 for DAQ&lt;br /&gt;
3.2 8 usb C cables: 7 to daisy chain the scintillator modules + 1 for connection with Zmod&lt;br /&gt;
3.3 ?? Potential 7.5V external power supplier for Zmod board (we need to test if it can be powered directly by the FPGA from the Zmod connection or not)&lt;br /&gt;
3.4 5V power supply cable for FPGA&lt;br /&gt;
3.5 USB for FPGA-Raspberry pi connection&lt;br /&gt;
3.6 Power cable for raspberry pi5&lt;br /&gt;
3.7 Ethernet cable for pi5&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5684</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5684"/>
		<updated>2024-12-03T11:08:13Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Components inside the box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the box ===&lt;br /&gt;
1. 4x detector modules:&lt;br /&gt;
&lt;br /&gt;
#* 1.1 128 polished scintillator sheets of 100x100x3mm (32 x module)&lt;br /&gt;
&lt;br /&gt;
1.2 132 mylar foil sheets of 100x100x0.006mm (1 at the beginning of each module + 1 after each scintillator)&lt;br /&gt;
&lt;br /&gt;
1.3 4x scintillator holders&lt;br /&gt;
&lt;br /&gt;
2. Electronics:&lt;br /&gt;
2.1 256 photodiodes (32 sheets x 4 modules x 2 sides)&lt;br /&gt;
2.2 8 DDC232 revE boards &lt;br /&gt;
2.3 1 x Zmod daughter board&lt;br /&gt;
2.4 1 x FPGA USB104 &lt;br /&gt;
&lt;br /&gt;
3. DAQ and cabling:&lt;br /&gt;
3.1 Raspberry pi5 for DAQ&lt;br /&gt;
3.2 8 usb C cables: 7 to daisy chain the scintillator modules + 1 for connection with Zmod&lt;br /&gt;
3.3 ?? Potential 7.5V external power supplier for Zmod board (we need to test if it can be powered directly by the FPGA from the Zmod connection or not)&lt;br /&gt;
3.4 5V power supply cable for FPGA&lt;br /&gt;
3.5 USB for FPGA-Raspberry pi connection&lt;br /&gt;
3.6 Power cable for raspberry pi5&lt;br /&gt;
3.7 Ethernet cable for pi5&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5683</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5683"/>
		<updated>2024-12-03T11:07:52Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Components inside the box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the box ===&lt;br /&gt;
1. 4x detector modules:&lt;br /&gt;
&lt;br /&gt;
1.1 128 polished scintillator sheets of 100x100x3mm (32 x module)&lt;br /&gt;
&lt;br /&gt;
1.2 132 mylar foil sheets of 100x100x0.006mm (1 at the beginning of each module + 1 after each scintillator)&lt;br /&gt;
&lt;br /&gt;
1.3 4x scintillator holders&lt;br /&gt;
&lt;br /&gt;
2. Electronics:&lt;br /&gt;
2.1 256 photodiodes (32 sheets x 4 modules x 2 sides)&lt;br /&gt;
2.2 8 DDC232 revE boards &lt;br /&gt;
2.3 1 x Zmod daughter board&lt;br /&gt;
2.4 1 x FPGA USB104 &lt;br /&gt;
&lt;br /&gt;
3. DAQ and cabling:&lt;br /&gt;
3.1 Raspberry pi5 for DAQ&lt;br /&gt;
3.2 8 usb C cables: 7 to daisy chain the scintillator modules + 1 for connection with Zmod&lt;br /&gt;
3.3 ?? Potential 7.5V external power supplier for Zmod board (we need to test if it can be powered directly by the FPGA from the Zmod connection or not)&lt;br /&gt;
3.4 5V power supply cable for FPGA&lt;br /&gt;
3.5 USB for FPGA-Raspberry pi connection&lt;br /&gt;
3.6 Power cable for raspberry pi5&lt;br /&gt;
3.7 Ethernet cable for pi5&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5682</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5682"/>
		<updated>2024-12-03T11:07:42Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the box ===&lt;br /&gt;
1. 4x detector modules:&lt;br /&gt;
1.1 128 polished scintillator sheets of 100x100x3mm (32 x module)&lt;br /&gt;
1.2 132 mylar foil sheets of 100x100x0.006mm (1 at the beginning of each module + 1 after each scintillator)&lt;br /&gt;
1.3 4x scintillator holders&lt;br /&gt;
&lt;br /&gt;
2. Electronics:&lt;br /&gt;
2.1 256 photodiodes (32 sheets x 4 modules x 2 sides)&lt;br /&gt;
2.2 8 DDC232 revE boards &lt;br /&gt;
2.3 1 x Zmod daughter board&lt;br /&gt;
2.4 1 x FPGA USB104 &lt;br /&gt;
&lt;br /&gt;
3. DAQ and cabling:&lt;br /&gt;
3.1 Raspberry pi5 for DAQ&lt;br /&gt;
3.2 8 usb C cables: 7 to daisy chain the scintillator modules + 1 for connection with Zmod&lt;br /&gt;
3.3 ?? Potential 7.5V external power supplier for Zmod board (we need to test if it can be powered directly by the FPGA from the Zmod connection or not)&lt;br /&gt;
3.4 5V power supply cable for FPGA&lt;br /&gt;
3.5 USB for FPGA-Raspberry pi connection&lt;br /&gt;
3.6 Power cable for raspberry pi5&lt;br /&gt;
3.7 Ethernet cable for pi5&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5681</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5681"/>
		<updated>2024-12-03T10:52:52Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* Proton Therapy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Components inside the box ===&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5680</id>
		<title>ELogs/MechanicalEngineering</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=ELogs/MechanicalEngineering&amp;diff=5680"/>
		<updated>2024-12-03T10:52:30Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* To Do */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Electronic Log for Mechanical Engineering&lt;br /&gt;
&lt;br /&gt;
== 2025 Experiment ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
== To Do ==&lt;br /&gt;
&lt;br /&gt;
=== Proton Therapy ===&lt;br /&gt;
&lt;br /&gt;
==== Preparation for UCLH beam tests 29-30th April ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;New scintillator stack holders:&#039;&#039;&#039;&lt;br /&gt;
#* Stack holders 3D printed: remake by hand if time allows.&lt;br /&gt;
#* Mounting plate to screw to Thorlabs optical breadboards in Peli cases: &lt;br /&gt;
#** Rough version already 3D printed. &lt;br /&gt;
#** Needs modifying to fix stack holder in place with M14(?) nuts.&lt;br /&gt;
#** Must be able to mount upside down.&lt;br /&gt;
#* New frame needed for patch panel with 50mm stand off to allow deeper connectors not to interfere with scintillator stacks.&lt;br /&gt;
# &#039;&#039;&#039;Holder for NPL Transmission Calorimeter:&#039;&#039;&#039;&lt;br /&gt;
#* TC needs to mount into Peli Case in front of stack holders.&lt;br /&gt;
#* CAD STEP-files already received from Sam Flynn (NPL) for existing holder.&lt;br /&gt;
#* If making new holder, exit pipe for electronics cabling needs to be shortened to fit in small Peli case.&lt;br /&gt;
#* If making holder for holder, must mount to Thorlabs optical breadboard (M6 holes on 25mm pitch?).&lt;br /&gt;
#* Centre of holder must be &#039;&#039;&#039;71 mm&#039;&#039;&#039; from baseplate (scintillator stacks are 50mm radius, plus 21mm offset from base).&lt;br /&gt;
# &#039;&#039;&#039;Holder for Birmingham Pixel Sensor:&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Tony Price&#039;&#039;&#039; (Birmingham) has provided dimensions to &#039;&#039;&#039;HB&#039;&#039;&#039;.&lt;br /&gt;
#* Holder needed to support pixel sensor between TC and scintillators.&lt;br /&gt;
#* Peli case needs 100x10mm slot cut to left of side handle to allow sensor ribbon cable to pass through.&lt;br /&gt;
# &#039;&#039;&#039;Nozzle mount for detector enclosure:&#039;&#039;&#039;&lt;br /&gt;
#* Small Peli case needs to be nozzle-mounted for beam tests.&lt;br /&gt;
#* Dimensions already obtained from UCLH measurements: &lt;br /&gt;
#** &#039;&#039;&#039;SJ&#039;&#039;&#039; has contacted UCLH to check whether we can bypass light curtain.&lt;br /&gt;
#** Assume we can&#039;t and design to bypass mechanically...&lt;br /&gt;
#* 3 parts needed:&lt;br /&gt;
#** Nozzle mounting plate that sits inside nozzle using range modulator plate mounting slots.&lt;br /&gt;
#** U-bracket that slots in to this mounting plate &amp;amp;mdash; bypassing the light curtain &amp;amp;mdash; with a 40 x 30 cm hole for the beam to pass through.&lt;br /&gt;
#** Peli Case support that fixes to the U-bracket and holds the Peli Case whilst gantry is rotating.&lt;br /&gt;
&lt;br /&gt;
==== May onwards ====&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Bari scintillating fibre holder:&#039;&#039;&#039;&lt;br /&gt;
#* Bari are designing the scintillating fibre assembly for the &#039;&#039;&#039;QuADProBe&#039;&#039;&#039;.&lt;br /&gt;
#* Prototype fibre array holder machined from aluminium.&lt;br /&gt;
#* Clinical prototype ideally needs a version in plastic.&lt;br /&gt;
#* Review Bari CAD drawings and recommend suitable materials.&lt;br /&gt;
# &#039;&#039;&#039;Scintillator machining:&#039;&#039;&#039;&lt;br /&gt;
#* Promising results from Datron: chase up potential workshops who could machine scintillator for us.&lt;br /&gt;
#* Liaise with &#039;&#039;&#039;Martin Blackman&#039;&#039;&#039; in main workshop to assess quality of his scintillator machining.&lt;br /&gt;
#* Write case and obtain quote for us to purchase Datron Neo.&lt;br /&gt;
&lt;br /&gt;
==== Full detector scintillator holder ====&lt;br /&gt;
&lt;br /&gt;
* We need to go from the prototype version bolted to the optical plate to something completely standalone. &lt;br /&gt;
* We can probably put it in another Peli case — I have loads — initially with an optical breadboard but eventually without.&lt;br /&gt;
* It needs a support structure that is not rigidly bolted to the case but will align to any windows we cut: that means clinical staff can whack the detector and it won’t break or go out of alignment. So something internally sprung.&lt;br /&gt;
&lt;br /&gt;
== Completed ==&lt;br /&gt;
&lt;br /&gt;
=== 2023 ===&lt;br /&gt;
&lt;br /&gt;
; January-May : Enclosure design for small-scale Clatterbridge detector prototype (with Simon). &lt;br /&gt;
:* Includes feedthroughs, mounts for NUC PC, Raspberry Pi and USB104 FPGA.&lt;br /&gt;
:* Nozzle mounted&lt;br /&gt;
&lt;br /&gt;
=== 2022 ===&lt;br /&gt;
&lt;br /&gt;
; November-December : Design and 3D print external frame with alignment marks and alignment plates for small Peli case.&lt;br /&gt;
: Duplicate alignment bar from Zarges case with circular studs to allow alignment with treatment couch.&lt;br /&gt;
&lt;br /&gt;
; October : Modified medium-sized Peli case ready for beam tests:&lt;br /&gt;
:* Install Thorlabs optical breadboard in base of case.&lt;br /&gt;
:* Cut out window at each end of case for mylar window installation. &lt;br /&gt;
:* Cut out 2 windows for 2-gang patch panels, 1 per side.&lt;br /&gt;
:* Cut out 2 windows for 1-gang patch panels, 1 per end.&lt;br /&gt;
:* 3D print internal frames for mylar windows with bolt holes in each corner. Drill bolt holes in Peli case.&lt;br /&gt;
:* 3D print external frame with alignment marks matching centre line of optical breadboard (vertical) and 71mm above optical breadboard (horizontal). Match bolt holes to mylar window frames.&lt;br /&gt;
:* 3D print alignment plates that are strong enough to double as external cover plates when shipping enclosure.&lt;br /&gt;
&lt;br /&gt;
; September : Machine a patch panel complete with 10 smaller panels that can be swapped between on the main patch panel to allow for various electrical feedthroughs&lt;br /&gt;
&lt;br /&gt;
; August : Created CAD cross hair for Peli Case to be printed. Also created small printed windows to clamp Mylar smooth over the beam entry point.&lt;br /&gt;
&lt;br /&gt;
; July : Created CAD models for internal components including: &lt;br /&gt;
:* Scintillator holder. &lt;br /&gt;
:* 2x Side Vice faces. &lt;br /&gt;
:* 1x Front Vice face. &lt;br /&gt;
:* Cover for beam entry point.&lt;br /&gt;
: These were printed soon after.&lt;br /&gt;
: Beam entry point was cut out of the case, piece was sent for testing with Adam Gibson.&lt;br /&gt;
: Machined two special 1/4-20 UNC screws for camera mount.&lt;br /&gt;
: Tapped all holes on Scintillator holder to take m5 nylon screws to allow vice faces to travel.&lt;br /&gt;
&lt;br /&gt;
; June : Initiated design of large Peli Case. Received Lab scissor jack used to mount camera.&lt;br /&gt;
&lt;br /&gt;
; May : CAD Prototype a sliding system to mount multiple scintillator holders into a case&lt;br /&gt;
&lt;br /&gt;
; February : Create CAD model for small Peli Case so ideas on how to install the holder into the case can be prototyped&lt;br /&gt;
&lt;br /&gt;
=== 2021 ===&lt;br /&gt;
&lt;br /&gt;
; November : Design initial prototype of a new holder that will clamp scintillator sheets together. Will supersede previous adhesive idea&lt;br /&gt;
; June : Prepare scintillator sheets to be adhered together using standard primer&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5678</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5678"/>
		<updated>2024-11-26T14:59:22Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.01b */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.1 and 3.2==&lt;br /&gt;
These two versions had some issues because of the FTDI code, so they are skipped.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
FTDI code: combination of Sonia&#039;s + Matt’s -&amp;gt; FTDI_GUI.cpp&lt;br /&gt;
&lt;br /&gt;
Calibrate code: calibrate_fit.cpp&lt;br /&gt;
&lt;br /&gt;
Fit code: sudo ./fit_average false 100 UCLH UCLH/20240418 Run022.txt 25&lt;br /&gt;
&lt;br /&gt;
- DAQ.js + DAQ.html: show data live&lt;br /&gt;
- Replay.js + Replay.html: show data averaged at desired frequency.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead of killing process just execute it based on a word read from a text file. The js calls the button_message.php, that writes the message to a file called buttonStatus.txt&lt;br /&gt;
&lt;br /&gt;
File will either be stopping or running, based on what DAQ is doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
when live data is being acquired, the change in average.csv is so quick that calibration can’t cope with the speed and skips some measurements &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
- Automated File name: we want to start automatically with Run001, and increase it with every run. The increase will happen when the filename box is clicked, but still allow for name modifications if desired.&lt;br /&gt;
&lt;br /&gt;
– Status Messages: adding a textbox where status messages will be display.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5677</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5677"/>
		<updated>2024-11-26T14:53:41Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.01b */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
FTDI code: combination of Sonia&#039;s + Matt’s -&amp;gt; FTDI_GUI.cpp&lt;br /&gt;
&lt;br /&gt;
Calibrate code: calibrate_fit.cpp&lt;br /&gt;
&lt;br /&gt;
Fit code: sudo ./fit_average false 100 UCLH UCLH/20240418 Run022.txt 25&lt;br /&gt;
&lt;br /&gt;
- DAQ.js + DAQ.html: show data live&lt;br /&gt;
- Replay.js + Replay.html: show data averaged at desired frequency.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead of killing process just execute it based on a word read from a text file. The js calls the button_message.php, that writes the message to a file called buttonStatus.txt&lt;br /&gt;
&lt;br /&gt;
File will either be stopping or running, based on what DAQ is doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
when live data is being acquired, the change in average.csv is so quick that calibration can’t cope with the speed and skips some measurements &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
- Automated File name: we want to start automatically with Run001, and increase it with every run. The increase will happen when the filename box is clicked, but still allow for name modifications if desired.&lt;br /&gt;
&lt;br /&gt;
– Status Messages: adding a textbox where status messages will be display.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5676</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5676"/>
		<updated>2024-11-26T14:29:02Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.01 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead of killing process just execute it based on a word read from a text file. The js calls the button_message.php, that writes the message to a file called buttonStatus.txt&lt;br /&gt;
&lt;br /&gt;
File will either be stopping or running, based on what DAQ is doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
when live data is being acquired, the change in average.csv is so quick that calibration can’t cope with the speed and skips some measurements &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
- Automated File name: we want to start automatically with Run001, and increase it with every run. The increase will happen when the filename box is clicked, but still allow for name modifications if desired.&lt;br /&gt;
&lt;br /&gt;
– Status Messages: adding a textbox where status messages will be display.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5675</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5675"/>
		<updated>2024-11-26T14:03:47Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.01 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Instead of killing process just execute it based on a word read from a text file. The js calls the button_message.php, that writes the message to a file called buttonStatus.txt&lt;br /&gt;
&lt;br /&gt;
File will either be stopping or running, based on what DAQ is doing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
when live data is being acquired, the change in average.csv is so quick that calibration can’t cope with the speed and skips some measurements &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5674</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5674"/>
		<updated>2024-11-26T13:59:19Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.01 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
&lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5673</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5673"/>
		<updated>2024-11-26T13:59:00Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.01 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DAQ.js calls executeDAQ.php calls executeFTDI.sh and FTDI2&lt;br /&gt;
&lt;br /&gt;
Need to change the autoclick button: instead of clicking after a certain time it has passed, we now print measurement number + word running to a new file with each measurement, and with last one we print the stopping. If the word stopping is found in the file, the stop button will be automatically clicked. When detector not connected: show an error message to the user (very basic styling for now) + click button to stop acquisition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Measure/Stop button is capable of:&lt;br /&gt;
- Starting acquisition&lt;br /&gt;
- Stopping when acquisition has finished&lt;br /&gt;
- Stop graph when acquiring data&lt;br /&gt;
&lt;br /&gt;
It needs to:&lt;br /&gt;
4. Read if detector is not connected and show an error message.&lt;br /&gt;
5. Kill the execution of shell script when stop is clicked. &lt;br /&gt;
&lt;br /&gt;
User input values:&lt;br /&gt;
$selected_value1 = RunName = Run0xy&lt;br /&gt;
$selected_value2 = FSR = 12.5, 350… &lt;br /&gt;
$selected_value3 = tINT&lt;br /&gt;
$selected_value4 = num_measurements&lt;br /&gt;
$selected_value5 = reverse&lt;br /&gt;
$selected_value6 = frequency&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5672</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5672"/>
		<updated>2024-11-26T13:54:13Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
This version was last modified by Sonia on the 26th of November, 2024.&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5671</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5671"/>
		<updated>2024-11-26T13:53:51Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages: one for data acquisition (DAQ), one for calibrating data at a desired frequency (Calibrated) and one for the display of previosuly fitted data (Replay).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5670</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5670"/>
		<updated>2024-11-26T13:52:12Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* REPLAY */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Replay code is a visualisation tool only. It reads the fitted data, selected from a dropdown menu, and plots every measurement with its fits and values.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5669</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5669"/>
		<updated>2024-11-26T13:35:12Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* CALIBRATED */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
The graph shows the file output_GUI_Calibrated.txt, that is updated in real time at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Visualisation tool only.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5668</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5668"/>
		<updated>2024-11-26T13:34:30Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* CALIBRATED */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency, selected from a dropdown menu. It calls calibrateGUI.php, that then calls executeGUI.sh. The shell script calls the cpp code calibrate_rate, that reads the raw data file, calibrates the data and the averages it at the desired frequency.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_rate true &amp;quot;$dataDir&amp;quot; &amp;quot;$shortFileName&amp;quot; revB &amp;quot;$frequency&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Visualisation tool only.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5667</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5667"/>
		<updated>2024-11-26T11:49:31Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
=== CALIBRATED ===&lt;br /&gt;
Performs calibration at a desired frequency&lt;br /&gt;
&lt;br /&gt;
=== REPLAY ===&lt;br /&gt;
Visualisation tool only.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5666</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5666"/>
		<updated>2024-11-26T11:47:55Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt The actual code work as it follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5665</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5665"/>
		<updated>2024-11-26T11:47:35Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. &lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
 The actual workflow is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5664</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5664"/>
		<updated>2024-11-26T11:38:12Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. The actual workflow is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php sends the word running or stopping to buttonStatus.txt, based on the number of clicks the start/stop button has received.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5663</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5663"/>
		<updated>2024-11-26T11:34:44Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. The actual workflow is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages. IF the file includes the word stopping, acquisition has finished and the start/stop button will be clicked automatically.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5662</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5662"/>
		<updated>2024-11-26T11:33:36Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. The actual workflow is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh. The shell script acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5661</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5661"/>
		<updated>2024-11-26T11:28:47Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. The actual workflow is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh.&lt;br /&gt;
&lt;br /&gt;
executeFTDI.sh acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages.&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5660</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5660"/>
		<updated>2024-11-26T11:28:33Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
To run the GUI we need DAQ.js and DAQ.html. The graph in this webpage displays output_GUI.txt. The actual workflow is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh.&lt;br /&gt;
&lt;br /&gt;
executeFTDI.sh acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages.&lt;br /&gt;
&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5659</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5659"/>
		<updated>2024-11-26T11:27:18Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
DAQ.js: . Plots live output_GUI.txt&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh.&lt;br /&gt;
&lt;br /&gt;
executeFTDI.sh acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages.&lt;br /&gt;
&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
 sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
 sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5658</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5658"/>
		<updated>2024-11-26T11:27:06Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
DAQ.js: . Plots live output_GUI.txt&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh.&lt;br /&gt;
&lt;br /&gt;
executeFTDI.sh acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages.&lt;br /&gt;
&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp and  ./calibrate_singlefit.cpp. The first code, calibrate_fit_GUI.cpp, reads from GUI/average.csv and subtracts background and applies ST calibration. It generates a live file, output_GUI.txt, that is updated with the calibrated data live for GUI visualisation. IT also generates a file with all the calibrated data, but due to the acquisition speed some lines are skipped, that&#039;s why we need the second code.&lt;br /&gt;
&lt;br /&gt;
calibrate_singlefit.cpp: reads the raw data file, calibrates it and creates a new file with appropiate header information. At the end of the file, the average of all the measurements as well as a fit applied to this average will be generated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sudo ./calibrate_fit_GUI &amp;quot;$selected_value1.txt&amp;quot; 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value4&amp;quot; revB &amp;quot;$selected_value5&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;quot;$selected_value3&amp;quot; calibration background.txt shootBack.txt shootFront.txt 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
sudo ./calibrate_singlefit &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; revB &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value5&amp;quot; background.txt shootBack.txt shootFront.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Fitting: once the calibrated file has been generated, with header info, one line per measurement and the averaged value we can proceed to do more fittings. This code averages the data at 25Hz and performs an individual fit for every set of data averaged at 25Hz. The output file generated is Calibrated/YYmmdd_Run0xy_fitted.txt.&lt;br /&gt;
&lt;br /&gt;
sudo ./fit_average &amp;quot;$selected_value5&amp;quot; 100 UCLH &amp;quot;$date&amp;quot; &amp;quot;$selected_value1.txt&amp;quot; &amp;quot;$selected_value6&amp;quot; &amp;amp; #Value 100 is energy, currently not in use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5657</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5657"/>
		<updated>2024-11-26T11:21:49Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
DAQ.js: . Plots live output_GUI.txt&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh.&lt;br /&gt;
&lt;br /&gt;
executeFTDI.sh acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages.&lt;br /&gt;
&lt;br /&gt;
 sudo ./FTDI_GUI usb104 1 &amp;quot;$selected_value2&amp;quot; &amp;quot;$selected_value3&amp;quot; &amp;quot;$selected_value4&amp;quot; 50 &amp;quot;$selected_value1.txt&amp;quot; revB 2 &amp;amp;&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5656</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5656"/>
		<updated>2024-11-26T11:21:04Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* DAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section handles the data acquisition of the QuARC. The arguments needed for the different codes to run correctly can be directly input by the user in the different textboxes and dropdown menus.&lt;br /&gt;
Single start/stop button that handles the raw acquisition, the live calibration and the postprocessing of the data (fitting it at 25 Hz).&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
DAQ.js: . Plots live output_GUI.txt&lt;br /&gt;
&lt;br /&gt;
The start/stop button calls executeDAQ.php, that then sends the input valus to the shell script executeFTDI.sh.&lt;br /&gt;
&lt;br /&gt;
executeFTDI.sh acquires data live, calibrates it and then fits the data in three separate steps.&lt;br /&gt;
&lt;br /&gt;
1. Data Acquisition: FTDI_GUI.cpp, the code responsible for communicating the FPGA over FTDI that creates the raw file and the date folder. This code also creates the subfolders Raw, Calibrated and Fitted. &lt;br /&gt;
Three important files, that the GUI will need, are created with this code: first one is GUI/average.csv, that simply writes live raw data in decimal format that will be used for calibration. The second file is runningStatus.txt, this shows the message created by FTDI code: whether the detector is or not connected, the number of measurements that are acquired and/or any other error messages.&lt;br /&gt;
&lt;br /&gt;
2. Calibration: calibrate_fit_GUI.cpp&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
button_message.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uttonStatus.txt??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
File structure: there is an entry textbox, that when clicked assigns the name Run0xy. Three files are produced: YYmmdd_Run0xy_raw.txt, YYmmdd_Run0xy_calibrated.txt and YYmmdd_Run0xy_fitted.txt&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5632</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5632"/>
		<updated>2024-11-22T15:08:36Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.03 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.3==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DAQ ===&lt;br /&gt;
&lt;br /&gt;
This section rkwfkwer&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5631</id>
		<title>Proton Calorimetry/User Interface</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/pbtWiki/index.php?title=Proton_Calorimetry/User_Interface&amp;diff=5631"/>
		<updated>2024-11-22T15:05:55Z</updated>

		<summary type="html">&lt;p&gt;SoniaEscribano: /* GUI v3.01 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==To do list for GUI==&lt;br /&gt;
* v3.1:&lt;br /&gt;
&lt;br /&gt;
-MaxY = 1.5*Photodiode ✓&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users ✓&lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval ✓&lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
==GUI v3.03==&lt;br /&gt;
This version of the GUI has three separate webpages:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01b==&lt;br /&gt;
Used for UCLH experiment 2024&lt;br /&gt;
&lt;br /&gt;
==GUI v3.01==&lt;br /&gt;
This version has been developed on raspberry pi5. The goal of this version is to fix the pending issues of v2.3, specially the behaviour of the Start/Stop button as this has to know when the DAQ is running and how to kill it.&lt;br /&gt;
&lt;br /&gt;
As this version is the most stable one with php and sh scripts, below is a detailed explanation of how it works.&lt;br /&gt;
&lt;br /&gt;
==GUI v2.3==&lt;br /&gt;
This version has been developed on raspberry pi5. &lt;br /&gt;
The code has been split in two main functions: one that creates the graph and one that updates it, to keep up to speed with the acquisition. A summary of the changes can be found on the slides created on the 20th March 2024 (SER_240320_GUI-v2.3.pptx): https://www.hep.ucl.ac.uk/pbt/wikiData/presentations/2024/&lt;br /&gt;
&lt;br /&gt;
Main changes:&lt;br /&gt;
&lt;br /&gt;
- Single start/stop button for DAQ.&lt;br /&gt;
&lt;br /&gt;
- t_INT has a minimum value of 170us. If user inputs a value smaller than this, an error message is displayed and tINT automatically modified to 170us.&lt;br /&gt;
&lt;br /&gt;
- Run time entry box added. This correlates to the number of measurements considering the t_INT decided by the user.&lt;br /&gt;
&lt;br /&gt;
- Auto-adjustment of the y-axis and the x-axis based on the data that is being parsed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pending:&lt;br /&gt;
&lt;br /&gt;
- Status message of running situation for users &lt;br /&gt;
&lt;br /&gt;
- Start/Stop button to finish when clicked, not after tinterval &lt;br /&gt;
&lt;br /&gt;
- Kill shell script from php&lt;br /&gt;
&lt;br /&gt;
- Error Bars: check how values are obtained in FTDI&lt;br /&gt;
&lt;br /&gt;
- Cache issue, situation has improved but there are some crashes.&lt;br /&gt;
&lt;br /&gt;
- Reverse option: it does not work, always shows same direction.&lt;br /&gt;
&lt;br /&gt;
- Fitting of final measurement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(This version has accidentally overwritten v2.2 and therefore is saved on pi5 as GUI v2.2)&lt;br /&gt;
&lt;br /&gt;
==GUI v2.2==&lt;br /&gt;
&lt;br /&gt;
This version keeps the data display from previous runs that was implemented in version 2.1, and adds elements to perform the data acquisition directly from the GUI.&lt;br /&gt;
Initial test was to design a simple execute DAQ button that reads the dropdown menus and text boxes with the values defined by the user and uses a shell script to write them to a file called boardvalues.txt. &lt;br /&gt;
&lt;br /&gt;
This version of the GUI can be found on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.2/&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GUI v2.2 on pi5&#039;&#039;&#039;&lt;br /&gt;
The newly acquired raspberry pi5 presents a much better reading time than previous version pi4. The GUI is going to be developed directly in this device, as it can be attached to the detector with the intention of acquiring and displaying data live. To be able to execute the FTDI code from a shell script we need to add a passwordless rule in sudoers for the script (/etc/sudoers.d/FTDI_rule) and this allows execution.&lt;br /&gt;
&lt;br /&gt;
We want to acquire data and calibrate it when the button is clicked: new code, calibrateSonia.cpp does the calibration and generates the files that are read by the GUI.&lt;br /&gt;
&lt;br /&gt;
- The arguments required for .FTDI that do not change are hardcoded into the shell script.&lt;br /&gt;
- The arguments that vary (number of measurements) are read from the textboxes/dropdown menus.&lt;br /&gt;
&lt;br /&gt;
Acquisition from local host using a remote laptop has been successful. This version of the GUI has many changes in comparison to cluster v2.2, so a new version number (2.3) is given and will be described in more detail in a separate section.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.1.b==&lt;br /&gt;
This version has fixed all of the issues we had in previous versions. Design is the same but the code has been rewritten completely. The key improvements are:&lt;br /&gt;
&lt;br /&gt;
* Zooming feature: Shifting between PDdata and curves when zooming in: two different axis were used for PDdata and fitted data. This has been modified to have only one xScale, defined as a linear scale. This means that the x-axis now utilises numerical datasets instead of categorical, and therefore the zooming of both sets of data is performed equally at the same time.&lt;br /&gt;
var xScale = d3.scaleLinear()&lt;br /&gt;
&lt;br /&gt;
.domain([0, setWET])&lt;br /&gt;
&lt;br /&gt;
.range([margins.left, width - margins.right ]);&lt;br /&gt;
&lt;br /&gt;
* Bandwidth separation: Previous version assumed that the separation between PDdata was uniform, but this did not correspond to reality as the PD thicknesses varies. The bandwidth needs to be redefined based on the separation between each PD and the previous one.&lt;br /&gt;
&lt;br /&gt;
bandwidths.push(xPDposition[i+1] - xPDposition[i]);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This version has been developed for Clatterbridge data (12PD) - If using for larger data sets we need to modify the numer of setPhotodiodes and setWET in GUI.js  &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.06==&lt;br /&gt;
Located on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Improved version based on v 2.05. The start and stop buttons have been changed by a single button that performs both actions, keeping in screen the results from the last data plotted instead of deleting the graph and beam parameters.&lt;br /&gt;
&lt;br /&gt;
Live update + fitting curves.&lt;br /&gt;
&lt;br /&gt;
==GUI version 2.05==&lt;br /&gt;
This version of the GUI can be seen on:  &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;General information&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Developed in JavaScript with d3 and papaparse libraries. This version consists of a single tab, where the user can adjust WET number (mm) and max Y (pC) and select which elements are plotted on the graph, via checkboxes.&lt;br /&gt;
&lt;br /&gt;
Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022&lt;br /&gt;
&lt;br /&gt;
Disclaimer!: The error bars from this version do not correspond to the real error value, as the magnitude has been increased by 5pC for visualisation purposes (defined in the code as &#039;&#039;extraerror&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live update&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This version provides a live visualisation of the data file. In order to generate a dynamic set of data this two scripts have been developed in Python: GUIrandom.py and runauto.py.&lt;br /&gt;
&lt;br /&gt;
- GUIrandom.py: calculates a random number and multiplies the PD data and the curves by this number. The random number is shown in the terminal.&lt;br /&gt;
&lt;br /&gt;
- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Files for GUI visualisation==&lt;br /&gt;
&lt;br /&gt;
The experimental data acquired needs to be calibrated with the acquired shoot-through measurements (back and front) and the background needs to be subtracted. Then, each of the measurements can be fitted to the models, extracting the range and the energy of the beam. There are two different codes to perform this.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calibrated data: &#039;&#039;&#039;&lt;br /&gt;
Development of a python code (replay.py) that generates a file with header info followed by the 30k measurements calibrated and with background subtracted. If our initial file is called Run0xy.txt the output of this will be Run0xy_calibrated.txt&lt;br /&gt;
&lt;br /&gt;
 python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Fitted data: &#039;&#039;&#039;&lt;br /&gt;
Once the data has been calibrated, we need to perform the fittings and extract the parameters. This code (fit.cpp) utilises Run_0xy.txt and outputs Run0xy_fitted_frequency.txt, where the frequency value is 25Hz by default but can be changed by adding an extra argument to the code line. This takes about 15 second per run for Clatterbridge data.&lt;br /&gt;
 g++ -o fit fit.cpp `root-config --cflags --glibs` -O3&lt;br /&gt;
&lt;br /&gt;
 ./fit reverse energy facility folder run (frequency)​&lt;br /&gt;
&lt;br /&gt;
​&lt;br /&gt;
Both, fitted and calibrated data for all the runs acquired at Clatterbridge experiment in 2023 are in &amp;lt;code&amp;gt; https://www.hep.ucl.ac.uk/pbt/wikiData/data/GUI-Clatterbridge/ &amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live Update: &#039;&#039;&#039; &lt;br /&gt;
The webpage is reading from file outputGUI.csv, located in the same directory than the GUI js and html files. To visualise it live, we create a shell script that goes through each measurement at a certain time interval, writing the output to the outputGUI.csv file. To execute this, simply we cd into ReplayFinal and then execute the script.&lt;br /&gt;
 ./shellGUI.sh&lt;br /&gt;
&lt;br /&gt;
==Uploading Data to HEP Server==&lt;br /&gt;
Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.&lt;br /&gt;
*On your local machine:&lt;br /&gt;
**Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: &amp;lt;code&amp;gt; cd /Path/To/Data &amp;lt;/code&amp;gt;&lt;br /&gt;
**Generate the photodiode data with: &amp;lt;code&amp;gt; root -l &amp;quot;writeCSV.cpp&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
**In a new terminal, move to the same directory and run the following command in order to copy this data, line by line, to the plus1 web area: &amp;lt;code&amp;gt; tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T &#039;cat - &amp;gt; /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv&#039; &amp;lt;/code&amp;gt;&lt;br /&gt;
*On plus2 :&lt;br /&gt;
**In a new terminal, move into the directory where the photodiode data is written: &amp;lt;code&amp;gt; cd /unix/www/html/pbt/PDdisplay/ &amp;lt;/code&amp;gt;&lt;br /&gt;
**Run the following script in that directory: &amp;lt;code&amp;gt; ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02 &amp;lt;/code&amp;gt;&lt;br /&gt;
***This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It&#039;s a good idea to set the write rate about 2x faster than the desired frame rate.&lt;br /&gt;
**To output this any more or less often, adjust the &amp;quot;waitTime&amp;quot; value at the end (needs to be in seconds).&lt;br /&gt;
**To stop displaying each line as it is written, remove the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
**Note that this script contains an infinite loop, so to stop it running you need to kill it by hand with Ctrl-C. You may need to do this a few times to get it to quit...&lt;/div&gt;</summary>
		<author><name>SoniaEscribano</name></author>
	</entry>
</feed>