debugging use of the Grapher

The basics of how to develop, test, and use models.
Post Reply
thats_karlo

Post by thats_karlo »

Dear Ted,

I have sent result of my code and Grapher result to your email address. Unfortunately, they are not equal, and i don't understand where is mistake.

to run *.hoc file just type

oc> go(5e-5,9e-4,5e-5)

In first column you will see the maximum amplitude of ionic current and second column is voltage clamp step .

in picture you will see my parameters for Grapher.

Thanks in advace
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

I can't use an rar file; ordinary zip would be ok.

Here are some hints for debugging your own code:
1. Are the model specifications identical? That is, are the topology, geometry, biophysical
properties, and values of nseg identical?
2. Are "signal sources" identical? "Signal sources" include current and voltage clamps,
and event streams.
3. Are the simulation parameters identical? Do the simulations have the same initialization,
integration method, and dt? If using adaptive integration ("CVODE"), are the error tolerances
identical? Are the selections on the VariableTimeStep tool's "Details" page identical?
Last edited by ted on Mon Oct 23, 2006 3:01 pm, edited 1 time in total.
thats_karlo

Post by thats_karlo »

Dear Ted,

TYhanks for reply. I have send a zip file from my hoc code and a jpj picture of Grapher.

but, as you will see, the difference is not small. we have different maximum amplitude for different step of voltage clamp.

await for your more advice,

thanks
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

I should have added one more thing to the list, and made it the very first item:
Is the apparent difference caused by trying to compare apples to oranges?

This is an "apples vs. oranges" situation. Your Grapher is plotting calcium current
measured at the end of the simulation runs (t==3000 ms), but the values printed out by
your hoc code are the minimum (most negative) values of the calcium current during the
command pulse--and at different command potentials from those that were used by the
Grapher. The calcium channel's gating variables have time constants whose magnitudes
are in the range of ~10 ms or less. There is no reason to expect the results to be identical.

After you have read this message, I think I will split this entire discussion thread in two.
The original exchange with pzhang was about how to use the Grapher; the subsequent
discussion has more to do with debugging.
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

The Grapher is just a graphical tool for doing this (in pseudocode):

Code: Select all

"independent var" = "indep begin"
while ("independent var" <= "indep end") {
  do whatever the Generator statement says
  plot a point on the graph at x = "x-expr", y = whatever is in the graph's plot list
  increase "independent var" by "indep begin" - "indep end") / "steps"
}
If the Generator statement is
run()
then the Grapher's graph will plot variable values at the end of a simulation run.
thats_karlo had smarter hoc code, which recorded the entire time course of calcium
current during the clamp's depolarizing step, and then used the Vector class's min()
method to extract the most negative value of calcum current (i.e. the maximum inward
calcium current). But the calcium current was a T current, which reaches an early peak
and then inactivates. Since tstop was 3000 ms, the Grapher was plotting the inactivated
current, but the hoc code was reporting the larger peak current.
Post Reply