@@ -242,7 +242,7 @@ def probe_to_obj(
242242 print (f"✗ Failed to generate OBJ for { filename } : { e } " )
243243 return False
244244
245- def _calculate_tip_coords (self , probe : Probe ) -> list :
245+ def _calculate_tip_coords (self , probe : Probe ) -> tuple [ list , list ] :
246246 """Calculate tip coordinates for a probe."""
247247 contour = np .array (getattr (probe , "probe_planar_contour" , []))
248248 tip_coords = []
@@ -277,7 +277,9 @@ def _calculate_tip_coords(self, probe: Probe) -> list:
277277 else :
278278 x , y , z = tip_elec
279279 tip_coords .append ([float (x ), float (y ), float (z )])
280- return tip_coords
280+
281+ center_coord = np .mean (np .array (tip_coords ), axis = 0 )
282+ return tip_coords , center_coord
281283
282284 def _get_top_coordinate (self , probe : Probe ) -> list :
283285 """Compute the top coordinate as midpoint of min/max X and max Y from probe contour."""
@@ -298,7 +300,7 @@ def generate_metadata_json(
298300 manufacturer : str = "unknown" ,
299301 ) -> bool :
300302 try :
301- tip_coords = self ._calculate_tip_coords (probe )
303+ tip_coords , center_coord = self ._calculate_tip_coords (probe )
302304 top_coord = self ._get_top_coordinate (probe )
303305 metadata = {
304306 "name" : filename .replace ("_" , " " ).title (),
@@ -307,6 +309,7 @@ def generate_metadata_json(
307309 "sites" : probe .get_contact_count (),
308310 "shanks" : probe .get_shank_count (),
309311 "tip_coordinates" : tip_coords ,
312+ "center_coordinate" : list (center_coord ),
310313 "top_coordinate" : top_coord ,
311314 "references" : "Generated using probeinterface library" ,
312315 "spec" : "https://probeinterface.readthedocs.io/" ,
0 commit comments