-
Notifications
You must be signed in to change notification settings - Fork 2
/
__init__.py
47 lines (43 loc) · 1.88 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!usr/bin/env python
import os
import glob
modules = glob.glob(os.path.dirname(__file__)+"/*.py")
__all__ = [ os.path.basename(f)[:-3] for f in modules]
_package_dir = os.path.dirname(os.path.realpath(__file__))
__version__ = '0.5.5'
def load_example_data(name='elife'):
""" load example data from elife (2015) or jneuro (2018) publications
::Arguments::
name (str): 'elife', 'elife_pro', or 'jneuro'
::Returns::
pandas dataframe with behavioral data from elife or jneuro pubs
"""
import pandas as pd
if 'elife' in name:
data_dir = os.path.join(_package_dir, 'datasets/eLife15')
if 'pro' in name:
data_fpath = os.path.join(data_dir, 'pro_stop_data.csv')
else:
# 're_stop_data.csv'
data_fpath = os.path.join(data_dir, 're_stop_data.csv') #'elife2015_example_data.csv')
elif name == 'jneuro':
data_dir = os.path.join(_package_dir, 'datasets/jNeuro18')
data_fpath = os.path.join(data_dir, 'adaptive_ss_behavior.csv')
return pd.read_csv(data_fpath).copy()
def load_dpm_animation():
import io, base64
from IPython.display import HTML
_examples_dir = os.path.join(_package_dir, 'docs/examples')
mov_fpath = os.path.join(_examples_dir, 'anim.mp4')
video = io.open(mov_fpath, 'r+b').read()
encoded = base64.b64encode(video)
data='''<video width="50%" alt="test" loop=1 controls> <source src="data:video/mp4; base64,{0}" type="video/mp4" /> </video>'''.format(encoded.decode('ascii'))
return HTML(data=data)
def style_notebook():
from IPython.core.display import HTML
# g3link = "(https://www.github.com/dunovank/jupyter-themes)"
#print("Notebook Theme: Grade3\n{}".format(g3link))
_styles_dir = os.path.join(_package_dir, 'styles')
style = os.path.join(_styles_dir, 'custom.css')
csscontent = open(style, "r").read()
return HTML(csscontent)