Skip to content

Commit db98675

Browse files
committed
add documents
1 parent bba4f72 commit db98675

12 files changed

+390
-17
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# EasyEEG
1+
## Concise Agile Flexible EEG data analyis toolbox
2+
3+
EasyEEG provides simple, flexible and powerful methods that can be used to directly test neural and psychological hypotheses based on topographic responses. These multivariate methods can investigate effects in the dimensions of response magnitude and topographic patterns separately using data in the sensor space, therefore enable assessing neural sources and its dynamics without sophisticated localization. Python based algorithms provide concise and extendable features of Cafe. Users of all levels can benefit from Cafe and obtain a straightforward solution to efficiently handle and process EEG data and a complete pipeline from raw data to publication.

doc.md renamed to docs/api.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
Aim;
2-
Simplifying the analysis
3-
- For beginners: clear logics for the steps (least concepts);
4-
- For data players (who want to check various aspects of data or to try various analysis algorithms): one-line code for each idea;
5-
- For data players (who want to apply DIY analysis methods): plenty of low/high level functions for quickly building your own algorithm.
1+
## Initialization
62

7-
Advantages:
8-
- Don't need to extract the data in a messy way when you want to do new analysis. You can just use a string or a dictionary to describe the target now.
9-
- Applying EEG analysis method by one-line code. (ERP, topography, specturm, time-frequency, etc.)
10-
- Applying advanced EEG analysis methods (clustering, classification, etc.)
11-
- Beautiful ploting
12-
- Plenty of basic and advanced APIs which can help to build your own analysis algorithm and to visualize the result.
133

14-
15-
---
16-
# todo
17-
18-
---
194
# `Load data`
205
load_raw_eeg()
216
from_mne_epochs()

docs/api_template.txt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## Initialization
2+
- **start**
3+
---
4+
## Stimulus
5+
### *Position*
6+
- **getPos**
7+
### *Text*
8+
- **drawText**
9+
### *Shape*
10+
- **drawRect**
11+
- **drawCircle**
12+
- **drawPoints**
13+
- **drawLines**
14+
### *Picture*
15+
- **drawPic**
16+
### *Sound*
17+
- **loadSound**
18+
- **loadManySound**
19+
- **makeBeep**
20+
- **makeNoise**
21+
- **makeSound**
22+
- **playSound**
23+
- **playBusySound**
24+
- **playFreeSound**
25+
- **playAlterableSound**
26+
- **toStereoArray**
27+
- **changeVolume**
28+
- **changePitch**
29+
- **changeOnTracks**
30+
31+
### *Video*
32+
- **loadVideo**
33+
- **playVideo**
34+
### *Display controller*
35+
- **show**
36+
- **clear**
37+
- **getScreen**
38+
---
39+
## Response
40+
### *Keyboard & Mouse & Joystick*
41+
- **waitForResponse**
42+
### *Sound Recorder*
43+
- **environmentNoise**
44+
- **recordSound**
45+
---
46+
## IO
47+
### *Read*
48+
- **readSetting**
49+
- **readStimuli**
50+
- **readDir**
51+
### *Save*
52+
- **saveResult**
53+
### *Record the log*
54+
- **log**
55+
### *Send trigger*
56+
- **sendTrigger**
57+
---
58+
## Other Scaffolds
59+
- **textSlide**
60+
- **getInput**
61+
- **getSubjectID**
62+
- **instruction**
63+
- **alert**
64+
- **alertAndGo**
65+
- **alertAndQuit**
66+
- **restTime**
67+
- **normalProcedure**
68+
File renamed without changes.

docs/cookbook.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Cookbook
2+
---
3+
## *Initiation*
4+
```python
5+
# coding:utf-8
6+
import easyEEG
7+
```
8+
9+
## *Load*
10+
11+
## *Save*

