ContextLab / ContextLab/supereeg

Optimize code for reconstructing timesamples

Open
#9 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
38
Forks
19
PR merge metrics
No merged PRs in 30d

Description

I did some simulations and it seems like the answer that eq. 10 in the paper returns is not dependent on the number of time samples passed, so we have the option to pass as many time samples as we'd like. may be relevant for tensorflow implementation:

heres the code:

```
import numpy as np
import seaborn as sns

# unknown
Kba = np.random.rand(100,10)

# known
Kaa = np.random.rand(10,10)
Y = np.random.rand(10,5000)

# reconstruct 100 time samples
ts1 = np.squeeze(
np.dot(np.dot(Kba, np.linalg.pinv(Kaa)), Y[:,:500]).T)

# reconstruct 2500 time samples
ts2 = np.squeeze(
np.dot(np.dot(Kba, np.linalg.pinv(Kaa)), Y[:,:2500]).T)

print("TS 1 (one time sample) shape: " + str(ts1.shape))
print("TS 2 (2500 time samples) shape: " + str(ts2.shape))

# are the first 100 samples the same?

sns.plt.plot(ts1[:500,:])
sns.plt.title('500 time sample')
sns.plt.show()
sns.plt.plot(ts2[:500,:])
sns.plt.title('2500 time samples')
sns.plt.show()

sns.plt.scatter(ts1[:500,:], ts2[:500,:])
sns.plt.title('First 500 time samples')
sns.plt.show()
```
![image](https://cloud.githubusercontent.com/assets/6596567/26217841/e24998ae-3bd6-11e7-8c8d-b519e622a79d.png)

![image](https://cloud.githubusercontent.com/assets/6596567/26217844/e7033b52-3bd6-11e7-9a8b-6d100a511845.png)

![image](https://cloud.githubusercontent.com/assets/6596567/26217850/eaf777d2-3bd6-11e7-8fa1-da07d9a6ef0a.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.