Skip to content

Commit 4598f5d

Browse files
committed
added coveralls to travisci
1 parent b7ea6f0 commit 4598f5d

13 files changed

+123
-1
lines changed

.coverage

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/lukechang/Github/neurolearn/nltools/__init__.py": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18], "/Users/lukechang/Github/neurolearn/nltools/data.py": [1025, 1026, 171, 6, 519, 11, 12, 13, 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, 44, 179, 58, 60, 61, 614, 70, 71, 672, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 92, 93, 97, 98, 651, 101, 102, 615, 104, 108, 621, 110, 625, 626, 531, 628, 629, 630, 632, 121, 654, 123, 636, 126, 639, 128, 704, 642, 645, 648, 649, 908, 139, 140, 175, 142, 655, 656, 145, 146, 147, 148, 622, 151, 664, 665, 666, 667, 668, 669, 671, 653, 162, 163, 165, 166, 679, 168, 170, 686, 172, 174, 687, 688, 689, 690, 627, 180, 181, 183, 184, 186, 543, 188, 189, 190, 192, 705, 909, 910, 200, 177, 202, 546, 717, 721, 213, 214, 633, 217, 719, 634, 928, 228, 229, 230, 232, 243, 245, 254, 256, 640, 265, 215, 272, 274, 275, 276, 691, 674, 285, 296, 299, 302, 305, 306, 307, 308, 309, 310, 311, 312, 825, 314, 315, 319, 320, 321, 322, 323, 324, 326, 328, 652, 845, 846, 141, 848, 850, 339, 340, 853, 342, 313, 864, 865, 486, 657, 658, 915, 660, 381, 383, 896, 149, 833, 396, 834, 398, 400, 835, 917, 918, 919, 410, 413, 416, 417, 930, 683, 420, 423, 426, 429, 430, 431, 432, 433, 434, 437, 439, 444, 445, 446, 447, 448, 449, 450, 451, 453, 518, 460, 461, 462, 528, 661, 466, 472, 474, 847, 677, 592, 998, 487, 488, 491, 496, 851, 502, 503, 1016, 529, 507, 682], "/Users/lukechang/Github/neurolearn/nltools/version.py": [2, 4], "/Users/lukechang/Github/neurolearn/nltools/utils.py": [1, 3, 4, 5, 7, 8, 9, 10, 11, 13, 15, 17, 19, 21, 39, 40, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 66, 67, 68, 69, 94, 96, 103, 108, 116, 126], "/Users/lukechang/Github/neurolearn/nltools/mask.py": [6, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 34, 42, 43, 45, 53, 55, 56, 58, 59, 60, 61, 64, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 78, 82, 106], "/Users/lukechang/Github/neurolearn/nltools/analysis.py": [1, 522, 599, 525, 526, 527, 600, 18, 19, 20, 533, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 42, 43, 557, 605, 560, 547, 563, 564, 565, 568, 64, 66, 71, 584, 73, 74, 587, 76, 78, 79, 81, 82, 83, 85, 598, 87, 88, 601, 90, 91, 604, 93, 94, 607, 608, 609, 611, 634, 617, 619, 530, 532, 624, 625, 114, 531, 628, 629, 630, 631, 632, 121, 122, 123, 124, 125, 128, 129, 133, 136, 138, 139, 140, 141, 142, 145, 146, 149, 150, 151, 152, 153, 156, 157, 161, 162, 164, 165, 167, 168, 169, 534, 549, 626, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 191, 544, 603, 586, 545, 204, 546, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 225, 226, 227, 230, 231, 232, 233, 234, 235, 236, 237, 602, 258, 269, 272, 275, 279, 280, 282, 293, 296, 297, 299, 300, 302, 305, 306, 309, 311, 312, 315, 316, 317, 318, 320, 332, 335, 338, 342, 344, 346, 347, 348, 350, 633, 362, 363, 364, 366, 541, 548, 627, 542, 432, 543, 445, 447, 448, 451, 454, 455, 458, 459, 460, 461, 462, 465, 467, 468, 484, 487, 491, 494, 496, 504, 505, 506, 507, 508, 509, 510, 511], "/Users/lukechang/Github/neurolearn/nltools/pbs_job.py": [6, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 21, 22, 23, 25, 27, 28, 29, 30, 31, 32, 33, 35, 36, 38, 39, 40, 42, 43, 285, 202, 75, 209, 342, 220, 94, 102, 118, 250], "/Users/lukechang/Github/neurolearn/nltools/plotting.py": [6, 8, 9, 10, 12, 13, 14, 16, 39, 50, 51, 54, 55, 56, 57, 60, 91, 103, 104, 106, 107, 108, 109, 111], "/Users/lukechang/Github/neurolearn/nltools/searchlight.py": [], "/Users/lukechang/Github/neurolearn/nltools/interfaces.py": [], "/Users/lukechang/Github/neurolearn/nltools/cross_validation.py": [2, 11, 12, 13, 15, 144, 17, 18, 20, 202, 155, 160, 146, 42, 44, 173, 46, 47, 48, 49, 53, 54, 55, 45, 57, 58, 187, 188, 189, 63, 192, 193, 203, 74, 75, 77, 56, 217, 16, 98, 59, 100, 60, 109, 61, 114, 191, 124, 170, 127], "/Users/lukechang/Github/neurolearn/nltools/stats.py": [1, 5, 7, 8, 9, 10, 11, 140, 13, 17, 18, 19, 20, 21, 22, 23, 25, 167, 42, 179, 65, 77, 79, 82, 86, 87, 88, 93, 94, 95, 96, 100, 102], "/Users/lukechang/Github/neurolearn/nltools/simulator.py": [6, 8, 9, 10, 13, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 41, 43, 44, 45, 46, 48, 49, 51, 52, 56, 58, 59, 64, 65, 68, 94, 101, 103, 104, 106, 107, 108, 109, 112, 114, 121, 123, 124, 125, 128, 131, 133, 139, 142, 143, 144, 146, 154, 157, 158, 159, 160, 163, 164, 165, 166, 167, 171, 186, 187, 188, 189, 190, 191, 194, 197, 200, 201, 202, 205, 206, 207, 208, 211, 212, 213, 216, 217, 218, 221, 222, 223, 224, 225, 226, 228, 229, 230, 231, 233, 312], "/Users/lukechang/Github/neurolearn/nltools/pipelines.py": []}}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ nltools.egg-info
77
build/
88
dist/
99
.cache/
10+
htmlcov
1011

