Proton Calorimetry/User Interface: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
Line 7: Line 7:
* Trigger replay script with GUI: add dropdown menu and space to specify all the variables needed for the replay code/
* Trigger replay script with GUI: add dropdown menu and space to specify all the variables needed for the replay code/


==Files for GUI visualisation==


==GUI version 2.1.b==
==GUI version 2.1.b==

Revision as of 15:07, 15 September 2023

To do list for GUI

  • Implement start/stop button
  • Stop button functionality to pause
  • Check GUI access with NUC PC (install apache, root, FTDI libraries)
  • Fix cache issue for Chrome
  • Replay script: run replay script on GUI and see if that works
  • Trigger replay script with GUI: add dropdown menu and space to specify all the variables needed for the replay code/


Files for GUI visualisation

GUI version 2.1.b

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:

  • 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.
var xScale = d3.scaleLinear()
                .domain([0, setWET])
                .range([margins.left, width - margins.right ]);
  • 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.
bandwidths.push(xPDposition[i+1] - xPDposition[i]);

PD data

Development of a python code that generates a file with header info followed by the 30k measurements calibrated and with background subtracted.

python3 replay.py t_INT framerate skipahead reverse folder run background backST frontST


Fitted data

./fit reverse energy facility folder run (frequency)​

This takes about 15 seconds per run, and produces Run0xy_fitted_zHz.txt​

Live Update

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. The shell is called. To execute this, simply we cd into ReplayFinal and then exectute ./shellGUI.sh


We have to execute the 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

GUI version 2.06

Located on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.06/

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.

Live update + fitting curves.

GUI version 2.05

This version of the GUI can be seen on: https://www.hep.ucl.ac.uk/pbt/PDdisplay/escribano/v2.05/

General information

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.

Data used for testing GUI: 245 MeV, acquired at The Christie in October 2022

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 extraerror).


Live update

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.

- 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.

- runauto.py: runs GUIrandom.py at the desired time interval (initially 0.02s, to have a refresh rate of 50Hz)

Uploading Data to HEP Server

Data can be uploaded to the HEP cluster in order to run a webpage with live photodiode data.

  • On your local machine:
    • Move to the directory containing photodiode data being saved by CoolTerm and the C++ script to generate the CSV file: cd /Path/To/Data
    • Generate the photodiode data with: root -l "writeCSV.cpp"
    • 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: tail -F -n 1 output.csv | ssh username@plus2.hep.ucl.ac.uk -T 'cat - > /unix/www/html/pbt/PDdisplay/photodiodeValuesAll.csv'
  • On plus2 :
    • In a new terminal, move into the directory where the photodiode data is written: cd /unix/www/html/pbt/PDdisplay/
    • Run the following script in that directory: ./outputSingleLine.sh -v photodiodeValuesAll.csv photodiodeValues.csv 0.02
      • This will output a single line CSV file - photodiodeValues.csv - every 10ms (100Hz). It's a good idea to set the write rate about 2x faster than the desired frame rate.
    • To output this any more or less often, adjust the "waitTime" value at the end (needs to be in seconds).
    • To stop displaying each line as it is written, remove the -v flag.
    • 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...