Skip to content

Commit 5f6c29d

Browse files
committed
Merge branch 'release/v0.3.5'
2 parents 568a010 + ce51ce5 commit 5f6c29d

File tree

139 files changed

+12398
-10762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+12398
-10762
lines changed

.travis.yml

+19-21
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,48 @@ language: python
22
dist: trusty
33
python:
44
- "3.6"
5-
before_script:
6-
- "export DISPLAY=:99.0"
7-
- "sh -e /etc/init.d/xvfb start"
8-
- sleep 3 # give xvfb some time to start
5+
before_install:
6+
# Fix screen resolution to 1280x1024x16 :
7+
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
98
install:
109
- pushd $PWD
1110
# ------------------- PYTHON ENVIRONNEMENT -------------------
1211
# Deactivate travis environnement :
1312
- deactivate
14-
# We do this conditionally because it saves us some downloading if the
15-
# version is the same.
16-
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
17-
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
18-
else
19-
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
20-
fi
13+
# Miniconda installation :
14+
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
2115
- bash miniconda.sh -b -p $HOME/miniconda
2216
- export PATH="$HOME/miniconda/bin:$PATH"
2317
- hash -r
2418
- conda config --set always_yes yes --set changeps1 no
2519
- conda update -q conda
26-
# Useful for debugging any issues with conda
2720
- conda info -a
2821

29-
# Replace dep1 dep2 ... with your dependencies
22+
# Install dependencies :
3023
- conda create -q -n testenv python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib pip
3124
- source activate testenv
32-
- pip install mne
33-
- pip install nibabel
34-
- pip install setuptools
35-
- pip install nose
36-
- pip install PyOpenGL PyOpenGL_accelerate
37-
- pip install codecov
38-
- pip install pytest pytest-cov
25+
- pip install mne nibabel setuptools PyOpenGL PyOpenGL_accelerate codecov pytest pytest-cov
3926
# ------------------- VISPY -------------------
4027
- cd ../
28+
# Install the developper version of VisPy :
4129
- pip install -e git+https://github.com/vispy/vispy#egg=vispy-dev
4230
- cd visbrain/
4331
# ------------------- VISBRAIN -------------------
4432
- pip install -e .
45-
script: bash build_install.sh
33+
before_script:
34+
- "export DISPLAY=:99.0"
35+
- "sh -e /etc/init.d/xvfb start"
36+
- sleep 3 # give xvfb some time to start
37+
script: py.test --cov --verbose
4638
cache:
4739
apt: true
4840
notifications:
4941
email: false
5042
after_success:
5143
- codecov
44+
45+
# screenshot tests are really slow on travis... but installing image librairies
46+
# does't fix it.
47+
# before_install:
48+
# - sudo apt-get -qq install libfreetype6-dev libjpeg-turbo-progs
49+
# sudo: required

MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ include visbrain/sleep/sleep_icon.svg
1313
include visbrain/topo/topo_icon.svg
1414
include visbrain/colorbar/colorbar_icon.svg
1515
include visbrain/figure/figure_icon.svg
16+
17+
# Add url path :
18+
include visbrain/data_url.txt

README.rst

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
.. image:: https://travis-ci.org/EtienneCmb/visbrain.svg?branch=master
44
:target: https://travis-ci.org/EtienneCmb/visbrain
55

6+
.. image:: https://ci.appveyor.com/api/projects/status/fdxhhmpagms1so8l?svg=true
7+
:target: https://ci.appveyor.com/project/EtienneCmb/visbrain/branch/master
8+
69
.. image:: https://codecov.io/gh/EtienneCmb/visbrain/branch/master/graph/badge.svg
710
:target: https://codecov.io/gh/EtienneCmb/visbrain
811

