-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtests_ale.py
50 lines (40 loc) · 1.21 KB
/
tests_ale.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
# tests for narps code
# - currently these are all just smoke tests
import pytest
import os
import pandas
from narps import Narps
from MetaAnalysis import extract_peak_coordinates,\
run_ALE, save_results,\
make_figures, make_combined_figure,\
get_thresholded_Z_maps
# 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'))
_ = narps.dirs.get_output_dir('ALE')
return(narps)
# tests
# run ALE meta-analysis
def test_run_ALE(narps):
_ = narps.dirs.get_output_dir('ALE')
narps = get_thresholded_Z_maps(
narps)
# extract peak coordinates
for hyp in range(1, 10):
ds_dict = extract_peak_coordinates(
narps,
hyp)
# Performing ALE
res = run_ALE(ds_dict, hyp, narps)
images = save_results(hyp, res, narps)
make_figures(narps, hyp, images)
def test_combined_figure(narps):
# make a figure with all hypotheses
make_combined_figure(narps)