Skip to content

Commit

Permalink
first commit, tests for noise on synapses
Browse files Browse the repository at this point in the history
  • Loading branch information
pmendes committed Aug 14, 2024
1 parent 391865d commit 55b315c
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/0029_SynapseNoise/README.md
Original file line number Diff line number Diff line change
@@ -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
73 changes: 73 additions & 0 deletions tests/0029_SynapseNoise/run.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions tests/0029_SynapseNoise/target_stdout
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 55b315c

Please sign in to comment.