appveyor.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
build: false
2+
3+
environment:
4+
matrix:
5+
- PYTHON_VERSION: 3.6
6+
MINICONDA: C:\Miniconda36-x64
7+
8+
init:
9+
- "ECHO %PYTHON_VERSION% %MINICONDA%"
10+
11+
install:
12+
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1'))
13+
# - ps: $screen_resolution = '1280x800'; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1'))
14+
# ------------------- PYTHON ENVIRONNEMENT -------------------
15+
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
16+
- conda config --set always_yes yes --set changeps1 no
17+
- conda update -q conda
18+
- conda info -a
19+
- "conda create -q -n testenv python=%PYTHON_VERSION% numpy scipy matplotlib pip"
20+
# Activate testing environnement :
21+
- activate testenv
22+
# Install dependencies :
23+
- pip install mne nibabel setuptools PyOpenGL PyOpenGL_accelerate pytest pytest-cov
24+
# ------------------- VISPY -------------------
25+
- cd ../
26+
- pip install -e git+https://github.com/vispy/vispy#egg=vispy-dev
27+
- ls
28+
- cd visbrain/
29+
# ------------------- VISBRAIN -------------------
30+
- pip install -e .
31+
32+
test_script:
33+
- py.test --cov --verbose

build_install.sh

-3
This file was deleted.

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@
8282
# built documents.
8383
#
8484
# The short X.Y version.
85-
version = '0.3.4'
85+
version = '0.3.5'
8686
# The full version, including alpha/beta/rc tags.
87-
release = '0.3.4'
87+
release = '0.3.5'
8888

8989
# The language for content autogenerated by Sphinx. Refer to documentation
9090
# for a list of supported languages.

docs/figure.rst

+16-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,18 @@ First, you will need to create a Figure objects with the files to load, titles,
8989
* :ref:`colorbar_to_axis` : add a colorbar to a specific axis
9090
* :ref:`shared_colorbar` : add a shared colorbar
9191

92-
.. autoclass:: visbrain.figure.figure.Figure
92+
.. currentmodule:: visbrain.figure.figure
93+
94+
.. autoclass:: Figure
95+
96+
.. rubric:: Methods
97+
98+
.. autosummary::
99+
~Figure.show
100+
~Figure.save
101+
~Figure.colorbar_to_axis
102+
~Figure.shared_colorbar
103+
93104

94105
Methods
95106
^^^^^^^
@@ -99,24 +110,24 @@ Methods
99110
show
100111
~~~~
101112

102-
.. automethod:: visbrain.figure.Figure.show
113+
.. automethod:: Figure.show
103114

104115
.. _save:
105116

106117
save
107118
~~~~
108-
.. automethod:: visbrain.figure.Figure.save
119+
.. automethod:: Figure.save
109120

110121
.. _colorbar_to_axis:
111122

112123
colorbar_to_axis
113124
~~~~~~~~~~~~~~~~
114125

115-
.. automethod:: visbrain.figure.Figure.colorbar_to_axis
126+
.. automethod:: Figure.colorbar_to_axis
116127

117128
.. _shared_colorbar:
118129

119130
shared_colorbar
120131
~~~~~~~~~~~~~~~
121132

122-
.. automethod:: visbrain.figure.Figure.shared_colorbar
133+
.. automethod:: Figure.shared_colorbar

docs/index.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
.. image:: https://travis-ci.org/EtienneCmb/visbrain.svg?branch=master
22
:target: https://travis-ci.org/EtienneCmb/visbrain
33

4+
.. image:: https://ci.appveyor.com/api/projects/status/fdxhhmpagms1so8l?svg=true
5+
:target: https://ci.appveyor.com/project/EtienneCmb/visbrain/branch/master
6+
47
.. image:: https://codecov.io/gh/EtienneCmb/visbrain/branch/master/graph/badge.svg
58
:target: https://codecov.io/gh/EtienneCmb/visbrain
69

@@ -69,14 +72,14 @@ Finally, install Visbrain :
6972

