#!/bin/bash ## About # Plots a file from an Agilent DSO6034A oscilloscope. The plots are # chan1amp(time) and chan2amp(time). # # This plots the two channels in one plot. # # @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, 5cm set datafile separator "," set samples 100000 set grid; set xlabel "Time [s]"; '$xrangeset'; set title "'$plottitle'"; set output "'$outfile'"; set ylabel "Amplitude [V]"; plot "'$infile'" using 1:2 title "Channel 1" w lines linecolor rgb "red",\ "'$infile'" using 1:3 title "Channel 2" w lines linecolor rgb "blue"; ' > $tmpfile ## Run Gnuplot gnuplot $tmpfile