docs/cookbook_template.txt

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Cookbook
2+
---
3+
- Experiment Initiation
4+
- Experiment Structure
5+
- Visual
6+
- Show text
7+
- Show picture
8+
- Show shape
9+
- Video
10+
- Auditory
11+
- Play sound
12+
- Sound Recording
13+
- Response
14+
- Scaffold functions
15+
- Get external parameters
16+
- Read or write file
17+
- Send trigger
18+
- Preload screen
19+
20+
---
21+
22+
## *Experiment Initiation*
23+
```python
24+
# coding:utf-8
25+
from expy import * # Import the needed functions
26+
start() # Initiate the experiment environment
27+
```
28+
29+
## *Experiment Structure*
30+
A standard experiment contains 3 levels:
31+
32+
- Run(Session)
33+
- Block
34+
- Trial
35+
So we suggest that your code should have hierarchical structure, as the example below:
36+
```python
37+
from expy import *
38+
start()
39+
40+
def trial(stim):
41+
draw(stim)
42+
show(1)
43+
44+
def block(trialList):
45+
for stim in trialList:
46+
trial(stim)
47+
48+
# run
49+
for trialList in blockList:
50+
block(trialList)
51+
```
52+
53+
## *Visual*
54+
### Show text
55+
& show_text.py
56+
57+
### Show picture
58+
& show_picture.py
59+
60+
### Show shape
61+
& show_shape.py
62+
63+
## *Video*
64+
& play_video.py
65+
66+
## *Auditory*
67+
### Play sound
68+
& play_sound.py
69+
70+
### *Sound Recording*
71+
& sound_recording.py
72+
73+
## *Response*
74+
& response.py
75+
76+
## *Scaffold functions*
77+
& scaffold.py
78+
79+
## *Get external parameters*
80+
& read_setting.py
81+
82+
## *Read or Write*
83+
& io.py
84+
85+
## *Send trigger*
86+
& send_trigger.py
87+
88+
## *Preload screen*
89+
& preload.py

docs/docs_generator.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import re
2+
import os
3+
4+
path = '../'
5+
6+
'quickstart_generator'
7+
with open(path+'docs/quickstart_template.txt') as f:
8+
template = f.readlines()
9+
10+
new_file = []
11+
for l in template:
12+
if l[:2] != '& ':
13+
new_file.append(l)
14+
else:
15+
try:
16+
with open('../test/'+l[2:].replace('\n',''), encoding='utf8') as f:
17+
lines = f.readlines()
18+
19+
for ind,l in enumerate(lines):
20+
if l[:18] == "from expy import *":
21+
break
22+
23+
code = ''.join(lines[ind:])
24+
25+
new_file.append('\n```python\n%s\n```\n' %(code))
26+
except:
27+
print('cannnot read',file)
28+
29+
30+
with open(path+'docs/quickstart.md','w+', encoding='utf8') as f:
31+
f.writelines(new_file)
32+
33+
'cookbook_generator'
34+
with open(path+'docs/cookbook_template.txt') as f:
35+
template = f.readlines()
36+
37+
new_file = []
38+
for l in template:
39+
if l[:2] != '& ':
40+
new_file.append(l)
41+
else:
42+
try:
43+
with open('../test/'+l[2:].replace('\n',''), encoding='utf8') as f:
44+
lines = f.readlines()
45+
46+
for ind,l in enumerate(lines):
47+
if l[:18] == "from expy import *":
48+
ind += 1
49+
break
50+
51+
code = ''.join(lines[ind:])
52+
53+
new_file.append('\n```python\n%s\n```\n' %(code))
54+
except:
55+
print('cannnot read',file)
56+
57+
58+
with open(path+'docs/cookbook.md','w+', encoding='utf8') as f:
59+
f.writelines(new_file)
60+
61+
'api_generator'
62+
with open(path+'docs/api_template.txt') as f:
63+
template = f.readlines()
64+
65+
comments = dict()
66+
for root, _dirs, files in os.walk(path):
67+
for file in files:
68+
if file[-3:]=='.py' and root[-4:] != 'test':
69+
try:
70+
with open(root+'\\'+file,encoding='utf8') as f:
71+
72+
lines = f.readlines()
73+
74+
defines = []
75+
for ind,l in enumerate(lines):
76+
if l[:4] == "def ":
77+
defines.append([l,ind])
78+
79+
for define,ind in defines:
80+
if lines[ind+1] == " '''\n":
81+
f = re.search('def (.*?)\((.*)\)',define)
82+
f_name = f.group(1)
83+
f_args = f.group(2)
84+
comments[f_name] = [f_args,'']
85+
ind += 2
86+
while lines[ind] != " '''\n":
87+
comments[f_name][1] += (lines[ind][4:-1] + '\n')
88+
ind += 1
89+
except:
90+
print('cannnot read',file)
91+
92+
new_file = []
93+
for l in template:
94+
if '- **' != l[:4]:
95+
new_file.append(l)
96+
else:
97+
f_args,comm = comments[l[4:-3]]
98+
new_file.append('\n- **%s(%s)**\n\n' %(l[4:-3],f_args))
99+
new_file.append('\n```\n%s```\n\n' %(comm))
100+
101+
with open(path+'docs/api.md','w+', encoding='utf8') as f:
102+
f.writelines(new_file)

