Skip to content

Commit

Permalink
Use xarray to output the combined multiunit
Browse files Browse the repository at this point in the history
  • Loading branch information
edeno committed Oct 7, 2018
1 parent fd99db5 commit e4bedbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions loren_frank_data_processing/multiunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np
import pandas as pd
import xarray as xr
from scipy.io import loadmat

from loren_frank_data_processing.core import get_data_filename, logger
Expand Down Expand Up @@ -165,6 +166,9 @@ def get_all_multiunit_indicators(tetrode_keys, animals,
time.total_seconds())
time_index[time_index >= len(time)] = len(time) - 1
multiunit_dfs.append(df.groupby(time[time_index]).mean()
.reindex(index=time))
.reindex(index=time)
.to_xarray()
.to_array('features'))

return pd.concat(multiunit_dfs, axis=1)
return (xr.concat(multiunit_dfs, dim='tetrodes')
.transpose('time', 'features', 'tetrodes'))

0 comments on commit e4bedbc

Please sign in to comment.