#! /bin/bash # Last edited on 2021-01-11 07:51:00 by jstolfi # Reads the trace of a set of consecutive neurons in an elem_level simulation. # Plots external, synaptic, or total input as a function of time. # The vertical axis is in mV. 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; # First time to plot. tHi="$1"; shift; # Last time to plot. vLo="$1"; shift # Min voltage to plot, as integer number of mV. vHi="$1"; shift # Max voltage to plot, as integer number of mV. which="$1"; shift # "I" for external, "S" for synaptic, or "J" for total. # END COMMAND LINE PARSING # ---------------------------------------------------------------------- # Prefix for temporary file names tmp="/tmp/$$" # Decide the column of the trace file to plot: if [[ "/${which}" == "/I" ]]; then pltexpr="(column(7))" varname="External" elif [[ "/${which}" == "/S" ]]; then pltexpr="(column(8)-column(7))" varname="Synaptic" elif [[ "/${which}" == "/J" ]]; then pltexpr="(column(8))" varname="Total" else echo "{${cmd}}: ** invalid variable name \"${which}\"" 1>&2; exit 1 fi # Decide the title: if [[ ${ineLo} -lt ${ineHi} ]]; then title="Neurons ${ineLo} .. ${ineHi} - ${varname} input ${which}[t] (mV)" else title="Neuron ${ineLo} - ${varname} input ${which}[t] (mV)" fi hPix=1800 vPix=400 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}" 1>&2 tfile="${tmp}_${which}.png" export GDFONTPATH="." gnuplot <