Page 1 of 1

Re: The Best Way to Implement a Pulse Train?

Posted: Fri Jul 01, 2011 5:20 pm
by ted
For arbitrary waveforms create an IClamp with del = 0, dur = 1e9, and use the Vector class's play() method to drive its amp variable.

If you want to generate a series of uniform pulses, see this item
I just want a current clamp that will deliver a sequence of current pulses at regular intervals.
in the FAQ list

Re: The Best Way to Implement a Pulse Train?

Posted: Tue Jul 05, 2011 5:42 pm
by ted
The file name is not necessarily the same as the name of anything defined by the contents of the file.
A mod file defines either a point process, a density mechanism, or an artificial cell class. It contains a NEURON block in which there is a statement that declares which of these three it defines, and the name of the thing that it defines.
Case is important.
I don't have ipulse1.mod in front of me, so you will have to examine it yourself to discover what to call an instance of this particular mechanism.

WRT your code example, using the correct name on the right hand side of this statement
TC_stim=new ipulse1(0.5)
should take care of the problem.

I would have written
soma TC_stim=new WhateverItIs(0.5)
since it minimizes typing and for me a chance to type is a chance to mistype. The only statement that requires "section stack syntax" is the one that creates an instance of the WhateverItIs class.
If this method doesn't work, are there any adverse effects to using a large number of individual IClamp instances to stimulate each individual pulse? Will there be a large resource drain or anything?
Each instance of a class consumes additional resources, but if the entire model is small and the computer is powerful, who cares? The more important considerations lie elsewere. Brute force approaches to writing code are not only inelegant but also often difficult to understand, debug, and maintain. At best they are crude hacks, at worst bad examples that one hopes will not be imitated by others. Finally, one's writings, whether for computers or humans, stands as a testimony to the quality of one's work.
I would prefer to keep the code as much in the same style as it currently is, as there are a lot of different projects using the code and I don't want to introduce a bunch of new stuff that everyone has to try and understand.
I hope that doesn't reflect poorly on the style of the existing code, or on the abilities of unnamed collaborators to learn new things.

Re: The Best Way to Implement a Pulse Train?

Posted: Wed Jul 06, 2011 12:03 pm
by ted
I'm trying to stick to the code that they're already familar with.
Understood. But people learn by example, and an example of good practice is probably most beneficial to those who may be seeing it for the first time. What can be said for examples of mediocre or bad practice?