Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/nrncvode/netcvode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3065,7 +3065,7 @@ void PreSyn::deliver(double tt, NetCvode* ns, NrnThread* nt) {
Cvode* cv = (Cvode*) q->data_;
if (tt < cv->t_) {
if (int err = cv->handle_step(nrn_ensure_model_data_are_sorted(), ns, tt);
err != NVI_SUCCESS) {
err != NVI_SUCCESS) {
Printf("warning: cv->handle_step failed with error %d", err);
}
ns->p[i].tq_->move_least(cv->t_);
Expand Down Expand Up @@ -6099,10 +6099,11 @@ void PlayRecord::pr() {
Printf("PlayRecord\n");
}

TvecRecord::TvecRecord(Section* sec, IvocVect* t, Object* ppobj)
: PlayRecord(sec->pnode[0]->v_handle(), ppobj) {
TvecRecord::TvecRecord(Section* sec, IvocVect* tvec, Object* ppobj)
: PlayRecord(sec ? sec->pnode[0]->v_handle() : neuron::container::data_handle<double>{&t},
ppobj) {
// printf("TvecRecord\n");
t_ = t;
t_ = tvec;
ObjObservable::Attach(t_->obj_, this);
}

Expand Down
9 changes: 5 additions & 4 deletions src/nrniv/vrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ void nrn_vecsim_add(void* v, bool record) {
if (hoc_is_object_arg(1)) {
iarg = 1;
ppobj = *hoc_objgetarg(1);
if (!ppobj || ppobj->ctemplate->is_point_ <= 0 ||
nrn_is_artificial_[ob2pntproc(ppobj)->prop->_type]) {
hoc_execerror("Optional first arg is not a POINT_PROCESS", 0);
if (!ppobj || (ppobj->ctemplate->is_point_ <= 0 &&
!nrn_is_artificial_[ob2pntproc(ppobj)->prop->_type])) {
hoc_execerror("Optional first arg is not a POINT_PROCESS or ARTIFICIAL_CELL", 0);
}
}
neuron::container::data_handle<double> dh{};
Expand Down Expand Up @@ -97,7 +97,8 @@ void nrn_vecsim_add(void* v, bool record) {
} else if (ddt > 0.) {
new VecRecordDt(std::move(dh), yvec, ddt, ppobj);
} else if (static_cast<double const*>(dh) == &t) {
new TvecRecord(chk_access(), yvec, ppobj);
// ppobj takes priority
new TvecRecord((!ppobj) ? chk_access() : nullptr, yvec, ppobj);
} else {
new YvecRecord(std::move(dh), yvec, ppobj);
}
Expand Down
1 change: 1 addition & 0 deletions test/hoctests/rand_art.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ INITIAL {
random_setseq(ran2, 5)
x1 = random_uniform(ran1)
net_send(mean*negexp0(), 1)
x2 = 0
}

NET_RECEIVE(w){
Expand Down
32 changes: 32 additions & 0 deletions test/hoctests/tests/test_artrecord.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from neuron import h, gui


def test_artrecord():
ra = h.RanArt()

erec = h.Vector().record(ra, ra._ref_x2)
trec = h.Vector().record(ra, h._ref_t)

def run(tstop):
h.tstop = tstop
h.run()
print("trec")
trec.printf()
print("erec")
erec.printf()

run(0.6)
s = h.Section() # or cvode won't do anything
h.cvode_active(1)
run(0.6)

nc = h.NetCon(ra, None)
ncvec = h.Vector()
nc.record(ncvec)
run(0.6)
print("ncvec")
ncvec.printf()


if __name__ == "__main__":
test_artrecord()