-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtests_consensus.py
76 lines (58 loc) · 1.87 KB
/
tests_consensus.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# tests for narps code
# - currently these are all just smoke tests
import pytest
import os
import pandas
from narps import Narps
from ConsensusAnalysis import run_ttests, mk_figures
from MakeSupplementaryFigure1 import mk_supp_figure1,\
get_all_metadata
from ClusterImageCorrelation import\
cluster_image_correlation
from ThreshVoxelStatistics import get_thresh_voxel_stats
from MakeCombinedClusterFigures import\
make_combined_cluster_figures
# Use a fixed base dir so that we can
# access the results as a circleci artifact
@pytest.fixture(scope="session")
def narps():
basedir = '/tmp/data'
assert os.path.exists(basedir)
narps = Narps(basedir)
narps.load_data()
narps.metadata = pandas.read_csv(
os.path.join(narps.dirs.dirs['metadata'], 'all_metadata.csv'))
return(narps)
# tests
# ConsensusAnalysis
def test_consensus_analysis(narps):
logfile = os.path.join(
narps.dirs.dirs['logs'],
'ConsensusAnalysis.txt')
narps.dirs.dirs['consensus'] = os.path.join(
narps.dirs.dirs['output'],
'consensus_analysis')
if not os.path.exists(narps.dirs.dirs['consensus']):
os.mkdir(narps.dirs.dirs['consensus'])
run_ttests(narps, logfile)
mk_figures(narps, logfile)
# MakeSupplementaryFigure1
def test_mk_suppfigure1(narps):
metadata = get_all_metadata(narps)
mk_supp_figure1(narps, metadata)
# compute cluster similarity
def test_cluster_image_correlations(narps):
cluster_image_correlation(
narps.basedir,
'TomEtAl',
['Task', 'Gain', 'Loss'])
cluster_image_correlation(
narps.basedir,
'NARPS_mean',
['Task'])
# compute thresh statisics
def test_get_thresh_voxel_stats(narps):
get_thresh_voxel_stats(narps.basedir)
# make combined figures
def test_make_combined_cluster_figures(narps):
make_combined_cluster_figures(narps.basedir)