## Operating principle
Single shot diagnostic to measure relative pulse energy and beam position.  Back-scattered X-rays from a thin target (typically 50 nm silicon nitride) are measured by four photodiodes positioned above, below, left and right of the X-ray beam.

Position data maintains FEL pointing, while single-shot pulse energy measurements are used to normalise experiment data.  There is one PBPS in the front-end and two further devices per end station.

## How to use

1. Open photon diagnostics [web app](https://sf-photodiag.psi.ch/app)
2. Under Position/calibration tabs,s elect device from drop down menu 1
3. Select target from drop down menu 2 - default target is 50nm Si3N4
4. Press calibrate
<img src="https://docs.google.com/drawings/d/e/2PACX-1vRGynTQ54ugugA_bM9pYc9eZDlet3Z9MSZWn17wJNwAEM2ORiJGoL8O61frpLBVRpFKlzJ7M05a5Mb1/pub?w=1245&h=1039">

The calibration procedure normalizes the response of the 4 diodes, then scans the device horizontally and vertically over the FEL beam to calibrate the position response.

Once completed (approx 1 minute) the plots are updated with the calibration response.  Plotted on the x axis is the device motor position (horizontal - left plot and vertical - right plot) and on the y axis is plotted the normalized horizontal or vertical diode pair response.  For a good setup the plot should be a straight line through the 3 data points.

If you are happy with the calibration, press the "Push results/elog" button where the new calibration data is sent to the required data processing pipelines.  After an automated restart (~30 seconds) both PV and BS position and intensity data will be calculated with the new calibration.  An elog entry is made detailing the calibration data.

## Error
**Soft limits**  
Error message: `ERROR: Motor position outside soft limits`  
Problem is a soft limit on either the device Motor X or Y is blocking the scan motion
1. Select all from drop down menu for motor X and motor Y of PBPS GUI (shown below)  
2. Change motor soft limits to 1 and -1 for both motors  
3. Retry calibration  
<img src="https://docs.google.com/drawings/d/e/2PACX-1vSga-Zluo4b0isNs92C5MXfawMueNVk3ideRRDA_ZGQmD05Jn4noTS_pOl0OHiOyjS31OhLTAelFkYn/pub?w=728&amp;h=686">