Re: The Best Way to Implement a Pulse Train?

The basics of how to develop, test, and use models.
Post Reply
ted
Site Admin
Posts: 5795
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: The Best Way to Implement a Pulse Train?

Post 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
http://www.neuron.yale.edu/neuron/faq/general-questions
ted
Site Admin
Posts: 5795
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: The Best Way to Implement a Pulse Train?

Post 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)
TC_stim.del=...
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.
ted
Site Admin
Posts: 5795
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: The Best Way to Implement a Pulse Train?

Post 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?
Post Reply