Skip to content

Commit

Permalink
add documents
Browse files Browse the repository at this point in the history
  • Loading branch information
ray306 committed Mar 5, 2018
1 parent bba4f72 commit db98675
Show file tree
Hide file tree
Showing 12 changed files with 390 additions and 17 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# EasyEEG
## Concise Agile Flexible EEG data analyis toolbox

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.
17 changes: 1 addition & 16 deletions doc.md → docs/api.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
Aim;
Simplifying the analysis
- For beginners: clear logics for the steps (least concepts);
- For data players (who want to check various aspects of data or to try various analysis algorithms): one-line code for each idea;
- For data players (who want to apply DIY analysis methods): plenty of low/high level functions for quickly building your own algorithm.
## Initialization

Advantages:
- 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.
- Applying EEG analysis method by one-line code. (ERP, topography, specturm, time-frequency, etc.)
- Applying advanced EEG analysis methods (clustering, classification, etc.)
- Beautiful ploting
- Plenty of basic and advanced APIs which can help to build your own analysis algorithm and to visualize the result.


---
# todo

---
# `Load data`
load_raw_eeg()
from_mne_epochs()
Expand Down
68 changes: 68 additions & 0 deletions docs/api_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
## Initialization
- **start**
---
## Stimulus
### *Position*
- **getPos**
### *Text*
- **drawText**
### *Shape*
- **drawRect**
- **drawCircle**
- **drawPoints**
- **drawLines**
### *Picture*
- **drawPic**
### *Sound*
- **loadSound**
- **loadManySound**
- **makeBeep**
- **makeNoise**
- **makeSound**
- **playSound**
- **playBusySound**
- **playFreeSound**
- **playAlterableSound**
- **toStereoArray**
- **changeVolume**
- **changePitch**
- **changeOnTracks**

### *Video*
- **loadVideo**
- **playVideo**
### *Display controller*
- **show**
- **clear**
- **getScreen**
---
## Response
### *Keyboard & Mouse & Joystick*
- **waitForResponse**
### *Sound Recorder*
- **environmentNoise**
- **recordSound**
---
## IO
### *Read*
- **readSetting**
- **readStimuli**
- **readDir**
### *Save*
- **saveResult**
### *Record the log*
- **log**
### *Send trigger*
- **sendTrigger**
---
## Other Scaffolds
- **textSlide**
- **getInput**
- **getSubjectID**
- **instruction**
- **alert**
- **alertAndGo**
- **alertAndQuit**
- **restTime**
- **normalProcedure**

File renamed without changes.
11 changes: 11 additions & 0 deletions docs/cookbook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Cookbook
---
## *Initiation*
```python
# coding:utf-8
import easyEEG
```

## *Load*

## *Save*
89 changes: 89 additions & 0 deletions docs/cookbook_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Cookbook
---
- Experiment Initiation
- Experiment Structure
- Visual
- Show text
- Show picture
- Show shape
- Video
- Auditory
- Play sound
- Sound Recording
- Response
- Scaffold functions
- Get external parameters
- Read or write file
- Send trigger
- Preload screen

---

## *Experiment Initiation*
```python
# coding:utf-8
from expy import * # Import the needed functions
start() # Initiate the experiment environment
```

## *Experiment Structure*
A standard experiment contains 3 levels:

- Run(Session)
- Block
- Trial
So we suggest that your code should have hierarchical structure, as the example below:
```python
from expy import *
start()

def trial(stim):
draw(stim)
show(1)

def block(trialList):
for stim in trialList:
trial(stim)

# run
for trialList in blockList:
block(trialList)
```

## *Visual*
### Show text
& show_text.py

### Show picture
& show_picture.py

### Show shape
& show_shape.py

## *Video*
& play_video.py

## *Auditory*
### Play sound
& play_sound.py

### *Sound Recording*
& sound_recording.py

## *Response*
& response.py

## *Scaffold functions*
& scaffold.py

## *Get external parameters*
& read_setting.py

## *Read or Write*
& io.py

## *Send trigger*
& send_trigger.py

## *Preload screen*
& preload.py
102 changes: 102 additions & 0 deletions docs/docs_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import re
import os

path = '../'

'quickstart_generator'
with open(path+'docs/quickstart_template.txt') as f:
template = f.readlines()

