#!/bin/bash ## About # Plots a file from an Agilent DSO6034A oscilloscope. The plots are # chan1amp(time) and chan2amp(time). # # This plots channel 1 above channel 2. # # @author Søren B. Nørgaard # @date 2013-12-12 ## Usage # plot_from_agilentscope CSVFILE # plot_from_agilentscope CSVFILE TITLE # plot_from_agilentscope CSVFILE TITLE TSTART TSTOP ## Dependencies # Gnuplot ## Init tmpfile=/tmp/tmpgnuplot.gpi ## Arguments if [ $# -eq 1 ]; then plottitle="Oscilloscope output"; elif [ $# -eq 2 ]; then plottitle=$2; elif [ $# -eq 4 ]; then plottitle=$2; xrangeset="set xrange ["$3":"$4"]" else echo ' Usage: plot_from_agilentscope CSVFILE plot_from_agilentscope CSVFILE TITLE plot_from_agilentscope CSVFILE TITLE TSTART TSTOP ' exit $E_BADARGS fi infile=$1 outfile=`echo $infile | cut -d\. -f1`"_plot.pdf" # Gnuplot Code echo ' set term "pdf" size 18cm, 10cm set output "'$outfile'"; set multiplot layout 2,1 set datafile separator "," set samples 100000 set grid; unset key set xlabel "Time [s]"; '$xrangeset'; set ylabel "Amplitude [V]"; set title "Channel 1"; plot "'$infile'" using 1:2 title "Channel 1" w lines linecolor rgb "red"; set title "Channel 2"; plot "'$infile'" using 1:3 title "Channel 2" w lines linecolor rgb "blue"; unset multiplot ' > $tmpfile ## Run Gnuplot gnuplot $tmpfile