7073
.. code-block:: shell
7174
72-
pip install visbain
75+
pip install visbrain
7376
7477
Develop mode
7578
============
7679

7780
.. code-block:: shell
7881
79-
git clone git@github.com:EtienneCmb/visbrain.git visbrain/
82+
git clone https://github.com/EtienneCmb/visbrain.git visbrain/
8083
cd visbrain/
8184
pip install -r requirements.txt
8285
python setup.py develop
64.2 KB
Loading
187 KB
Loading
204 KB
Loading
162 KB
Loading
391 KB
Loading

docs/topo.rst

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Main features
2424

2525
* **Display topographic map**
2626
* Find coordinates according to channel names
27+
* Add connectivity edges
2728
* Support multiple coordinate systems
2829
* Highly controllable colorbar
2930
* **Grid representation**

examples/brain/01_cross_sections_and_volume.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
99
.. image:: ../../picture/picbrain/ex_crossec_and_volume.png
1010
"""
11-
import os
1211
from visbrain import Brain
13-
from visbrain.io import read_nifti
12+
from visbrain.io import read_nifti, download_file
1413

1514
"""Import the volume and the associated affine transformation
1615
"""
17-
volume_name = 'GG-853-WM-0.7mm'
18-
path_to_nifti = os.getenv("HOME")
19-
file_nifti = 'GG-853-WM-0.7mm.nii.gz'
20-
path = os.path.join(path_to_nifti, file_nifti)
21-
data, header, tf = read_nifti(path)
16+
volume_name = 'GG-853-WM-0.7mm.nii.gz'
17+
18+
"""Download the file.
19+
"""
20+
download_file(volume_name)
21+
data, header, tf = read_nifti(volume_name)
2222

2323
vb = Brain()
2424

examples/brain/02_add_brain_template.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
from visbrain import Brain
1818
from visbrain.utils import (add_brain_template, remove_brain_template)
19+
from visbrain.io import download_file
1920

21+
"""Download the brain template. Use either 'WhiteMatter', 'Inflated' or
22+
'Sphere'
2023
"""
21-
Define path to the template and load it. By default, the path is set to
22-
~/home/Templates/ so you have to adapt it.
23-
"""
24-
path_to_file = os.path.join(*(os.getenv("HOME"), 'Templates',
25-
'WhiteMatter.npz'))
26-
mat = np.load(path_to_file)
24+
template = 'WhiteMatter'
25+
download_file(template + '.npz')
26+
mat = np.load(template + '.npz')
2727

2828
"""
2929
Get variables for defining a new template. Vertices are nodes connected by the
@@ -39,16 +39,16 @@
3939
Add the template to visbrain. After adding this template, it will always be
4040
accessible unless you use the remove_brain_template() function
4141
"""
42-
add_brain_template('WhiteMatter', vert, faces, norm, lr_index)
42+
add_brain_template(template, vert, faces, norm, lr_index)
4343

4444
"""
4545
Open the interface and select the added template
4646
"""
47-
vb = Brain(a_template='WhiteMatter')
47+
vb = Brain(a_template=template)
4848
print('Brain templates : ', vb.brain_list())
4949
vb.show()
5050

5151
"""
5252
Finally, and this is not a necessity, remove the template
5353
"""
54-
remove_brain_template('WhiteMatter')
54+
remove_brain_template(template)

