@@ -182,13 +182,14 @@ def save_morphology_to_file(self):
182182 segments = self .cell .get_idx ()
183183 nseg = len (segments )
184184 self .morphology = np .zeros ((nseg + 1 , 7 ))
185- coords = np .array ((self .cell .xstart ,
186- self .cell .ystart ,
187- self .cell .zstart )).T
188- ends = np .array ((self .cell .xend ,
189- self .cell .yend ,
190- self .cell .zend )).T
191- segdiam = self .cell .diam
185+ print (self .cell .x .shape )
186+ coords = np .array ((self .cell .x [:, 0 ],
187+ self .cell .y [:, 0 ],
188+ self .cell .z [:, 0 ])).T
189+ ends = np .array ((self .cell .x [:, 1 ],
190+ self .cell .y [:, 1 ],
191+ self .cell .z [:, 1 ])).T
192+ segdiam = self .cell .d
192193 parents = {}
193194 self .morphology [0 , 0 ] = 1
194195 self .morphology [0 , 1 ] = 1
@@ -253,7 +254,8 @@ def add_electrodes(self):
253254 self .electrode_parameters ['y' ] = self .ele_coordinates [:, 1 ],
254255 self .electrode_parameters ['z' ] = self .ele_coordinates [:, 2 ],
255256 self .electrode_parameters ['sigma' ] = self .sigma
256- electrode = LFPy .RecExtElectrode (** self .electrode_parameters )
257+ electrode = LFPy .RecExtElectrode (self .cell ,
258+ ** self .electrode_parameters )
257259 self .simulation_parameters ['electrode' ] = electrode
258260
259261 def setup_LFPy_2D_grid (self ,
@@ -465,13 +467,14 @@ def simulate(self, stimulus=None):
465467 self .cell .simulate (** self .simulation_parameters )
466468
467469 def save_LFP (self , directory = '' ):
468- self .simulation_parameters ['electrode' ].calc_lfp ()
470+ M = self .simulation_parameters ['electrode' ].get_transformation_matrix ()
471+ V_ex = M @ self .cell .imem
469472 LFP_path = os .path .join (self .new_path , directory )
470473 if not os .path .exists (LFP_path ):
471474 print ("Creating" , LFP_path )
472475 os .makedirs (LFP_path )
473476 fname = os .path .join (LFP_path , 'MyLFP' )
474- np .savetxt (fname , self . simulation_parameters [ 'electrode' ]. LFP )
477+ np .savetxt (fname , V_ex )
475478
476479 def save_electrode_pos (self , directory = '' ):
477480 electr = np .hstack ((self .ele_coordinates [:, 0 ],
@@ -527,7 +530,7 @@ def save_for_R_kernel(self, directory=''):
527530 np .savetxt (os .path .join (new_path , 'coordsend_x_y_z' ),
528531 coordsend )
529532 # diameter of the segments
530- segdiam = np .hstack ((self .cell .diam ))
533+ segdiam = np .hstack ((self .cell .d ))
531534 np .savetxt (os .path .join (new_path , 'segdiam_x_y_z' ),
532535 segdiam )
533536 # time in the simulation
0 commit comments