1112
# Logs and databases #
1213
######################

.travis.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ install:
1717
- conda create -q -n testenv python=$TRAVIS_PYTHON_VERSION pip pytest numpy pandas scipy matplotlib scikit-learn
1818
- source activate testenv
1919
- pip install -r requirements.txt
20+
- pip install git+https://github.com/neurolearn/pyneurovault_upload
21+
- pip install python-coveralls
2022
- python setup.py install
2123

22-
script: py.test
24+
script: coverage run --source nltools -m py.test
25+
26+
after_success:
27+
- coveralls

examples/Analysis/README.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Neuroimaging Analysis Examples
2+
------------------------------
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""
2+
============================================================
3+
Example of two level univariate regression on simulated data
4+
============================================================
5+
This example simulates data according to a very simple sketch of brain
6+
imaging data and applies a standard two-level univariate GLM to identify
7+
significant voxels.
8+
"""
9+
10+
__author__ = ["Luke Chang"]
11+
__license__ = "MIT"
12+
13+
print(__doc__)
14+
15+
from time import time
16+
17+
import glob
18+
import numpy as np
19+
import pandas as pd
20+
import seaborn as sns
21+
import os
22+
import sys
23+
from nltools.simulator import Simulator
24+
from nltools.utils import get_resource_path, get_anatomical
25+
from nltools.analysis import Predict, Roc
26+
from nltools.data import Brain_Data
27+
from nltools.stats import threshold
28+
from nltools.mask import create_sphere
29+
import matplotlib.pyplot as plt
30+
import shutil
31+
import tempfile
32+
33+
tmp_dir = os.path.join(tempfile.gettempdir(), str(os.times()[-1]))
34+
35+
###############################################################################
36+
# Create data
37+
38+
tic = time() #Start Timer
39+
40+
sim = Simulator()
41+
r=10
42+
sigma = .5
43+
cor = .8
44+
cov = .6
45+
n_trials = 10
46+
n_subs = 5
47+
s1 = create_sphere([41, 64, 55], radius=r)
48+
sim.create_cov_data(cor, cov, sigma, mask=s1, reps = n_trials, n_sub = n_subs, output_dir = tmp_dir)
49+
print 'Simulate Data: Elapsed: %.2f seconds' % (time() - tic) #Stop timer
50+
51+
###############################################################################
52+
# Load data
53+
54+
tic = time() #Start Timer
55+
56+
y=pd.read_csv(os.path.join(tmp_dir,'y.csv'),header=None,index_col=None).T
57+
dat = Brain_Data(data=os.path.join(tmp_dir,'maskdata_cor0.8_cov0.6_sigma0.5.nii.gz'),Y=y)
58+
dat.X = pd.DataFrame({'Intercept':np.ones(len(dat.Y)),'X1':np.array(dat.Y).flatten()},index=None)
59+
holdout = pd.read_csv(os.path.join(tmp_dir,'rep_id.csv'),header=None,index_col=None).T
60+
61+
print 'Load Data: Elapsed: %.2f seconds' % (time() - tic) #Stop timer
62+
63+
64+
###############################################################################
65+
# Run Regression separately for each subject
66+
67+
tic = time() #Start Timer
68+
69+
start = 0
70+
stop = n_trials
71+
dat.X = pd.DataFrame({'Intercept':np.ones(len(dat.Y)),'X1':np.array(dat.Y).flatten()},index=None)
72+
all = dat.empty()
73+
for i in xrange(n_subs):
74+
sub_out = dat[start:stop].regress()
75+
start = start + n_trials
76+
stop = stop + n_trials
77+
tmp = sub_out['beta'].empty(data=False)[1]
78+
all = all.append(tmp)
79+
print 'Regression: Elapsed: %.2f seconds' % (time() - tic) # Stop timer
80+
81+
###############################################################################
82+
# Run One sample t-test
83+
84+
tic = time() #Start Timer
85+
86+
l2 = all.ttest(threshold_dict={'fdr':.05})
87+
l2['thr_t'].plot()
88+
print 'T-Test: Elapsed: %.2f seconds' % (time() - tic) # Stop timer
89+
90+
shutil.rmtree(tmp_dir, ignore_errors=True) # Delete Data
91+
92+
plt.show()

examples/README.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
nltools usage examples
2+
======================
3+
4+
.. warning::
5+
6+
If you want to run the examples, make sure you execute them in a directory
7+
where you have write permissions, or you copy the examples into such a
8+
directory. If you install nltools manually, make sure you have followed
9+
:ref:`the instructions <installation>`.
10+
11+
12+
.. contents:: **Contents**
13+
:local:
14+
:depth: 1
15+
16+
General examples
17+
----------------
18+
19+
General-purpose and introductory examples for nltools.

pytest.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
norecursedirs = env
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)