examples/brain/03_sources.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@
99
which is defined as the number of contributing sources per vertex.
1010
1111
Download source's coordinates (xyz_sample.npz) :
12-
https://drive.google.com/open?id=0B6vtJiCQZUBvSFJvaTFSRDJvMEE
12+
https://www.dropbox.com/s/whogfxutyxoir1t/xyz_sample.npz?dl=1
1313
1414
.. image:: ../../picture/picbrain/ex_sources.png
1515
"""
16-
from visbrain import Brain
1716
import numpy as np
1817

18+
from visbrain import Brain
19+
from visbrain.io import download_file
20+
1921
# Define a empty dictionnary :
2022
kwargs = {}
2123

2224
"""
2325
Load the xyz coordinates and corresponding subject name
2426
"""
27+
download_file('xyz_sample.npz')
2528
mat = np.load('xyz_sample.npz')
2629
kwargs['s_xyz'], subjects = mat['xyz'], mat['subjects']
2730

examples/brain/04_connectivity.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@
66
and connect them.
77
88
Download source's coordinates (xyz_sample.npz) :
9-
https://drive.google.com/open?id=0B6vtJiCQZUBvSFJvaTFSRDJvMEE
9+
https://www.dropbox.com/s/whogfxutyxoir1t/xyz_sample.npz?dl=1
1010
1111
.. image:: ../../picture/picbrain/ex_connectivity.png
1212
"""
1313
from __future__ import print_function
1414
import numpy as np
15+
1516
from visbrain import Brain
17+
from visbrain.io import download_file
1618

1719
# Create an empty kwargs dictionnary :
1820
kwargs = {}
1921

2022
# ____________________________ DATA ____________________________
2123

2224
# Load the xyz coordinates and corresponding subject name :
25+
download_file('xyz_sample.npz')
2326
mat = np.load('xyz_sample.npz')
2427
s_xyz, subjects = mat['xyz'], mat['subjects']
2528

examples/brain/05_region_of_interest.py

+3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
import numpy as np
2121

2222
from visbrain import Brain
23+
from visbrain.io import download_file
2324

2425
# Load thalamus sources :
26+
download_file('thalamus.txt')
2527
s_xyz = np.loadtxt('thalamus.txt')
2628
# Load alpha power. In fact, the PX.npy contains the power across several time
2729
# windows. So we take the mean across time :
30+
download_file('Px.npy')
2831
s_data = np.load('Px.npy').mean(1) * 10e26
2932

3033
# Define a Brain instance :

examples/brain/06_add_time_series.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
time-series can then be controlled from the GUI in the Sources/Time-series tab.
77
88
Download source's coordinates (xyz_sample.npz) :
9-
https://drive.google.com/open?id=0B6vtJiCQZUBvSFJvaTFSRDJvMEE
9+
https://www.dropbox.com/s/whogfxutyxoir1t/xyz_sample.npz?dl=1
1010
1111
.. image:: ../../picture/picbrain/ex_time_series.png
1212
"""
13-
from visbrain import Brain
1413
import numpy as np
1514

15+
from visbrain import Brain
16+
from visbrain.io import download_file
17+
1618
# Load the xyz coordinates and corresponding subject name :
19+
download_file('xyz_sample.npz')
1720
s_xyz = np.load('xyz_sample.npz')['xyz']
1821
s_xyz = s_xyz[4::25, ...]
1922
s_text = [str(k) for k in range(s_xyz.shape[0])]

examples/brain/07_add_pictures.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
pictures can then be controlled from the GUI in the Sources/Pictures tab.
77
88
Download source's coordinates (xyz_sample.npz) :
9-
https://drive.google.com/open?id=0B6vtJiCQZUBvSFJvaTFSRDJvMEE
9+
https://www.dropbox.com/s/whogfxutyxoir1t/xyz_sample.npz?dl=1
1010
1111
.. image:: ../../picture/picbrain/ex_pictures.png
1212
"""
13-
from visbrain import Brain
1413
import numpy as np
1514

15+
from visbrain import Brain
16+
from visbrain.io import download_file
17+
1618
kwargs = {}
1719
# Load the xyz coordinates and corresponding subject name :
20+
download_file('xyz_sample.npz')
1821
s_xyz = np.load('xyz_sample.npz')['xyz']
1922
s_xyz = s_xyz[4::10, ...]
2023
kwargs['s_text'] = [str(k) for k in range(s_xyz.shape[0])]

0 commit comments

Comments
 (0)