diff --git a/tests/test_common_cells.hpp b/tests/test_common_cells.hpp index c6863b71712960ca28ae0f9e8d08c7b2bff138ef..43601ee9956e87ec74c39df990ece68ec6bf6261 100644 --- a/tests/test_common_cells.hpp +++ b/tests/test_common_cells.hpp @@ -1,6 +1,7 @@ #include <cmath> #include <cell.hpp> +#include <segment.hpp> #include <math.hpp> #include <parameter_list.hpp> @@ -92,7 +93,7 @@ inline cell make_cell_ball_and_stick(bool with_stim = true) { * Dendrite: * mechanisms: passive (default params) * diameter proximal: 1 µm - * diameter distal: 0.2 µm + * diameter distal: 0.4 µm * length: 200 µm * bulk resistivity: 100 Ω·cm * compartments: 4 @@ -107,7 +108,62 @@ inline cell make_cell_ball_and_taper(bool with_stim = true) { auto soma = c.add_soma(12.6157/2.0); soma->add_mechanism(hh_parameters()); - c.add_cable(0, segmentKind::dendrite, 1.0/2, 0.2/2, 200.0); + c.add_cable(0, segmentKind::dendrite, 1.0/2, 0.4/2, 200.0); + + for (auto& seg: c.segments()) { + seg->mechanism("membrane").set("r_L", 100); + if (seg->is_dendrite()) { + seg->add_mechanism(pas_parameters()); + seg->set_compartments(4); + } + } + + if (with_stim) { + c.add_stimulus({1,1}, {5., 80., 0.3}); + } + return c; +} + +/* + * Create cell with a soma and unbranched dendrite with varying diameter: + * + * Soma: + * mechanisms: HH + * diameter: 12.6157 µm + * + * Dendrite: + * mechanisms: none + * length: 100 µm + * membrane resistance: 100 Ω·cm + * compartments: 4 + * + * Stimulus: + * end of dendrite, t=[5 ms, 85 ms), 0.3 nA + */ + +inline cell make_cell_ball_and_squiggle(bool with_stim = true) { + cell c; + + auto soma = c.add_soma(12.6157/2.0); + soma->add_mechanism(hh_parameters()); + + std::vector<cell::value_type> radii; + std::vector<cell::point_type> points; + + double length = 100.0; + int npoints = 200; + + for (int i=0; i<npoints; ++i) { + double x = i*(1.0/(npoints-1)); + double r = std::exp(-x)*(std::sin(40*x)*0.05+0.1)+0.1; + + radii.push_back(r); + points.push_back({x*length, 0., 0.}); + }; + + auto dendrite = + make_segment<cable_segment>(segmentKind::dendrite, radii, points); + c.add_cable(0, std::move(dendrite)); for (auto& seg: c.segments()) { seg->mechanism("membrane").set("r_L", 100); diff --git a/validation/ref/neuron/CMakeLists.txt b/validation/ref/neuron/CMakeLists.txt index 4df17dc38d23b59c935dad9e02ca0eb19d2b793f..154a29a6605e44bcd1c4c48252f70fcea7e3fb4f 100644 --- a/validation/ref/neuron/CMakeLists.txt +++ b/validation/ref/neuron/CMakeLists.txt @@ -3,6 +3,7 @@ set(models ball_and_stick ball_and_3stick + ball_and_squiggle ball_and_taper simple_exp_synapse simple_exp2_synapse diff --git a/validation/ref/neuron/ball_and_squiggle.py b/validation/ref/neuron/ball_and_squiggle.py new file mode 100644 index 0000000000000000000000000000000000000000..42b2916af35c5ab5b2ee3fc1bec87d98f0648d6b --- /dev/null +++ b/validation/ref/neuron/ball_and_squiggle.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +#coding: utf-8 + +import json +import math +import nrn_validation as V + +V.override_defaults_from_args() + +# dendrite geometry: 100 µm long, varying diameter. +length = 100.0 +npoints = 200 +radius = lambda x: math.exp(-x)*(math.sin(40*x)*0.05+0.1)+0.1 + +xs = [float(i)/(npoints-1) for i in xrange(npoints)] +geom = [(length*x, 2.0*radius(x)) for x in xs] + +model = V.VModel() +model.add_soma(12.6157) +model.add_dendrite('dend', geom) +model.add_iclamp(5, 80, 0.3, to='dend') + +simdur = 100.0 +dt = 0.001 + +data = V.run_nrn_sim(simdur, report_dt=10, model='ball_and_squiggle') +print json.dumps(data) + +V.nrn_stop() + + diff --git a/validation/ref/neuron/ball_and_taper.py b/validation/ref/neuron/ball_and_taper.py index 8b5d35dca92eec8953bd6157d1d711f668e45417..0610fe72db9e8a3dbdd1ec155ce9c8dd970ed392 100644 --- a/validation/ref/neuron/ball_and_taper.py +++ b/validation/ref/neuron/ball_and_taper.py @@ -6,8 +6,8 @@ import nrn_validation as V V.override_defaults_from_args() -# dendrite geometry: 100 µm long, diameter 1 µm to 0.1 µm. -geom = [(0,1), (100, 0.1)] +# dendrite geometry: 200 µm long, diameter 1 µm to 0.4 µm. +geom = [(0,1.0), (200, 0.4)] model = V.VModel() model.add_soma(12.6157)