Hi,
I have a few questions about the psth function and other similar functions:
1) Where can I find the psth and spikebin commands? Presumably the mod files?
2) In general, is there a directory where I can find codes that underlie commands such as these?
3) So what I have done so far is use the spikebin function to turn a voltage trace into a form of raster plot made of 0's and 1's to indicate whether the cell sent a spike or not. This was successful. Then I tried using the psth function to turn this plot into a firing rate graph. However, I am using a variable time step cvode and psth seems to need a fixed time step? (is this true?) I do get a form of firing rate graph but I believe it's wrong.
Can you please help me out?
Thank you
lalitya sastrawinata
psth and calculating firing rates
-
- Site Admin
- Posts: 6303
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: psth and calculating firing rates
Michael Hines, or probably Bill Lytton, can tell you where the source code for
the Vector class's methods is located.
In order to take advantage of psth, you will first have to bin your spike times.
You can do binning as postprocessing i.e. after the end of a simulation run,
so its implementation can be completely independent of integration method--
and should be, for the sake of simplicity.
Use the NetCon class's record method to capture spike times in a Vector
during a run, then in your postprocessing use the Vector class's hist or
histogram (which should it be?) to bin them. If the documentation seems
obscure, and it often does, then run some tests with a toy problem to make
sure you're getting the correct results.
Alternatively, you could use the spike times to calculate "instantaneous
firing rate" = 1/ISI. Given a Vector containing spike times, it's easy to
compute ISIs (Vector has a method that will do it for you), and then
just use the Vector class's apply() to apply a function ffreq() which
returns the inverse of $1+1e-9 (the 1e-9 keeps it from blowing up if
an ISI of 0 is encountered). You may want to smooth the result with
a gaussian.
the Vector class's methods is located.
In order to take advantage of psth, you will first have to bin your spike times.
You can do binning as postprocessing i.e. after the end of a simulation run,
so its implementation can be completely independent of integration method--
and should be, for the sake of simplicity.
Use the NetCon class's record method to capture spike times in a Vector
during a run, then in your postprocessing use the Vector class's hist or
histogram (which should it be?) to bin them. If the documentation seems
obscure, and it often does, then run some tests with a toy problem to make
sure you're getting the correct results.
Alternatively, you could use the spike times to calculate "instantaneous
firing rate" = 1/ISI. Given a Vector containing spike times, it's easy to
compute ISIs (Vector has a method that will do it for you), and then
just use the Vector class's apply() to apply a function ffreq() which
returns the inverse of $1+1e-9 (the 1e-9 keeps it from blowing up if
an ISI of 0 is encountered). You may want to smooth the result with
a gaussian.
The psth and spikebin commands are in
nrnxxx/src/ivoc/ivocvect.cpp
For class methods one can find the code by grepping for the method name in the src/ivoc directory if the method is generic or the src/nrniv directory is the method is specific to neuron modeling. Every class has a list of method names enclosed in double quotes followed by the actual static function that is called. For top-level functions one can find the implementation by looking the the double quoted name in the src/oc/hoc_init.c file to determine the actual c function name and then grepping for that. Again, for neuron related top level functions, do the same in src/nrnoc.
nrnxxx/src/ivoc/ivocvect.cpp
For class methods one can find the code by grepping for the method name in the src/ivoc directory if the method is generic or the src/nrniv directory is the method is specific to neuron modeling. Every class has a list of method names enclosed in double quotes followed by the actual static function that is called. For top-level functions one can find the implementation by looking the the double quoted name in the src/oc/hoc_init.c file to determine the actual c function name and then grepping for that. Again, for neuron related top level functions, do the same in src/nrnoc.