Skip to content

Commit d272e12

Browse files
authored
fix section pushing examples in C API docs (#3785)
1 parent cd9c685 commit d272e12

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

docs/capi.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,9 +905,10 @@ Functions, objects, and the stack
905905
906906
// Create current clamp at soma
907907
Symbol* iclamp_sym = nrn_symbol("IClamp");
908-
nrn_object_push((Object*)soma); // Push soma as object
908+
nrn_section_push(soma); // specify the section separately
909909
nrn_double_push(0.0); // Push location (0.0)
910910
Object* iclamp = nrn_object_new(iclamp_sym, 2);
911+
nrn_section_pop();
911912
912913
**Python Equivalent:**
913914

@@ -1966,8 +1967,10 @@ Here we stimulate the cell with a :class:`IClamp` at time 1 ms.
19661967
nrn_mechanism_insert(soma, nrn_symbol("hh"));
19671968
19681969
// current clamp at soma(0.5)
1970+
nrn_section_push(soma); // specify the section separately
19691971
nrn_double_push(0.5);
19701972
Object* iclamp = nrn_object_new(nrn_symbol("IClamp"), 1);
1973+
nrn_section_pop();
19711974
for (const auto& [property, value] : {pair{"amp", 0.3}, pair{"del", 1.0}, pair{"dur", 0.1}}) {
19721975
nrn_property_set(iclamp, property, value);
19731976
}
@@ -2051,4 +2054,4 @@ This displays the following image:
20512054
.. image:: progref/images/hh_sim_cpp.png
20522055
:alt: Hodgkin-Huxley simulation driven by a current clamp at 1ms showing an action potential
20532056
:width: 75%
2054-
:align: center
2057+
:align: center

0 commit comments

Comments
 (0)