docs/index.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Overview
2+
3+
[![PyPI Version][pypi-v-image]][pypi-v-link]
4+
5+
[pypi-v-image]: https://img.shields.io/pypi/v/easyEEG.png
6+
[pypi-v-link]: https://pypi.python.org/pypi/easyEEG
7+
8+
EasyEEG provides simple, flexible and powerful methods that can be used to directly test neural and psychological hypotheses based on topographic responses. These multivariate methods can investigate effects in the dimensions of response magnitude and topographic patterns separately using data in the sensor space, therefore enable assessing neural sources and its dynamics without sophisticated localization. Python based algorithms provide concise and extendable features of Cafe. Users of all levels can benefit from Cafe and obtain a straightforward solution to efficiently handle and process EEG data and a complete pipeline from raw data to publication.
9+
10+
**Highlights**:
11+
Simplifying the analysis
12+
- For beginners: clear logics for the steps (least concepts);
13+
- For data players (who want to check various aspects of data or to try various analysis algorithms): one-line code for each idea;
14+
- For data players (who want to apply DIY analysis methods): plenty of low/high level functions for quickly building your own algorithm.
15+
16+
Advantages:
17+
- Don't need to extract the data in a messy way when you want to do new analysis. You can just use a string or a dictionary to describe the target now.
18+
- Applying EEG analysis method by one-line code. (ERP, topography, specturm, time-frequency, etc.)
19+
- Applying advanced EEG analysis methods (clustering, classification, etc.)
20+
- Beautiful ploting
21+
- Plenty of basic and advanced APIs which can help to build your own analysis algorithm and to visualize the result.
22+
23+
todo
24+
25+
**limitation**:
26+
27+
todo
28+
29+
---
30+
## Documentation
31+
See http://easyeeg.readthedocs.io/en/latest/ for introduction, tutorials, and reference manual.
32+
33+
---
34+
# Installation instructions
35+
36+
The simplest way to install EasyEEG is through the Python Package Index (PyPI), which ensures that all required dependencies are established. This can be achieved by executing the following command:
37+
38+
```
39+
pip install easyEEG
40+
```
41+
or:
42+
```
43+
sudo pip install easyEEG
44+
```
45+
46+
The command of getting update:
47+
```
48+
pip install --upgrade easyEEG --no-deps
49+
```
50+
or:
51+
```
52+
sudo pip install --upgrade easyEEG --no-deps
53+
```
54+
55+
### *Required Dependencies*
56+
57+
- numpy
58+
- pandas
59+
- scipy
60+
- matplotlib
61+
- statsmodels
62+
- seaborn
63+
- mne
64+
- permute
65+
- tqdm
66+
- ipdb

docs/quickstart.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Simple example (An ERP demo)
2+
3+
```python
4+
5+
```
6+
7+
---
8+
9+
## *Flexible target definition*
10+
11+
```python
12+
13+
```

docs/quickstart_template.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Simple example (An RSPV demo)
2+
& rsvp.py
3+
4+
---
5+
6+
## *Visual Experiment*
7+
& EXAMPLE -- Visual Experiment.py
8+
9+
## *Auditory Experiment*
10+
& EXAMPLE -- Auditory Experiment.py

0 commit comments

Comments
 (0)