diff --git a/src/nrncvode/netcvode.cpp b/src/nrncvode/netcvode.cpp index 4a39a67b14..ae39da549b 100644 --- a/src/nrncvode/netcvode.cpp +++ b/src/nrncvode/netcvode.cpp @@ -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_); @@ -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{&t}, + ppobj) { // printf("TvecRecord\n"); - t_ = t; + t_ = tvec; ObjObservable::Attach(t_->obj_, this); } diff --git a/src/nrniv/vrecord.cpp b/src/nrniv/vrecord.cpp index 131595070c..0d4f0a4129 100644 --- a/src/nrniv/vrecord.cpp +++ b/src/nrniv/vrecord.cpp @@ -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 dh{}; @@ -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(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); } diff --git a/test/hoctests/rand_art.mod b/test/hoctests/rand_art.mod index bdeac87022..fc76b739af 100644 --- a/test/hoctests/rand_art.mod +++ b/test/hoctests/rand_art.mod @@ -15,6 +15,7 @@ INITIAL { random_setseq(ran2, 5) x1 = random_uniform(ran1) net_send(mean*negexp0(), 1) + x2 = 0 } NET_RECEIVE(w){ diff --git a/test/hoctests/tests/test_artrecord.py b/test/hoctests/tests/test_artrecord.py new file mode 100644 index 0000000000..00e564ec3c --- /dev/null +++ b/test/hoctests/tests/test_artrecord.py @@ -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()