Trouble Playing to SEClamp
Posted: Tue Aug 22, 2006 10:09 pm
I am having trouble getting my own complex SEClamp to work. I load a waveform from a file int o a vector and create an appropriate tvec, and then set SEClamp to play it. But my program bombs with a segmentation fault. Here is what the code looks like:
-----------------------------------------------------------------------------------------------------
// make the vector of data by loading a file
volts_clamp_vec = new Vector()
sprint(tmp_str,"%s/%s", param_dir, volts_clamp_file_name)
volts_clamp_file_ref = new File(tmp_str)
volts_clamp_file_ref.ropen()
volts_clamp_vec.scanf(volts_clamp_file_ref)
volts_clamp_file_ref.close()
// make an appropriate time vector: the file contained data sampled at the rate
// of 100 kHz so that should be the time step
volts_clamp_tvec = new Vector(volts_clamp_vec.size())
volts_clamp_tvec.indgen(0.01)
// this loop confirms that the time and data vectors contain what I expect
// (this works!)
for i=0, volts_clamp_vec.size()-1 {
print "wav(", i, ") t = ", volts_clamp_tvec.x, " / V = ", volts_clamp_vec.x
}
// now construct the voltage SEClamp - as advised in previous posts, just give a duration
// that is much too long
soma volts_clamp_ref = new SEClamp(.5)
volts_clamp_ref.dur1 = 500
volts_clamp_ref.rs=.01
// finally, tell the voltage vector to play into the SEClamp
volts_clamp_vec.play(&volts_clamp_ref.amp1, volts_clamp_tvec)
--------------------------------------------------------------------------------------------------------
But when I run my simulation I get
/usr/local/bin/nrniv: Segmentation violation
What might be the problem? Thanks!
-----------------------------------------------------------------------------------------------------
// make the vector of data by loading a file
volts_clamp_vec = new Vector()
sprint(tmp_str,"%s/%s", param_dir, volts_clamp_file_name)
volts_clamp_file_ref = new File(tmp_str)
volts_clamp_file_ref.ropen()
volts_clamp_vec.scanf(volts_clamp_file_ref)
volts_clamp_file_ref.close()
// make an appropriate time vector: the file contained data sampled at the rate
// of 100 kHz so that should be the time step
volts_clamp_tvec = new Vector(volts_clamp_vec.size())
volts_clamp_tvec.indgen(0.01)
// this loop confirms that the time and data vectors contain what I expect
// (this works!)
for i=0, volts_clamp_vec.size()-1 {
print "wav(", i, ") t = ", volts_clamp_tvec.x, " / V = ", volts_clamp_vec.x
}
// now construct the voltage SEClamp - as advised in previous posts, just give a duration
// that is much too long
soma volts_clamp_ref = new SEClamp(.5)
volts_clamp_ref.dur1 = 500
volts_clamp_ref.rs=.01
// finally, tell the voltage vector to play into the SEClamp
volts_clamp_vec.play(&volts_clamp_ref.amp1, volts_clamp_tvec)
--------------------------------------------------------------------------------------------------------
But when I run my simulation I get
/usr/local/bin/nrniv: Segmentation violation
What might be the problem? Thanks!