#! /bin/bash # Last edited on 2021-01-11 07:51:15 by jstolfi # Reads the trace of a set of consecutive neurons in an elem_level simulation. # Plots the average potential those neurons as a function of time. # If there is only one neuron, also plots the firings as dots on an horizontal line. cmd="$0"; cmd="${cmd##*/}" show=$1; shift # 1 to display the plot fname="$1"; shift # Trace file name. ineLo="$1"; shift # Index of first neuron. ineHi="$1"; shift # Index of last neuron. tLo="$1"; shift # Min time to plot, as integer number of ms, or ''. tHi="$1"; shift # Max time to plot, as integer number of ms, or ''. vLo="$1"; shift # Min voltage to plot, as integer number of mV. vHi="$1"; shift # Max voltage to plot, as integer number of mV. vX="$1"; shift # Voltage where to plot the firing dots. # END COMMAND LINE PARSING # ---------------------------------------------------------------------- # Prefix for temporary file names tmp="/tmp/$$" # Decide the title and ordinate of the spike dots: if [[ ${ineLo} -lt ${ineHi} ]]; then title="Neurons ${ineLo} .. ${ineHi} - Potential V[t] (mV)" plotX="" keyopt="" else title="Neuron ${ineLo} - Potential V[t] (mV) and firings X[t]" # Choose the ordinate ${vX} where to show the firings: plotX=", '' using 1:(dot(6)) title 'X[t]' with points pt 7 ps 1.25 lc rgb '#003399' " keyopt="set key top right" fi hPix=1800 vPix=600 hTics=( `nmsim_choose_plot_tics.gawk -v vLo=${tLo} -v vHi=${tHi} -v nPix=${hPix}` ) vTics=( `nmsim_choose_plot_tics.gawk -v vLo=${vLo} -v vHi=${vHi} -v nPix=${vPix}` ) echo "{${cmd}}: title = ${title} vX = ${vX}" 1>&2 tfile="${tmp}.png" export GDFONTPATH="." gnuplot <