From 55b315c450e5581c870fa82c3e1e72e0ccce78c6 Mon Sep 17 00:00:00 2001 From: Pedro Mendes Date: Wed, 14 Aug 2024 15:09:04 -0400 Subject: [PATCH] first commit, tests for noise on synapses --- tests/0029_SynapseNoise/README.md | 14 +++++ tests/0029_SynapseNoise/run.sh | 73 +++++++++++++++++++++++++++ tests/0029_SynapseNoise/target_stdout | 10 ++++ 3 files changed, 97 insertions(+) create mode 100644 tests/0029_SynapseNoise/README.md create mode 100755 tests/0029_SynapseNoise/run.sh create mode 100644 tests/0029_SynapseNoise/target_stdout diff --git a/tests/0029_SynapseNoise/README.md b/tests/0029_SynapseNoise/README.md new file mode 100644 index 0000000..0206e55 --- /dev/null +++ b/tests/0029_SynapseNoise/README.md @@ -0,0 +1,14 @@ +# 0029_SynapseNoise + +three replicates of IzhikevichBurstingNeuron.cps connected by chemical synapses by ODE *v* adding noise + +## tests + +- 1D, 3 units, network, synaptic connection global quantity ODE, noise +- cps file reads well +- network file reads well +- checks that there are two ODEs for br_i_j (the post-synaptic bound receptor) +- checks that there are two Vsyn parameters +- checks that there are two tau_r parameters +- checks that there are two tau_d parameters +- running the model through COPASI produces output diff --git a/tests/0029_SynapseNoise/run.sh b/tests/0029_SynapseNoise/run.sh new file mode 100755 index 0000000..442e02b --- /dev/null +++ b/tests/0029_SynapseNoise/run.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# work out our folder name +test=${PWD##*/} # to assign to a variable +test=${test:-/} # to correct for the case where PWD=/ + +fail=0 + +# run sbmodelr +../../sbmodelr -s v -n ../sources/1to2to3.gv --cn 0.1 uni -o IzNoise.cps ../sources/IzhikevichBurstingNeuron.cps 3 1> output 2> /dev/null + +# compare output and target +difference=$(diff output target_stdout) +if [[ $difference ]]; then + printf 'FAIL %s\n' "${test}" + fail=1 +fi + +# create model summary +../model_report.py IzNoise.cps >/dev/null +if ! [[ $? = 0 ]]; then + printf 'FAIL %s\n' "${test}" + exit -1 +fi + +# check that there are two ODEs for br_i_j (the post-synaptic bound receptor) +n=$(grep -Pc "br_v_([12])\,([23])\s+ode" IzNoise.summary.txt) +if ((n != 2)) ; then + printf 'FAIL %s\n' "${test}" + let "fail = $fail + 2" +fi + +# check that there are two Vsyn parameters +n=$(grep -Pc "^Vsyn_v_synapse_[12]-[23]\s+fixed" IzNoise.summary.txt) +if ((n != 2)) ; then + printf 'FAIL %s\n' "${test}" + let "fail = $fail + 4" +fi + +# check that there are two tau_r parameters +n=$(grep -Pc "^tau_r_v_synapse_[12]-[23]\s+fixed" IzNoise.summary.txt) +if ((n != 2)) ; then + printf 'FAIL %s\n' "${test}" + let "fail = $fail + 8" +fi + +# check that there are two tau_d parameters +n=$(grep -Pc "^tau_d_v_synapse_[12]-[23]\s+fixed" IzNoise.summary.txt) +if ((n != 2)) ; then + printf 'FAIL %s\n' "${test}" + let "fail = $fail + 8" +fi + +# run the model with CopasiSE +../CopasiSE -c . --nologo IzNoise.cps > cpsout 2>&1 +if ! [[ $? = 0 ]]; then + printf 'FAIL %s\n' "${test}" + let "fail = $fail + 16" +fi + +# check that the output was created and contains last time point +n=$(tail -n 3 I-tc.txt | grep -Pc "^300\s+") +if ((n != 1)) ; then + printf 'FAIL %s\n' "${test}" + let "fail = $fail + 32" +fi + +if [ "$fail" = 0 ] ; then + printf 'PASS %s\n' "${test}" + rm IzNoise.summary.txt I-tc.txt cpsout output *.cps +fi + +exit $fail diff --git a/tests/0029_SynapseNoise/target_stdout b/tests/0029_SynapseNoise/target_stdout new file mode 100644 index 0000000..900c7af --- /dev/null +++ b/tests/0029_SynapseNoise/target_stdout @@ -0,0 +1,10 @@ +Processing ../sources/IzhikevichBurstingNeuron.cps + Reactions: 0 + Species: 0 (Reactions: 0, Fixed: 0, Assignment: 0, ODE: 0) + Compartments: 1 (Fixed: 1, Assignment: 0, ODE: 0) + Global quantities: 8 (Fixed: 6, Assignment: 0, ODE: 2) + Events: 2 (Only time-dependent: 1, variable-dependent: 1) + Network: directed (Nodes: 3, Edges: 2) + +created new model IzNoise.cps with a set of 3 replicas of ../sources/IzhikevichBurstingNeuron.cps +