Closed nealholl closed 8 years ago
@nealholl Thanks for the pull request. These changes sounds like a good idea but the care needs to be taken if the type of the value in the procpar file is to be used. By using strings without any explicit casting there were some difficulties that were avoided.
Currently 7 tests are failing with these changes, mostly for issues indicated by the code notes.
(pull/origin/35) ~/dev/nmrglue$ nosetests
.................................E.E.E..............EE...../home/jhelmus/dev/nmrglue/nmrglue/fileio/bruker.py:84: UserWarning: Failed to determine udic parameters for dim: 0
warn("Failed to determine udic parameters for dim: %i" % (b_dim))
........EE.................................../home/jhelmus/dev/nmrglue/nmrglue/process/proc_base.py:270: RuntimeWarning: divide by zero encountered in divide
apod = 1 / apod
/home/jhelmus/dev/nmrglue/nmrglue/process/proc_base.py:270: RuntimeWarning: invalid value encountered in divide
apod = 1 / apod
...........
NMRPipe Transpose Warning, Function 1:
Ordinary Transpose of Hypercomplex Data.
Consider deleting imaginary data first;
use the -di flag to delete imaginaries.
Consider using hypercomplex transpose;
use the -hyper flag to select this.
.
NMRPipe Transpose Warning, Function 1:
Ordinary Transpose of Hypercomplex Data.
Consider deleting imaginary data first;
use the -di flag to delete imaginaries.
Consider using hypercomplex transpose;
use the -hyper flag to select this.
.
NMRPipe Transpose Warning, Function 1:
Ordinary Transpose of Hypercomplex Data.
Consider deleting imaginary data first;
use the -di flag to delete imaginaries.
Consider using hypercomplex transpose;
use the -hyper flag to select this.
................................................
======================================================================
ERROR: low memory reading/writing of 2D Varian file
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jhelmus/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/jhelmus/dev/nmrglue/tests/test_agilent.py", line 92, in test_2d_lowmem
assert np.abs(data[0, 1].real - 360.07) <= 0.01
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/fileiobase.py", line 618, in __getitem__
data = self.__fgetitem__(tuple(frlist))
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 2077, in __fgetitem__
osize.append(len(range(lfshape)[lslice]))
TypeError: range() integer end argument expected, got float.
======================================================================
ERROR: low memory reading/writing of 2D Varian file with TPPI encoding
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jhelmus/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/jhelmus/dev/nmrglue/tests/test_agilent.py", line 117, in test_2d_tppi_lowmem
assert np.abs(data[0, 1].real - -4589.29) <= 0.01
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/fileiobase.py", line 618, in __getitem__
data = self.__fgetitem__(tuple(frlist))
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 2077, in __fgetitem__
osize.append(len(range(lfshape)[lslice]))
TypeError: range() integer end argument expected, got float.
======================================================================
ERROR: low memory reading/writing of 3D Varian file
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jhelmus/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/jhelmus/dev/nmrglue/tests/test_agilent.py", line 141, in test_3d_lowmem
assert np.abs(data[0, 1, 2].real - 7.98) <= 0.01
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/fileiobase.py", line 618, in __getitem__
data = self.__fgetitem__(tuple(frlist))
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 2077, in __fgetitem__
osize.append(len(range(lfshape)[lslice]))
TypeError: range() integer end argument expected, got float.
======================================================================
ERROR: 3D time agilent, pipe <-> agilent, pipe
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jhelmus/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/jhelmus/dev/nmrglue/tests/test_convert.py", line 432, in test_agilent_3d
rdic, rdata = ng.varian.read(td)
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 267, in read
pdic = read_procpar(os.path.join(dir, procpar_file))
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 1880, in read_procpar
p = get_parameter(f)
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 1915, in get_parameter
values = list(map(np.float, line.split()[1:]))
ValueError: could not convert string to float: phase,phase2
======================================================================
ERROR: 3D time agilent, rnmrtk <-> rnmrtk
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jhelmus/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/jhelmus/dev/nmrglue/tests/test_convert.py", line 530, in test_agilent_3d_rnmrtk
rrdic, rrdata = ng.varian.read(td)
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 267, in read
pdic = read_procpar(os.path.join(dir, procpar_file))
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 1880, in read_procpar
p = get_parameter(f)
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 1915, in get_parameter
values = list(map(np.float, line.split()[1:]))
ValueError: could not convert string to float: phase,phase2
======================================================================
ERROR: 2D time agilent, pipe <-> agilent, pipe low memory
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jhelmus/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/jhelmus/dev/nmrglue/tests/test_convert.py", line 1524, in test_agilent_2d_lowmem
assert_array_equal(vdata[0:4, 0:20], cdata[0:4, 0:20])
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/fileiobase.py", line 618, in __getitem__
data = self.__fgetitem__(tuple(frlist))
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 2077, in __fgetitem__
osize.append(len(range(lfshape)[lslice]))
TypeError: range() integer end argument expected, got float.
======================================================================
ERROR: 3D time agilent, pipe <-> agilent, pipe low memory
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jhelmus/anaconda/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/jhelmus/dev/nmrglue/tests/test_convert.py", line 1589, in test_agilent_3d_lowmem
assert_array_equal(vdata[0:3, 0:4, 0:20], cdata[0:3, 0:4, 0:20])
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/fileiobase.py", line 618, in __getitem__
data = self.__fgetitem__(tuple(frlist))
File "/home/jhelmus/dev/nmrglue/nmrglue/fileio/varian.py", line 2077, in __fgetitem__
osize.append(len(range(lfshape)[lslice]))
TypeError: range() integer end argument expected, got float.
----------------------------------------------------------------------
Ran 165 tests in 166.113s
FAILED (errors=7)
Closing this issue as there has been no update for quite some time. @nealholl feel free to reopen this or submit a new PR if you are still interested in this topic.
I altered the procpar reading routines so that that would create numeric data for numeric values (e.g. the max/min values are doubles instead of strings). The automated test appears to pass, and the alterations were made throughout to (hopefully) maintain consistency. Nothing too complicated, but a nicety that I like. Neal H.