2021-03-09 12:41:26 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# Script to acquire data on remote RP(s), transfer the data to local, and plot the data at local.
|
|
|
|
|
|
|
|
# Assumed file hierachy on remote:
|
|
|
|
# /home/
|
|
|
|
# └── pi/
|
|
|
|
# └── mlabs-testsuite/
|
|
|
|
# ├── rp_get_sayma_data.py
|
2021-03-15 15:26:36 +08:00
|
|
|
# └── raw/
|
2021-03-09 12:41:26 +08:00
|
|
|
# | (possible existing data files, will be overwritten)
|
|
|
|
# ├── rp_..._y1_raw.bin.py
|
|
|
|
# ├── rp_..._y2_raw.bin.py
|
|
|
|
# └── ...
|
|
|
|
|
|
|
|
# Assumed file hierachy on local:
|
|
|
|
# ./ (current dir)
|
|
|
|
# ├── plot_sayma_data.py
|
|
|
|
# └── creotech-raw/
|
|
|
|
# | (possible existing data files, will be overwritten)
|
|
|
|
# ├── rp_..._y1_raw.bin.py
|
|
|
|
# ├── rp_..._y2_raw.bin.py
|
|
|
|
# └── ...
|
|
|
|
|
|
|
|
# Default host and hostport for the remote
|
|
|
|
export HOST=pi@rpi-2
|
|
|
|
export HOSTPORT=6000
|
|
|
|
|
2021-03-15 15:26:36 +08:00
|
|
|
if [[ $1 = "" ]] || [[ $2 = "" ]] || [[ $3 = "" ]] || [[ $4 = "" ]] || [[ $5 = "" ]]
|
2021-03-09 12:41:26 +08:00
|
|
|
then
|
2021-03-15 15:26:36 +08:00
|
|
|
echo "Arguments: <RP#1 name> <RP#1 channel> <RP#2 name> <RP#1 channel> <RP#1 name>:<IN1 gain>,<IN2 gain> [<RP#2 name>:<IN1 gain>,<IN2 gain>]"
|
|
|
|
echo "(If RP#1 and RP#2 are the same, skip the bracketed arguments)"
|
|
|
|
echo "Examples: "
|
|
|
|
echo "(1) creotech-1 1 creotech-1 2 creotech-1:LV,HV"
|
|
|
|
echo "(2) creotech-1 1 creotech-2 1 creotech-1:LV,LV creotech-2:HV,HV"
|
2021-03-09 12:41:26 +08:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Acquire data at the remote
|
|
|
|
if [[ $1 = $3 ]]
|
|
|
|
then
|
2021-03-15 15:26:36 +08:00
|
|
|
ssh -t -p $HOSTPORT $HOST "cd mlabs-testsuite && python3 rp_get_sayma_data.py raw $5"
|
2021-03-09 12:41:26 +08:00
|
|
|
else
|
2021-03-15 15:26:36 +08:00
|
|
|
ssh -t -p $HOSTPORT $HOST "cd mlabs-testsuite && python3 rp_get_sayma_data.py raw $5 $6"
|
2021-03-09 12:41:26 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Transfer data from remote to local
|
2021-03-15 15:26:36 +08:00
|
|
|
scp -P $HOSTPORT $HOST:/home/pi/mlabs-testsuite/raw/rp_$1_y$2_raw.bin creotech-raw/
|
|
|
|
scp -P $HOSTPORT $HOST:/home/pi/mlabs-testsuite/raw/rp_$3_y$4_raw.bin creotech-raw/
|
2021-03-09 12:41:26 +08:00
|
|
|
|
|
|
|
# Plot data at local
|
|
|
|
# (Note: requires numpy, matplotlib and scipy on local)
|
|
|
|
python plot_sayma_data.py creotech-raw $1:$2 $3:$4
|