Files
JFCalibration/CS_scan.sh
2018-03-16 14:49:34 +01:00

173 lines
3.8 KiB
Bash

#!/bin/bash
# to run do: bash CS_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
sls_detector_put powerchip 1
# set ADCINVERSionreg (by trial and error)
sls_detector_put reg 0x43 0x453b2a9c
sls_detector_put adcphase 72
sls_detector_put frames 640
sls_detector_put period 0.005
sls_detector_put exptime 0.000010
sls_detector_put vhighvoltage 200
# configure for receiver on mpc2012
sls_detector_put rx_udpport 32410
sls_detector_put rx_udpip 10.1.3.105
sls_detector_put rx_udpmac 3C:FD:FE:A2:14:D9
sls_detector_put detectorip 10.1.3.9
sls_detector_put detectormac 00:ab:be:cc:dd:e2
sls_detector_put configuremac 0
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
echo "recording G0 pede"
sls_detector_put status start
sleep 4
echo "recording G1 pede"
sls_detector_put setbit 0x5d 12
sls_detector_put status start
sleep 4
echo "recording G2 pede"
sls_detector_put setbit 0x5d 13
sls_detector_put status start
sleep 4
sls_detector_put clearbit 0x5d 12
sls_detector_put clearbit 0x5d 13
# turn on current source
# bit 16 high bit 17 low = automatic cal col sweep
# bit 16 high bit 17 high = cal col selected with bits 26-20
sls_detector_put setbit 0x5d 16
sleep 1
# loop 1
for tint in {50..450..50} # 25 is too small here, 50 min
do
tint_sec=$(printf %.9f $(echo "$tint/1000000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 2a
for tint in {50..100..5}
do
tint_sec=$(printf %.8f $(echo "$tint/100000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 2b
for tint in {110..200..10}
do
tint_sec=$(printf %.8f $(echo "$tint/100000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 2c
for tint in {225..450..25}
do
tint_sec=$(printf %.8f $(echo "$tint/100000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 3a
for tint in {50..100..5}
do
tint_sec=$(printf %.7f $(echo "$tint/10000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 3b
for tint in {110..200..10}
do
tint_sec=$(printf %.7f $(echo "$tint/10000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 3c
for tint in {225..450..25}
do
tint_sec=$(printf %.7f $(echo "$tint/10000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 4a
for tint in {50..100..5}
do
tint_sec=$(printf %.7f $(echo "$tint/1000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
# loop 4b
for tint in {110..250..10}
do
tint_sec=$(printf %.7f $(echo "$tint/1000000" | bc -l))
echo "setting integration time to (s) " $tint_sec
sls_detector_put exptime $tint_sec
sls_detector_put status start
sleep 4
done
echo "Finished scan"
sls_detector_put exptime 0.000010
sls_detector_put period 0.002
sls_detector_put frames 1000000
sls_detector_put clearbit 0x5d 16
echo "Script finished"