So first things first... the density is in mA/cm2 if I multiply that by area in um2 then I get current in 1*10^-11 Amps... i.e. if I times it by 10 I get picoamps. Is that correct?
So the finished code goes something like this:
Code: Select all
objref tlist, int_tlist, area_vec
tlist = new List()
int_tlist = new List()
area_vec = new Vector()
forsec whole_cell {
for (seg) { //set up a list full of vectors to store the t current from each segment in the section
tlist.append(new Vector())
int_tlist.append(new Vector()) //now int_tlist is necessarily the same length as tlist
area_vec.append(area(seg)) // area_vec.x(i) is area of tlist.o(i)
tlist.o(tlist.count()-1).record(&ica(p))
}
}
init()
run()
for (i=0; i<tlist.count(); i+=1) {
tlist.o(i).mul(area_vec.x(i) * 10) //converts current density to current in pA
}
//interpolate the current vectors because simulation may be run with variable timestep
for (i=0; i<int_tlist.count(); i+=1) {
int_tlist.o(i).interpolate(fixedT, tvec, tlist.o(i))
}
sumT = new Vector(int_tlist.o(0).size()) // make sure sumT is the right length
//sum interpolated current vectors
for (i=0; i<int_tlist.count(); i+=1) {
sumT.add(int_tlist.o(i))
}
print sumT.min()