From 3d27104cc4ef0ecc7b534f6af81f2e2f0cf1ef78 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Wed, 15 Jul 2020 18:14:16 +0100 Subject: [PATCH] ENH: Regression test for film_gls (will fail until fsl/film!2 is merged) --- unit_tests/film_gls/design.con | 16 ++++++ unit_tests/film_gls/design.fts | 5 ++ unit_tests/film_gls/design_even.mat | 53 ++++++++++++++++++++ unit_tests/film_gls/design_odd.mat | 54 +++++++++++++++++++++ unit_tests/film_gls/feedsRun.autoregressive | 42 ++++++++++++++++ unit_tests/film_gls/roi_even.nii.gz | 3 ++ unit_tests/film_gls/roi_odd.nii.gz | 3 ++ 7 files changed, 176 insertions(+) create mode 100644 unit_tests/film_gls/design.con create mode 100644 unit_tests/film_gls/design.fts create mode 100644 unit_tests/film_gls/design_even.mat create mode 100644 unit_tests/film_gls/design_odd.mat create mode 100755 unit_tests/film_gls/feedsRun.autoregressive create mode 100644 unit_tests/film_gls/roi_even.nii.gz create mode 100644 unit_tests/film_gls/roi_odd.nii.gz diff --git a/unit_tests/film_gls/design.con b/unit_tests/film_gls/design.con new file mode 100644 index 0000000..b46cec2 --- /dev/null +++ b/unit_tests/film_gls/design.con @@ -0,0 +1,16 @@ +/ContrastName1 Generation +/ContrastName2 Shadowing +/ContrastName3 Mean +/ContrastName4 Shad > Gen +/ContrastName5 Gen > Shad +/NumWaves 4 +/NumContrasts 5 +/PPheights 2.498861e-01 2.406885e-01 1.254726e-01 2.252375e-01 2.252375e-01 +/RequiredEffect 1.395 1.303 1.165 1.333 1.333 + +/Matrix +1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 +0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 +1.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 +-1.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 +1.000000e+00 0.000000e+00 -1.000000e+00 0.000000e+00 diff --git a/unit_tests/film_gls/design.fts b/unit_tests/film_gls/design.fts new file mode 100644 index 0000000..b65a572 --- /dev/null +++ b/unit_tests/film_gls/design.fts @@ -0,0 +1,5 @@ +/NumWaves 5 +/NumContrasts 1 + +/Matrix +1 1 0 0 0 diff --git a/unit_tests/film_gls/design_even.mat b/unit_tests/film_gls/design_even.mat new file mode 100644 index 0000000..d3dd580 --- /dev/null +++ b/unit_tests/film_gls/design_even.mat @@ -0,0 +1,53 @@ +/NumWaves 4 +/NumPoints 50 +/Matrix +1.648834999999999884e-02 -3.726071999999999978e-03 -4.833967000000000125e-02 -1.963018999999999875e-03 +1.119840000000000071e-02 -3.639564000000000080e-03 -4.980388000000000176e-02 -1.761013999999999982e-03 +5.874693000000000276e-03 -3.561888999999999941e-03 -5.085856999999999878e-02 3.680828000000000138e-03 +5.319972999999999759e-04 -3.439620999999999911e-03 -4.143511999999999890e-02 1.017567000000000055e-01 +-4.756011000000000093e-03 -3.213473000000000111e-03 1.536263999999999963e-01 1.921240000000000100e-02 +-9.853109999999999993e-03 -2.989758999999999819e-03 -2.774908999999999883e-03 -9.302396999999999749e-02 +-1.489293000000000040e-02 -2.856495000000000128e-03 -3.159589000000000147e-02 6.295581999999999567e-02 +-1.992050000000000071e-02 -2.696741999999999802e-03 1.240711000000000036e-01 3.985261000000000359e-03 +-2.483733000000000121e-02 -2.466271999999999822e-03 -2.327842000000000106e-02 -5.903798999999999852e-02 +-2.959615000000000162e-02 -2.225098999999999914e-03 6.898188999999999883e-03 6.379331000000000584e-02 +-3.421665000000000123e-02 -1.957060999999999957e-03 1.050973000000000046e-01 -2.023018000000000038e-02 +-3.862000000000000155e-02 5.954985000000000139e-02 -3.314361999999999864e-02 -8.629162999999999417e-02 +7.960121000000000557e-02 6.756821999999999828e-02 -6.654564999999999786e-02 -1.346018000000000041e-02 +9.585565999999999531e-02 -6.029484999999999706e-02 -5.899767000000000206e-02 8.135866000000000278e-03 +-4.101391000000000064e-02 -8.127914999999999446e-02 -4.923609000000000319e-02 8.894826999999999595e-02 +-7.207805999999999935e-02 7.568362000000000353e-03 1.198999000000000037e-01 6.050200000000000022e-02 +-3.246686000000000016e-02 1.030601000000000017e-01 7.213057999999999970e-02 -8.124520000000000353e-02 +1.290009000000000017e-01 1.234730999999999980e-03 -4.204758000000000107e-02 -6.670086999999999544e-02 +-2.872722000000000123e-02 -6.461886000000000019e-02 -6.029729999999999812e-02 -4.615990999999999844e-03 +-5.131997000000000121e-03 6.184020999999999962e-02 -5.023683000000000315e-02 8.354531999999999584e-03 +9.098035000000000150e-02 8.121815000000000284e-02 -4.258347999999999994e-02 4.637561000000000114e-03 +1.570882999999999863e-01 5.537315000000000119e-03 -3.998582999999999998e-02 1.284144999999999991e-03 +1.044230000000000019e-01 -4.815475999999999784e-02 -3.904910999999999799e-02 2.360751999999999924e-04 +6.108828000000000175e-02 1.124179999999999971e-02 -3.855113999999999763e-02 -6.901035000000000242e-05 +1.255222000000000004e-01 -5.403618000000000310e-02 -3.822646999999999851e-02 8.235082999999999986e-02 +-4.584987000000000090e-02 -1.079753999999999992e-01 1.271100000000000008e-01 7.520477000000000412e-02 +-9.599312000000000122e-02 -1.721912999999999916e-02 1.125185999999999964e-01 1.300007000000000072e-02 +-8.781260000000000454e-02 1.405311000000000060e-02 1.535006999999999899e-01 -6.825562000000000296e-02 +-7.509161999999999781e-02 4.979760999999999910e-02 -2.375682000000000141e-02 -1.096218999999999943e-01 +5.075144999999999657e-03 8.936959999999999349e-02 -6.483840999999999910e-02 -1.650048000000000140e-02 +1.000737000000000015e-01 -2.654621999999999885e-02 -5.569791999999999799e-02 9.277593000000000645e-03 +-4.787783000000000316e-02 -8.976066000000000600e-02 -4.525785000000000224e-02 6.143817999999999675e-03 +-8.509134000000000142e-02 -1.175694000000000045e-02 -4.242430999999999980e-02 6.635983000000000463e-04 +-7.849005000000000565e-02 1.149177000000000011e-02 -4.295538000000000134e-02 -1.457778999999999976e-03 +-6.894811000000000689e-02 9.960926999999999629e-03 -4.436257999999999868e-02 -2.035997999999999801e-03 +-6.503551999999999944e-02 2.326276000000000038e-02 -4.604478000000000043e-02 -2.305683000000000211e-03 +-2.873697000000000057e-02 9.938784999999999981e-02 -4.798501000000000155e-02 -2.483525999999999789e-03 +1.288446000000000036e-01 9.734888999999999348e-02 -5.001557000000000225e-02 -2.632933999999999969e-03 +1.672249000000000096e-01 -2.095228999999999842e-02 -5.224695000000000034e-02 -2.758229000000000063e-03 +8.970435999999999688e-02 -3.740351000000000092e-02 -5.451968000000000092e-02 -2.798154000000000179e-03 +9.215199999999999780e-02 2.984886999999999957e-02 -5.682232999999999729e-02 -2.860592999999999816e-03 +1.492319000000000007e-01 -5.370757000000000309e-02 -5.921124999999999999e-02 5.828088000000000019e-02 +-1.320214999999999930e-02 -1.116783999999999971e-01 6.077806000000000181e-02 6.865992999999999402e-02 +-7.841309999999999947e-02 -2.620781000000000152e-02 7.869441000000000630e-02 -5.900455999999999757e-02 +-7.245508000000000504e-02 1.375199000000000039e-02 -5.671285999999999689e-02 -5.013501999999999759e-04 +-5.751353000000000021e-02 1.412625999999999986e-02 7.872091000000000505e-02 6.318824000000000662e-02 +-5.022292999999999896e-02 7.876944000000000307e-03 7.018169999999999964e-02 1.913267000000000093e-02 +-4.749503000000000058e-02 4.945217000000000016e-03 1.175366000000000050e-01 3.301392000000000215e-02 +-4.596125000000000210e-02 4.169728000000000323e-02 1.365811000000000108e-01 -6.322851000000000166e-02 +3.033071000000000031e-02 8.680093999999999310e-02 -8.620730999999999533e-03 -1.161920000000000036e-01 diff --git a/unit_tests/film_gls/design_odd.mat b/unit_tests/film_gls/design_odd.mat new file mode 100644 index 0000000..e7ec335 --- /dev/null +++ b/unit_tests/film_gls/design_odd.mat @@ -0,0 +1,54 @@ +/NumWaves 4 +/NumPoints 51 +/Matrix +1.648834999999999884e-02 -3.726071999999999978e-03 -4.833967000000000125e-02 -1.963018999999999875e-03 +1.119840000000000071e-02 -3.639564000000000080e-03 -4.980388000000000176e-02 -1.761013999999999982e-03 +5.874693000000000276e-03 -3.561888999999999941e-03 -5.085856999999999878e-02 3.680828000000000138e-03 +5.319972999999999759e-04 -3.439620999999999911e-03 -4.143511999999999890e-02 1.017567000000000055e-01 +-4.756011000000000093e-03 -3.213473000000000111e-03 1.536263999999999963e-01 1.921240000000000100e-02 +-9.853109999999999993e-03 -2.989758999999999819e-03 -2.774908999999999883e-03 -9.302396999999999749e-02 +-1.489293000000000040e-02 -2.856495000000000128e-03 -3.159589000000000147e-02 6.295581999999999567e-02 +-1.992050000000000071e-02 -2.696741999999999802e-03 1.240711000000000036e-01 3.985261000000000359e-03 +-2.483733000000000121e-02 -2.466271999999999822e-03 -2.327842000000000106e-02 -5.903798999999999852e-02 +-2.959615000000000162e-02 -2.225098999999999914e-03 6.898188999999999883e-03 6.379331000000000584e-02 +-3.421665000000000123e-02 -1.957060999999999957e-03 1.050973000000000046e-01 -2.023018000000000038e-02 +-3.862000000000000155e-02 5.954985000000000139e-02 -3.314361999999999864e-02 -8.629162999999999417e-02 +7.960121000000000557e-02 6.756821999999999828e-02 -6.654564999999999786e-02 -1.346018000000000041e-02 +9.585565999999999531e-02 -6.029484999999999706e-02 -5.899767000000000206e-02 8.135866000000000278e-03 +-4.101391000000000064e-02 -8.127914999999999446e-02 -4.923609000000000319e-02 8.894826999999999595e-02 +-7.207805999999999935e-02 7.568362000000000353e-03 1.198999000000000037e-01 6.050200000000000022e-02 +-3.246686000000000016e-02 1.030601000000000017e-01 7.213057999999999970e-02 -8.124520000000000353e-02 +1.290009000000000017e-01 1.234730999999999980e-03 -4.204758000000000107e-02 -6.670086999999999544e-02 +-2.872722000000000123e-02 -6.461886000000000019e-02 -6.029729999999999812e-02 -4.615990999999999844e-03 +-5.131997000000000121e-03 6.184020999999999962e-02 -5.023683000000000315e-02 8.354531999999999584e-03 +9.098035000000000150e-02 8.121815000000000284e-02 -4.258347999999999994e-02 4.637561000000000114e-03 +1.570882999999999863e-01 5.537315000000000119e-03 -3.998582999999999998e-02 1.284144999999999991e-03 +1.044230000000000019e-01 -4.815475999999999784e-02 -3.904910999999999799e-02 2.360751999999999924e-04 +6.108828000000000175e-02 1.124179999999999971e-02 -3.855113999999999763e-02 -6.901035000000000242e-05 +1.255222000000000004e-01 -5.403618000000000310e-02 -3.822646999999999851e-02 8.235082999999999986e-02 +-4.584987000000000090e-02 -1.079753999999999992e-01 1.271100000000000008e-01 7.520477000000000412e-02 +-9.599312000000000122e-02 -1.721912999999999916e-02 1.125185999999999964e-01 1.300007000000000072e-02 +-8.781260000000000454e-02 1.405311000000000060e-02 1.535006999999999899e-01 -6.825562000000000296e-02 +-7.509161999999999781e-02 4.979760999999999910e-02 -2.375682000000000141e-02 -1.096218999999999943e-01 +5.075144999999999657e-03 8.936959999999999349e-02 -6.483840999999999910e-02 -1.650048000000000140e-02 +1.000737000000000015e-01 -2.654621999999999885e-02 -5.569791999999999799e-02 9.277593000000000645e-03 +-4.787783000000000316e-02 -8.976066000000000600e-02 -4.525785000000000224e-02 6.143817999999999675e-03 +-8.509134000000000142e-02 -1.175694000000000045e-02 -4.242430999999999980e-02 6.635983000000000463e-04 +-7.849005000000000565e-02 1.149177000000000011e-02 -4.295538000000000134e-02 -1.457778999999999976e-03 +-6.894811000000000689e-02 9.960926999999999629e-03 -4.436257999999999868e-02 -2.035997999999999801e-03 +-6.503551999999999944e-02 2.326276000000000038e-02 -4.604478000000000043e-02 -2.305683000000000211e-03 +-2.873697000000000057e-02 9.938784999999999981e-02 -4.798501000000000155e-02 -2.483525999999999789e-03 +1.288446000000000036e-01 9.734888999999999348e-02 -5.001557000000000225e-02 -2.632933999999999969e-03 +1.672249000000000096e-01 -2.095228999999999842e-02 -5.224695000000000034e-02 -2.758229000000000063e-03 +8.970435999999999688e-02 -3.740351000000000092e-02 -5.451968000000000092e-02 -2.798154000000000179e-03 +9.215199999999999780e-02 2.984886999999999957e-02 -5.682232999999999729e-02 -2.860592999999999816e-03 +1.492319000000000007e-01 -5.370757000000000309e-02 -5.921124999999999999e-02 5.828088000000000019e-02 +-1.320214999999999930e-02 -1.116783999999999971e-01 6.077806000000000181e-02 6.865992999999999402e-02 +-7.841309999999999947e-02 -2.620781000000000152e-02 7.869441000000000630e-02 -5.900455999999999757e-02 +-7.245508000000000504e-02 1.375199000000000039e-02 -5.671285999999999689e-02 -5.013501999999999759e-04 +-5.751353000000000021e-02 1.412625999999999986e-02 7.872091000000000505e-02 6.318824000000000662e-02 +-5.022292999999999896e-02 7.876944000000000307e-03 7.018169999999999964e-02 1.913267000000000093e-02 +-4.749503000000000058e-02 4.945217000000000016e-03 1.175366000000000050e-01 3.301392000000000215e-02 +-4.596125000000000210e-02 4.169728000000000323e-02 1.365811000000000108e-01 -6.322851000000000166e-02 +3.033071000000000031e-02 8.680093999999999310e-02 -8.620730999999999533e-03 -1.161920000000000036e-01 +1.250539999999999985e-01 -2.703016999999999920e-02 -9.495515999999999679e-02 5.906059999999999782e-02 diff --git a/unit_tests/film_gls/feedsRun.autoregressive b/unit_tests/film_gls/feedsRun.autoregressive new file mode 100755 index 0000000..07e87c1 --- /dev/null +++ b/unit_tests/film_gls/feedsRun.autoregressive @@ -0,0 +1,42 @@ +#!/usr/bin/env fslpython +# +# Test film_gls with the --ar option on both even and odd +# (#timepoints) data. + + +import os +import sys +import tempfile +import os.path as op +import subprocess as sp + +import numpy as np + +from pyfeeds.common import fslbin + +outdir = sys.argv[1] + +fslroi = fslbin('fslroi') +film_gls = fslbin('film_gls') +v2t = fslbin('Vest2Text') +t2v = fslbin('Text2Vest') + +dcon = 'design.con' +dfts = 'design.fts' + + +def run(cmd): + sp.run(cmd.split(), check=True) + + +# one run with even # timepoints, +# and one with odd # timepoints +for suffix, npts in [('even', 50), ('odd', 51)]: + + datafile = f'roi_{suffix}.nii.gz' + dmat = f'design_{suffix}.mat' + runoutdir = op.join(outdir, suffix) + + run(f'{film_gls} --in={datafile} --ar --rn={runoutdir} ' + f'--pd={dmat} --con={dcon} --fcon={dfts} ' + '--thr=1000.0 --sa --ms=5') diff --git a/unit_tests/film_gls/roi_even.nii.gz b/unit_tests/film_gls/roi_even.nii.gz new file mode 100644 index 0000000..0b22120 --- /dev/null +++ b/unit_tests/film_gls/roi_even.nii.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8eed06381b598de3eaf941785100a986d506123f65c09e967a648f9e5aa36062 +size 20633 diff --git a/unit_tests/film_gls/roi_odd.nii.gz b/unit_tests/film_gls/roi_odd.nii.gz new file mode 100644 index 0000000..ba02d47 --- /dev/null +++ b/unit_tests/film_gls/roi_odd.nii.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a31c001d882b6a922bb7f7d0c26ca0c143688107248ce2b10ca4d2206e92fc6 +size 21038 -- GitLab