neurenv/loadVe_NoChooser.hoc
2026-07-11 18:20:01 -04:00

52 lines
1.2 KiB
Plaintext

/*
* Create a GUI panel for importing the extracellular potential file
* Written by Sina Shirinpour
* Modified by Zhen Qi
* Modified by Connell Paxton
*/
proc E_field_params(){ localobj pwm, file
pwm = new PWManager()
for jj = 0, pwm.count()-1 {
if (strcmp(pwm.name(jj),"E-field") == 0) {
pwm.close(jj)
break
}
}
file = new File()
getes_realistic($s1)
}
proc getes_realistic() { localobj potentials_file, ex_potential_vec
nseg_total = 0
forall { // Total number of segments
nseg_total += nseg
}
printf("Total: %d\n", nseg_total)
ex_potential_vec = new Vector(nseg_total)
potentials_file = new File()
if(!potentials_file.ropen($s1)){
printf("Extracellular potential file not found!\n")
sred("Press enter to quit", "y", "y")
quit()
}
print "Opened."
ex_potential_vec.scanf(potentials_file)
potentials_file.close()
// (Connell) NOTE: THIS DUPLICATES READINGS AS WE ONLY HAVE 1 POTENTIAL PER
// SWC node, and multiple segments per node.
ii = 0
forall {
for (x,0) {
es_xtra(x) = ex_potential_vec.x[ii]
ii += 1
}
}
printf("%d Extracellular potentials imported\n", ii)
}