Commit 69a21c32 authored by Mo Shahdloo's avatar Mo Shahdloo
Browse files

Merge branch 'master' of https://git.fmrib.ox.ac.uk/shahdloo/pymapvbvd into dev

# Conflicts:
#	requirements.txt
parents 2acb9562 0562c784
......@@ -147,7 +147,7 @@ def loop_mdh_read(fid, version, Nscans, scan, measOffset, measLength, print_prog
t.close()
if isEOF:
if isEOF or n_acq == len(filePos):
n_acq = n_acq - 1 # ignore the last attempt
# import pdb; pdb.set_trace()
filePos[n_acq] = cPos
......
......@@ -6,4 +6,4 @@ dataclasses~=0.7
scipy~=1.4.1
matplotlib~=3.2.1
setuptools~=46.1.3
pytest==5.3.5
\ No newline at end of file
pytest==5.3.5
......@@ -9,8 +9,44 @@ from core import mapVBVD
test_data_vb_broken = op.join(op.dirname(__file__), 'test_data', 'meas_MID111_sLaser_broken_FID4873.dat')
test_data_gre = op.join(op.dirname(__file__), 'test_data', 'meas_MID00058_FID12358_gre_3D.dat')
test_data_epi = op.join(op.dirname(__file__), 'test_data', 'meas_MID00053_FID12353_ep2d_QA_2mm_15ch_inplane_Grappa2_100.dat')
def test_flagRemoveOS():
twixObj = mapVBVD(test_data_gre, quiet=False)
twixObj[1].image.flagRemoveOS = False
assert np.allclose(twixObj.image.fullSize, [4096, 32, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1])
\ No newline at end of file
assert np.allclose(twixObj[1].image.dataSize, [256, 15, 128, 96, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
twixObj[1].image.flagRemoveOS = True
assert np.allclose(twixObj[1].image.dataSize, [128, 15, 128, 96, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
# broken file
twixObj = mapVBVD(test_data_vb_broken, quiet=False)
twixObj.image.flagRemoveOS = False
assert np.allclose(twixObj.image.dataSize, [4096, 32, 1, 1, 1, 1, 1, 1, 1, 97, 1, 1, 1, 1, 1, 1])
twixObj.image.flagRemoveOS = True
assert np.allclose(twixObj.image.dataSize, [2048, 32, 1, 1, 1, 1, 1, 1, 1, 97, 1, 1, 1, 1, 1, 1])
def test_flagIgnoreSeg_flagDoAverage():
twixObj = mapVBVD(test_data_epi, quiet=False)
twixObj[1].refscan_phasecor.flagIgnoreSeg = False
twixObj[1].refscan_phasecor.flagDoAverage = False
assert np.allclose(twixObj[1].refscan_phasecor.dataSize, [86, 15, 1, 1, 36, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1])
twixObj[1].refscan_phasecor.flagDoAverage = True
assert np.allclose(twixObj[1].refscan_phasecor.dataSize, [86, 15, 1, 1, 36, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1])
twixObj[1].refscan_phasecor.flagIgnoreSeg = True
twixObj[1].refscan_phasecor.flagDoAverage = False
assert np.allclose(twixObj[1].refscan_phasecor.dataSize, [86, 15, 1, 1, 36, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
twixObj[1].refscan_phasecor.flagDoAverage = True
assert np.allclose(twixObj[1].refscan_phasecor.dataSize, [86, 15, 1, 1, 36, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
def test_flagSkipToFirstLine():
twixObj = mapVBVD(test_data_epi, quiet=False)
twixObj[1].refscan.flagSkipToFirstLine = False
assert np.allclose(twixObj[1].refscan.dataSize, [86, 15, 55, 1, 36, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1])
twixObj[1].refscan.flagSkipToFirstLine = True
assert np.allclose(twixObj[1].refscan.dataSize, [86, 15, 24, 1, 36, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment