Open nrnhines opened 2 months ago
This enhancement was proposed in order to simplify the usage of Vector.record
(and Vector.play
) in a multithread and/or local variable time step method context. I.e. a single arg data_handle should suffice for all range variable references without the need to specify an initial POINT_PROCESS or ARTIFICIAL_CELL instance hint or sec=section keyword arg hint. The only case that would still require a hint is the Vector.record(h._ref_t)
where a hint is needed for which thread time is recorded. However, note that the thread_id is not a valid hint since the thread is dynamically determined by the topology of the model. It is not clear to me that resolution of this issue is a prerequisite to, or even much of a help for, #2858
Data_handles to a RANGE or hoc variable presently print information about themselves as a string, e.g., given the objects and variables created by:
then
prints
Note that, in every case, if ref is a data_handle, then
ref[0]
would print the value. It would be nice ifref.thread_id()
would return the thread id associated with the variable handle. In the above cases a ref to 'x' and 't' would return -1, since they are not associated with threads.It would also be nice to have
ref.name()
or var or varname return in the above cases the name of the variable, I.e."v", "m", "dur", "tau", "x", "I_membrane", "t"
andref.container()
or something like that, return in the above cases the relevant container, ie., the object which prefixes the name, I. e:Then
getattr(ref.container, ref.name()) == ref[0]
Lastly, it would be nice if
type(ref)
would be a hoc.Reference instead ofhoc.HocObject
. The latter has the disadvantage thatdir(ref)
prints the large dict of HocObject instead of the few relevant names and methods of a reference.