Skip to content
Snippets Groups Projects
Commit 58945831 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Test FEATImage f-test accessors

parent 494651d4
No related branches found
No related tags found
No related merge requests found
...@@ -288,7 +288,8 @@ def make_mock_feat_analysis(featdir, ...@@ -288,7 +288,8 @@ def make_mock_feat_analysis(featdir,
copes=True, copes=True,
zstats=True, zstats=True,
residuals=True, residuals=True,
clustMasks=True): clustMasks=True,
zfstats=True):
if xform is None: if xform is None:
xform = np.eye(4) xform = np.eye(4)
...@@ -346,6 +347,11 @@ def make_mock_feat_analysis(featdir, ...@@ -346,6 +347,11 @@ def make_mock_feat_analysis(featdir,
otherFiles .extend(files) otherFiles .extend(files)
otherShapes.extend([shape] * len(files)) otherShapes.extend([shape] * len(files))
if zfstats:
files = glob.glob(op.join(featdir, 'stats', 'zfstat*nii.gz'))
otherFiles .extend(files)
otherShapes.extend([shape] * len(files))
if residuals: if residuals:
files = glob.glob(op.join(featdir, 'stats', 'res4d.nii.gz')) files = glob.glob(op.join(featdir, 'stats', 'res4d.nii.gz'))
otherFiles .extend(files) otherFiles .extend(files)
......
...@@ -88,7 +88,8 @@ def test_FEATImage_attributes(): ...@@ -88,7 +88,8 @@ def test_FEATImage_attributes():
copes=False, copes=False,
zstats=False, zstats=False,
residuals=False, residuals=False,
clustMasks=False) clustMasks=False,
zfstats=False)
else: else:
featdir = op.join(datadir, featdir) featdir = op.join(datadir, featdir)
...@@ -100,6 +101,7 @@ def test_FEATImage_attributes(): ...@@ -100,6 +101,7 @@ def test_FEATImage_attributes():
design = featdesign.FEATFSFDesign(featdir, settings) design = featdesign.FEATFSFDesign(featdir, settings)
desmat = design.getDesign() desmat = design.getDesign()
evnames = [ev.title for ev in design.getEVs()] evnames = [ev.title for ev in design.getEVs()]
ftests = featanalysis.loadFTests(featdir)
contrastnames, contrasts = featanalysis.loadContrasts(featdir) contrastnames, contrasts = featanalysis.loadContrasts(featdir)
assert np.all(np.isclose(fi.shape, shape)) assert np.all(np.isclose(fi.shape, shape))
...@@ -115,8 +117,10 @@ def test_FEATImage_attributes(): ...@@ -115,8 +117,10 @@ def test_FEATImage_attributes():
assert fi.numEVs() == desmat.shape[1] assert fi.numEVs() == desmat.shape[1]
assert fi.evNames() == evnames assert fi.evNames() == evnames
assert fi.numContrasts() == len(contrasts) assert fi.numContrasts() == len(contrasts)
assert fi.numFTests() == len(ftests)
assert fi.contrastNames() == contrastnames assert fi.contrastNames() == contrastnames
assert fi.contrasts() == contrasts assert fi.contrasts() == contrasts
assert fi.ftests() == ftests
assert np.all(np.isclose(fi.getDesign(), desmat)) assert np.all(np.isclose(fi.getDesign(), desmat))
assert fi.thresholds() == featanalysis.getThresholds(settings) assert fi.thresholds() == featanalysis.getThresholds(settings)
...@@ -153,9 +157,10 @@ def test_FEATImage_imageAccessors(): ...@@ -153,9 +157,10 @@ def test_FEATImage_imageAccessors():
shape4D = shape shape4D = shape
shape = shape4D[:3] shape = shape4D[:3]
fi = featimage.FEATImage(featdir) fi = featimage.FEATImage(featdir)
nevs = fi.numEVs() nevs = fi.numEVs()
ncons = fi.numContrasts() ncons = fi.numContrasts()
nftests = fi.numFTests()
# Testing the FEATImage internal cache # Testing the FEATImage internal cache
for i in range(2): for i in range(2):
...@@ -166,6 +171,9 @@ def test_FEATImage_imageAccessors(): ...@@ -166,6 +171,9 @@ def test_FEATImage_imageAccessors():
assert fi.getCOPE( con).shape == shape assert fi.getCOPE( con).shape == shape
assert fi.getZStats( con).shape == shape assert fi.getZStats( con).shape == shape
assert fi.getClusterMask(con).shape == shape assert fi.getClusterMask(con).shape == shape
for ft in range(nftests):
assert fi.getZFStats( ft).shape == shape
assert fi.getFClusterMask(ft).shape == shape
del fi del fi
fi = None fi = None
......
/NumWaves 2
/NumContrasts 1
/Matrix
1 1
/NumWaves 1
/NumContrasts 1
/Matrix
1
./cluster_mask_zfstat1.nii.gz
/NumWaves 1
/NumContrasts 1
/Matrix
1
./cope2.feat/stats/zfstat1.nii.gz
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment