Skip to content
Snippets Groups Projects
Commit 57202689 authored by GILSON Matthieu's avatar GILSON Matthieu
Browse files

add data loader ARCHIsoc

parent 9496d63d
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:349c8bc6-1a18-4fe2-869c-5581df684b1c tags:
``` python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
```
%% Cell type:code id:47021efb-21dc-4ed2-8375-de1355344a16 tags:
``` python
base_dir = './'
# time series
X_ts = pd.read_hdf(base_dir+'df_ts.hdf')
n_sample, n_ts = X_ts.shape
# labels
y = np.load(base_dir+'lbl_task.npy')
# functional connectivity
FC = np.load(base_dir+'FC.npy')
_, N, _ = X_FC.shape
```
%% Cell type:code id:4dd6acc5-40c8-48e2-81c6-562d518b5859 tags:
``` python
print('shape of data frame for time series:', X_ts.shape)
print('shape of numpy array for FC:', FC.shape)
print('shape of labels:', y.shape)
```
%% Cell type:code id:a6bc3926-de0a-4967-9b00-b66a5a64bd9f tags:
``` python
type(X['dim_0'][0])
```
%% Cell type:code id:ea059511-2df8-447e-a064-ab23a2d4b6f5 tags:
``` python
plt.figure()
for i in range(6):
plt.plot(X.iloc[0,i])
plt.xlabel('time')
plt.ylabel('a.u.')
plt.title('example trace')
plt.show()
```
%% Cell type:code id:5c2b55ce-f85a-4800-aeed-e202bc193688 tags:
``` python
plt.figure()
plt.imshow(X_FC[0,:,:])
plt.colorbar()
plt.xlabel('region index')
plt.ylabel('region index')
plt.show()
```
%% Cell type:code id:37e06d59-48b7-4d8d-8de3-c83641da7896 tags:
``` python
# format FC data for scikit learn (sample x feature)
ind_tri = np.tri(N,N,-1,dtype=bool)
print(ind_tri.sum())
# X array for scikit learn
X_FC = FC[:,ind_tri]
print(X_FC.shape)
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment