Unverified Commit 61eb869f authored by William Clarke's avatar William Clarke Committed by GitHub
Browse files

Merge pull request #10 from wexeee/issue6

Fixes from issue 6 and clean up some test warnings.
parents b376613c 78e5f792
......@@ -151,7 +151,7 @@ def loop_mdh_read(fid, version, Nscans, scan, measOffset, measLength, print_prog
t.update(progress)
last_progress = curr_progress
cPos = cPos + ulDMALength
cPos = cPos + int(ulDMALength)
if isEOF or n_acq == len(filePos):
n_acq = n_acq - 1 # ignore the last attempt
......
......@@ -271,7 +271,7 @@ class twix_map_obj:
self.full_size = None
# Flags
self.average_dim = np.full(16, False, dtype=np.bool)
self.average_dim = np.full(16, False, dtype=bool)
self.average_dim[self.dataDims.index('Ave')] = self.doAverage
self.average_dim[self.dataDims.index('Rep')] = self.averageReps
self.average_dim[self.dataDims.index('Set')] = self.averageSets
......@@ -460,7 +460,7 @@ class twix_map_obj:
self.NSli, self.NAve, self.NPhs, self.NEco,
self.NRep, self.NSet, self.NSeg, self.NIda,
self.NIdb, self.NIdc, self.NIdd, self.NIde]
, dtype=np.int)
, dtype=int)
nByte = self.NCha * (self.freadInfo.szChannelHeader + 8 * self.NCol)
......
......@@ -6,6 +6,7 @@ Created by shahdloo
import os.path as op
import numpy as np
from mapvbvd import mapVBVD
import pytest
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_MID00255_FID12798_GRE_surf.dat')
......@@ -20,7 +21,8 @@ def test_flagRemoveOS():
assert np.allclose(twixObj[1].image.dataSize, [128, 16, 128, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
# broken file
twixObj = mapVBVD(test_data_vb_broken, quiet=False)
with pytest.warns(UserWarning):
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
......
import os.path as op
import numpy as np
import pytest
from mapvbvd import mapVBVD
test_data_vb = op.join(op.dirname(__file__), 'test_data', 'meas_MID311_STEAM_wref1_FID115674.dat')
......@@ -33,7 +34,8 @@ def test_ve():
def test_vb_broken():
twixObj = mapVBVD(test_data_vb_broken, quiet=True)
with pytest.warns(UserWarning):
twixObj = mapVBVD(test_data_vb_broken, quiet=True)
assert np.allclose(twixObj.image.fullSize, [4096, 32, 1, 1, 1, 1, 1, 1, 1, 97, 1, 1, 1, 1, 1, 1])
assert np.allclose(twixObj.image.sqzSize, [2048, 32, 97])
......@@ -41,4 +43,3 @@ def test_vb_broken():
assert ('sTXSPEC', 'asNucleusInfo', '0', 'tNucleus') in keys['MeasYaps']
key_value = twixObj.search_header_for_val('MeasYaps', ('sTXSPEC', 'asNucleusInfo', '0', 'tNucleus'))
assert key_value[0] == '"1H"'
Markdown is supported
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