# Last edited on 2020-12-27 17:16:30 by jstolfi SHELL := /bin/bash CONVERT_SCRIPT := convert_nilton_to_nmsim.gawk OUTDEG_SCRIPT := count_outdegrees.gawk PROG := nmsim_elem_net_simulate NILTON_FILE := data-nilton.txt NMSIM_SAMPLE_FILE := .head-nmsim.txt OUTDEG_FILE := outdegrees.txt NMSIM_FILE := data-nmsim.txt OUT_PREFIX := out/sim OUT_RHO_FILE := ${OUT_PREFIX}_neuron_rho_stats.txt OUT_RHO_PDF := ${OUT_PREFIX}_neuron_rho_stats.pdf OUT_SGRP_FILE := ${OUT_PREFIX}_synapse_stats.txt OUT_SGRP_PDF := ${OUT_PREFIX}_synapse_stats.pdf .PHONY: .PHONY: outdegrees convert sample compile simulate summaries plot-traces all: compile simulate summaries plot-traces NSTEPS := 1000 TMIN := 350 TMAX := 850 RHOMAX := 0.1000 RHOTIC := 0.0500 simulate: ${NMSIM_FILE} mkdir -p out rm -f ${OUT_PREFIX}*.{txt,png,ps,pdf} time ${PROG} \ -netFile ${NMSIM_FILE} \ -timeStep 1.0 \ -nSteps ${NSTEPS} \ \ -exInput 0 20682 0 ${NSTEPS} 2.2477 0.6257 \ -exInput 20683 26516 0 ${NSTEPS} 2.1072 0.6059 \ -exInput 26517 48431 0 ${NSTEPS} 2.9501 0.7169 \ -exInput 48432 53910 0 ${NSTEPS} 2.6691 0.6819 \ -exInput 53911 58760 0 ${NSTEPS} 2.8096 0.6996 \ -exInput 58761 59825 0 ${NSTEPS} 2.6691 0.6819 \ -exInput 59826 74220 0 ${NSTEPS} 4.0739 0.8424 \ -exInput 74221 77168 0 ${NSTEPS} 2.9501 0.7169 \ \ -trace 0 0 ${TMIN} ${TMAX} \ -trace 20683 20683 ${TMIN} ${TMAX} \ -trace 26517 26517 ${TMIN} ${TMAX} \ -trace 48432 48432 ${TMIN} ${TMAX} \ -trace 53911 53911 ${TMIN} ${TMAX} \ -trace 58761 58761 ${TMIN} ${TMAX} \ -trace 59826 59826 ${TMIN} ${TMAX} \ -trace 74221 74221 ${TMIN} ${TMAX} \ \ -trace 0 20682 ${TMIN} ${TMAX} \ -trace 20683 26516 ${TMIN} ${TMAX} \ -trace 26517 48431 ${TMIN} ${TMAX} \ -trace 48432 53910 ${TMIN} ${TMAX} \ -trace 53911 58760 ${TMIN} ${TMAX} \ -trace 58761 59825 ${TMIN} ${TMAX} \ -trace 59826 74220 ${TMIN} ${TMAX} \ -trace 74221 77168 ${TMIN} ${TMAX} \ \ -groupStats ${TMIN} ${TMAX} \ -outPrefix ${OUT_PREFIX} summaries: iso-to-ps-hack -8pt -landscape < ${OUT_SGRP_FILE} | ps2pdf - ${OUT_SGRP_PDF} list_stats_by_group.sh ${OUT_PREFIX} > ${OUT_RHO_FILE} iso-to-ps-hack -14pt < ${OUT_RHO_FILE} | ps2pdf - ${OUT_RHO_PDF} LIB_DIR := ${HOME}/programs/c/JSLIBS PROG_DIR := ${HOME}/programs/c/NEUROMAT/${PROG} compile: cd ${LIB_DIR}/libjs && make build-lib install cd ${LIB_DIR}/libnmsim && make build-lib install cd ${LIB_DIR}/libnmsim_e && make build-lib install cd ${PROG_DIR} && make build install plot-traces: for ff in ${OUT_PREFIX}*_trace.txt ; do \ echo "plotting $$ff..." 1>&2 ; \ ines=( `nmsim_extract_neuron_indices.sh $$ff` ); \ nmsim_plot_rho.sh 0 $$ff $${ines[@]} ${TMIN} ${TMAX} ${RHOMAX} ${RHOTIC}; \ nmsim_plot_input.sh 0 $$ff $${ines[@]} ${TMIN} ${TMAX} -25 25 I ; \ nmsim_plot_input.sh 0 $$ff $${ines[@]} ${TMIN} ${TMAX} -25 25 J ; \ nmsim_plot_input.sh 0 $$ff $${ines[@]} ${TMIN} ${TMAX} -25 25 S ; \ nmsim_plot_potentials.sh 0 $$ff $${ines[@]} ${TMIN} ${TMAX} -60 60 40 ; \ done combine_group_plots.sh \ 0000000000--0000020682 \ 0000020683--0000026516 \ 0000026517--0000048431 \ 0000048432--0000053910 \ 0000053911--0000058760 \ 0000058761--0000059825 \ 0000059826--0000074220 \ 0000074221--0000077168 outdegrees: ${OUTDEG_FILE} convert: ${NMSIM_FILE} sample: ${NMSIM_SAMPLE_FILE} ${OUTDEG_FILE}: ${NILTON_FILE} ${OUTDEG_SCRIPT} ${OUTDEG_SCRIPT} \ -v nne=77169 \ < ${NILTON_FILE} \ > ${OUTDEG_FILE} ${NMSIM_FILE}: ${NILTON_FILE} ${OUTDEG_FILE} ${CONVERT_SCRIPT} rm -f ${NMSIM_SAMPLE_FILE} ${CONVERT_SCRIPT} \ -v dead=0 \ -v odfname="${OUTDEG_FILE}" \ < ${NILTON_FILE} \ > ${NMSIM_FILE} ${NMSIM_SAMPLE_FILE}: ${NMSIM_FILE} head -n 1000 ${NMSIM_FILE} > ${NMSIM_SAMPLE_FILE} echo "..." >> ${NMSIM_SAMPLE_FILE} egrep \ -A 30 -B 10 \ -e '^ *0 +0 +([0-9] *$$|.*[.][0-9])' \ ${NMSIM_FILE} \ >> ${NMSIM_SAMPLE_FILE} echo "..." >> ${NMSIM_SAMPLE_FILE} tail -n 100 ${NMSIM_FILE} >> ${NMSIM_SAMPLE_FILE}