diff --git a/BP_analysis_M431 b/BP_analysis_M431 new file mode 100755 index 0000000..cf3bc98 Binary files /dev/null and b/BP_analysis_M431 differ diff --git a/BP_analysis_thin b/BP_analysis_thin new file mode 100755 index 0000000..0b4280f Binary files /dev/null and b/BP_analysis_thin differ diff --git a/BP_fit b/BP_fit new file mode 100755 index 0000000..5200c72 Binary files /dev/null and b/BP_fit differ diff --git a/BP_fit_M431 b/BP_fit_M431 new file mode 100755 index 0000000..91629d8 Binary files /dev/null and b/BP_fit_M431 differ diff --git a/BP_fit_thin b/BP_fit_thin new file mode 100755 index 0000000..02eb99a Binary files /dev/null and b/BP_fit_thin differ diff --git a/BP_linearity_scan_JF11.sh b/BP_linearity_scan_JF11.sh new file mode 100644 index 0000000..dbddf08 --- /dev/null +++ b/BP_linearity_scan_JF11.sh @@ -0,0 +1,218 @@ +#!/bin/bash + +# to run do: bash BP_scan.sh 0/1 +# arg 1 specify if normal or HG0G1G2 setting +# 1.1 needs file in the blackfin + +# prerequisites: +# - setup_env.sh souced +# - the hostname is set +# - detector is on +# - waveform generator is on +# - amplifier board is powered and unconnected. + +# connect to pc8830 (or any RH7 machine connected to the pulser and, after klog, run the command +# nc -k -n -v -l -p 5555 -e /bin/bash + + +KILLRCV="killall ju_udp_receiver_3threads_2_0" +$KILLRCV + + +if [ "$1" == "" ] || [ $# -gt 1 ]; then + echo "Parameter 1 is empty specify G0 for normal, HG0 for HG0G1G2" + return 0 +fi + +sls_detector_put stop; +sls_detector_put powerchip 0 +sleep 3 +#sls_detector_put setbit 0x5d 7 +sls_detector_put powerchip 1 + +CLI=/afs/psi.ch/project/sls_det_software/serial_control_software/minidelay/minidelay + +#sls_detector_put setbit 0x5d 0 + +sls_detector_put delay 0 +sls_detector_put triggers 1 +sls_detector_put frames 100 +sls_detector_put period 0.005 +sls_detector_put exptime 0.000040 +sls_detector_put highvoltage 0 + +# configure for receiver on mpc2012 +sls_detector_put udp_dstport 32410 +sls_detector_put udp_dstip $DSTIP #10.1.4.105 +sls_detector_put udp_dstmac $DSTMAC #3C:FD:FE:A2:14:D8 +sls_detector_put udp_srcip 10.1.5.9 #wrong on purpose, so we send some packets to nowhere +sls_detector_put udp_srcmac 00:ab:be:cc:dd:e2 +#sls_detector_put configuremac 0 +sls_detector_put readoutspeed 1 +sls_detector_put start # this puts the chip in a known state. packets to nowhere +sls_detector_put stop + + +sls_detector_put udp_srcip $SRCIP #10.1.4.9 #now the right one. + +sleep 3 + +if [ "$1" == 'HG0' ]; then +sls_detector_put settings highgain0 +RCVON=$TKBPHG0 +echo $RCVON +#sls_detector_put reg 0x58 0x00800f ; sls_detector_put setbit 0x58 31 ; sls_detector_put clearbit 0x58 31; +echo "HG0G1G2 mode" +else +sls_detector_put settings gain0 +RCVON=$TKBPG0 +echo $RCVON +#sls_detector_put reg 0x58 0x10800f ; sls_detector_put setbit 0x58 31 ; sls_detector_put clearbit 0x58 31; +echo "normal mode" +fi + +sls_detector_put reg 0x7f 0xff1f +#sls_detector_put reg 0x59 0x1110 + +sleep 1 + +#sls_detector_put reg 0x5b 0xffffffff +#sls_detector_put reg 0x5a 0xffffffff +sleep 1 +#sls_detector_put setbit 0x58 30 ; sleep 1 ;sls_detector_put clearbit 0x58 30; +sleep 1 + + + + + +#sls_detector_put reg 0x5b 0xffffffff +#sls_detector_put reg 0x5a 0xffffffff +#sls_detector_put setbit 0x5d 16 +#sls_detector_put start; +#sls_detector_put stop; +#sls_detector_put clearbit 0x5d 16 + + +# prepare the AGILENT 33250A +echo $CLI" OUTP OFF " | nc pc10773 5555 + +sleep 0.2 + +#remember to put High-Z load! +#Change load to Infinity +echo $CLI" OUTP:LOAD INF " | nc pc10773 5555 + +# Polarity normal +echo $CLI" OUTP:POL NORM" | nc pc10773 5555 + +# pulse +echo $CLI" FUNC PULS" | nc pc10773 5555 +sleep 0.2 +# frequency 1kHz +echo $CLI" FREQ 1000" | nc pc10773 5555 +sleep 0.2 +# width 40 us +echo $CLI" PULS:WIDT 0.000040" | nc pc10773 5555 +sleep 0.2 +# amplitude 0.1 V" | nc pc8830 5555 +echo $CLI" VOLT 0.1" | nc pc10773 5555 +sleep 0.2 +# offset 0 V +#echo $CLI" VOLT:OFFS 0" | nc pc8830 5555 +sleep 0.2 +# VLOW 0 V +echo $CLI" VOLT:LOW 0" | nc pc10773 5555 +sleep 0.2 +# edge 50 ns +echo $CLI" PULS:TRAN 0.000000050" | nc pc10773 5555 +sleep 0.2 +# triggered burst +echo $CLI" BURS:MODE TRIG" | nc pc10773 5555 +sleep 0.2 +# cycles 1 +echo $CLI" BURS:NCYC 1" | nc pc10773 5555 +sleep 0.2 +# external trigger source +echo $CLI" TRIG:SOUR EXT" | nc pc10773 5555 +sleep 0.2 +# delay 1 us +echo $CLI" TRIG:DEL 0.000001" | nc pc10773 5555 +sleep 0.2 +# slope positive +echo $CLI" TRIG:SLOP POS" | nc pc10773 5555 +sleep 0.2 +# turn on burst mode +echo $CLI" BURS:STAT ON" | nc pc10773 5555 +sleep 0.2 + + +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 highvoltage 200 #because it seemed more stable, we are using external HV 230V +# output on +echo $CLI" OUTP ON" | nc pc10773 5555 +sleep 0.2 + +#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 + +sls_detector_put gainmode fixg1 # Trial for M431_JF12 +sleep 2 + +$RCVON & + +# the scan +for ivpulse in {10..1000..50} # normal step: 10 mV +do + +vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l)) +echo $CLI" VOLT:HIGH "$vpulse | nc pc10773 5555 #24.02.2025 changed, before command was echo $CLI" VOLT "$vpulse | nc pc10773 5555 +sleep 1 +sls_detector_put start +sleep 1 +done + +#for ivpulse in {1050..7000..50} uncomment for normal BP scan, changed for linearity scan in G1 +for ivpulse in {1050..6000..50} +do +vpulse=$(printf %.3f $(echo "$ivpulse/1000" | bc -l)) +echo $CLI" VOLT:HIGH "$vpulse | nc pc10773 5555 #24.02.2025 changed, before command was echo $CLI" VOLT "$vpulse | nc pc10773 5555 +sleep 1 +sls_detector_put start +sleep 1 +done + + +# high voltage +sls_detector_put highvoltage 0 +# switch back to dynamic gainmode +sls_detector_put gainmode dynamic +# output off +echo $CLI" OUTP OFF " | nc pc10773 5555 + +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"