new_file = []
for l in template:
if l[:2] != '& ':
new_file.append(l)
else:
try:
with open('../test/'+l[2:].replace('\n',''), encoding='utf8') as f:
lines = f.readlines()

for ind,l in enumerate(lines):
if l[:18] == "from expy import *":
break

code = ''.join(lines[ind:])

new_file.append('\n```python\n%s\n```\n' %(code))
except:
print('cannnot read',file)


with open(path+'docs/quickstart.md','w+', encoding='utf8') as f:
f.writelines(new_file)

'cookbook_generator'
with open(path+'docs/cookbook_template.txt') as f:
template = f.readlines()

new_file = []
for l in template:
if l[:2] != '& ':
new_file.append(l)
else:
try:
with open('../test/'+l[2:].replace('\n',''), encoding='utf8') as f:
lines = f.readlines()

for ind,l in enumerate(lines):
if l[:18] == "from expy import *":
ind += 1
break

code = ''.join(lines[ind:])

new_file.append('\n```python\n%s\n```\n' %(code))
except:
print('cannnot read',file)


with open(path+'docs/cookbook.md','w+', encoding='utf8') as f:
f.writelines(new_file)

'api_generator'
with open(path+'docs/api_template.txt') as f:
template = f.readlines()

comments = dict()
for root, _dirs, files in os.walk(path):
for file in files:
if file[-3:]=='.py' and root[-4:] != 'test':
try:
with open(root+'\\'+file,encoding='utf8') as f:

lines = f.readlines()

defines = []
for ind,l in enumerate(lines):
if l[:4] == "def ":
defines.append([l,ind])

for define,ind in defines:
if lines[ind+1] == " '''\n":
f = re.search('def (.*?)\((.*)\)',define)
f_name = f.group(1)
f_args = f.group(2)
comments[f_name] = [f_args,'']
ind += 2
while lines[ind] != " '''\n":
comments[f_name][1] += (lines[ind][4:-1] + '\n')
ind += 1
except:
print('cannnot read',file)

new_file = []
for l in template:
if '- **' != l[:4]:
new_file.append(l)
else:
f_args,comm = comments[l[4:-3]]
new_file.append('\n- **%s(%s)**\n\n' %(l[4:-3],f_args))
new_file.append('\n```\n%s```\n\n' %(comm))

with open(path+'docs/api.md','w+', encoding='utf8') as f:
f.writelines(new_file)
66 changes: 66 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Overview

[![PyPI Version][pypi-v-image]][pypi-v-link]

[pypi-v-image]: https://img.shields.io/pypi/v/easyEEG.png
[pypi-v-link]: https://pypi.python.org/pypi/easyEEG

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.

**Highlights**:
Simplifying the analysis
- For beginners: clear logics for the steps (least concepts);
- For data players (who want to check various aspects of data or to try various analysis algorithms): one-line code for each idea;
- For data players (who want to apply DIY analysis methods): plenty of low/high level functions for quickly building your own algorithm.

Advantages:
- 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.
- Applying EEG analysis method by one-line code. (ERP, topography, specturm, time-frequency, etc.)
- Applying advanced EEG analysis methods (clustering, classification, etc.)
- Beautiful ploting
- Plenty of basic and advanced APIs which can help to build your own analysis algorithm and to visualize the result.

todo

**limitation**:

todo

---
## Documentation
See http://easyeeg.readthedocs.io/en/latest/ for introduction, tutorials, and reference manual.

---
# Installation instructions

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:

```
pip install easyEEG
```
or:
```
sudo pip install easyEEG
```

The command of getting update:
```
pip install --upgrade easyEEG --no-deps
```
or:
```
sudo pip install --upgrade easyEEG --no-deps
```

### *Required Dependencies*

- numpy
- pandas
- scipy
- matplotlib
- statsmodels
- seaborn
- mne
- permute
- tqdm
- ipdb
13 changes: 13 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Simple example (An ERP demo)

```python

```

---

## *Flexible target definition*

```python

```
10 changes: 10 additions & 0 deletions docs/quickstart_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Simple example (An RSPV demo)
& rsvp.py

---

## *Visual Experiment*
& EXAMPLE -- Visual Experiment.py

## *Auditory Experiment*
& EXAMPLE -- Auditory Experiment.py
Loading

0 comments on commit db98675

Please sign in to comment.