调试 NEURON MOD 文件?

Debugging NEURON MOD files?

调试 NEURON 模拟器 .MOD 文件有哪些有用的方法?在其他语言中,通常可以使用 print() 语句来查看变量值。 .MOD 文件中是否有类似 print() 语句的内容?

使用printf()语句

例如,在 .MOD 文件的任何部分中,添加下面的 printf() 语句将在每次对该部分求值时打印变量 t, i, and v 值模拟:

BREAKPOINT {
    SOLVE state METHOD cnexp
    g = (B - A)*gmax
    i = g*(v - e)

    printf("time: %g, current: %g, voltage: %g \n", t, i, v)
}

将产生如下所示的结果:

time: 231.062, current: 0.000609815, voltage: -67.2939 
time: 231.188, current: 0.000609059, voltage: -67.2938 
time: 231.312, current: 0.000608304, voltage: -67.2937 
time: 231.438, current: 0.00060755, voltage: -67.2936 
time: 231.562, current: 0.000606844, voltage: -67.2924 

备注:

  • 添加上述语句后重新编译文件夹中的.mod文件
  • 不要忘记在末尾包含'\n'以避免堆积输出
  • 其他参数选项(除了 %g)可以在 printf() reference
  • 中找到