File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -488,7 +488,7 @@ def un_nest_df(df):
488
488
data = sio .loadmat (filename )
489
489
490
490
# construct data frame with features per neuron
491
- df = pd . DataFrame ()
491
+ df = {}
492
492
# count units
493
493
n_cells = data ["cell_metrics" ]["UID" ][0 ][0 ][0 ].size
494
494
dt = data ["cell_metrics" ].dtype
@@ -497,11 +497,17 @@ def un_nest_df(df):
497
497
try :
498
498
if (data ["cell_metrics" ][dn ][0 ][0 ][0 ][0 ].size == 1 ) & (
499
499
data ["cell_metrics" ][dn ][0 ][0 ][0 ].size == n_cells
500
- ):
501
- df [dn ] = data ["cell_metrics" ][dn ][0 ][0 ][0 ]
500
+ ):
501
+ # check if nested within brackets
502
+ try :
503
+ df [dn ] = list (chain (* data ["cell_metrics" ][dn ][0 ][0 ][0 ]))
504
+ except Exception :
505
+ df [dn ] = data ["cell_metrics" ][dn ][0 ][0 ][0 ]
502
506
except Exception :
503
507
continue
504
508
509
+ df = pd .DataFrame (df )
510
+
505
511
# load in tag
506
512
# check if tags exist within cell_metrics
507
513
if "tags" in data .get ("cell_metrics" ).dtype .names :
You can’t perform that action at this time.
0 commit comments