Files
JFCalibration/BP_scan.sh

138 lines
4.1 KiB
Bash

#!/bin/bash
# to run do: bash BP_scan.sh
# prerequisites:
# - the hostname is set
# - export PATH=/afs/psi.ch/project/sls_det_software/latest_slsDetectorPackage/build/bin:$PATH
# - export LD_LIBRARY_PATH=/afs/psi.ch/project/sls_det_software/latest_slsDetectorPackage/build/bin:$LD_LIBRARY_PATH
# - detector is on
# - waveform generator is on
# - amplifier board is powered +35 V -5 V
sls_detector_put powerchip 1
# set ADCINVERSionreg (by trial and error)
sls_detector_put reg 0x43 0x453b2a9c
sls_detector_put delay 0
sls_detector_put cycles 1
sls_detector_put frames 100
sls_detector_put period 0.002
sls_detector_put exptime 0.000020
sls_detector_put vhighvoltage 0
# configure for receiver on mpc2012
sls_detector_put rx_udpport 32410
sls_detector_put rx_udpip 10.1.4.105
sls_detector_put rx_udpmac 3C:FD:FE:A2:14:D8
sls_detector_put detectorip 10.1.4.9
sls_detector_put detectormac 00:ab:be:cc:dd:e2
sls_detector_put configuremac 0
# prepare the AGILENT 33250A
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay OUTP OFF
sleep 1
# pulse
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay FUNC PULS
sleep 1
# frequency 1kHz
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay FREQ 1000
sleep 1
# width 40 us
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay PULS:WIDT 0.000040
sleep 1
# amplitude 0.1 V
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT 0.1
sleep 1
# offset 0 V
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT:OFFS 0
sleep 1
# edge 50 ns
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay PULS:TRAN 0.000000050
sleep 1
# triggered burst
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay BURS:MODE TRIG
sleep 1
# cycles 1
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay BURS:NCYC 1
sleep 1
# external trigger source
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay TRIG:SOUR EXT
sleep 1
# delay 1 us
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay TRIG:DEL 0.000001
sleep 1
# slope positive
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay TRIG:SLOP POS
sleep 1
# turn on burst mode
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay BURS:STAT ON
sleep 1
echo "It is now safe to connect the cable between the amplifier board and the readout board"
echo "Please do so and press any key to continue, or press q to exit this script"
read -n 1 -s input
if [[ $input = "q" ]]; then
echo "Exiting script"
exit 1
fi
# high voltage
sls_detector_put vhighvoltage 200
# output on
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay OUTP ON
sleep 1
echo "The current on the amplifier board should be ~0.035 A"
echo "Please check and press any key to continue, or press q to exit this script"
read -n 1 -s input
if [[ $input = "q" ]]; then
echo "Exiting script"
exit 1
fi
echo "The receiver should be waiting for data"
echo "Please check and press any key to continue, or press q to exit this script"
read -n 1 -s input
if [[ $input = "q" ]]; then
echo "Exiting script"
exit 1
fi
# the scan
for ivpulse in {10..1000..10}
do
vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l))
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT $vpulse
sleep 1
sls_detector_put status start
sleep 1
done
for ivpulse in {1050..7000..50}
do
vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l))
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay VOLT $vpulse
sleep 1
sls_detector_put status start
sleep 1
done
# high voltage
sls_detector_put vhighvoltage 0
# output off
/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay OUTP OFF
echo "Finished scan, please wait for capacitor to discharge"
sleep 20
echo "It is now safe to disconnect the cable between the amplifier board and the readout board"
echo "Script finished"