50 lines
1.6 KiB
Plaintext
50 lines
1.6 KiB
Plaintext
|
#!/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
|
||
|
# └── creotech-raw/
|
||
|
# | (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
|
||
|
|
||
|
if [[ $1 = "" ]] || [[ $2 = "" ]] || [[ $3 = "" ]] || [[ $4 = "" ]]
|
||
|
then
|
||
|
echo "Arguments: <RP#1 name> <RP#1 channel> <RP#2 name> <RP#2 channel>"
|
||
|
echo "(RP#1 and RP#2 can be the same)"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
# Acquire data at the remote
|
||
|
if [[ $1 = $3 ]]
|
||
|
then
|
||
|
ssh -t -p $HOSTPORT $HOST "cd mlabs-testsuite && python3 rp_get_sayma_data.py creotech-raw $1"
|
||
|
else
|
||
|
ssh -t -p $HOSTPORT $HOST "cd mlabs-testsuite && python3 rp_get_sayma_data.py creotech-raw $1 $3"
|
||
|
fi
|
||
|
|
||
|
# Transfer data from remote to local
|
||
|
scp -P $HOSTPORT $HOST:/home/pi/mlabs-testsuite/creotech-raw/rp_$1_y$2_raw.bin creotech-raw/
|
||
|
scp -P $HOSTPORT $HOST:/home/pi/mlabs-testsuite/creotech-raw/rp_$3_y$4_raw.bin creotech-raw/
|
||
|
|
||
|
# Plot data at local
|
||
|
# (Note: requires numpy, matplotlib and scipy on local)
|
||
|
python plot_sayma_data.py creotech-raw $1:$2 $3:$4
|