GaitAnalysisToolKit icon indicating copy to clipboard operation
GaitAnalysisToolKit copied to clipboard

Nosetests failures, mainly to do with Booleans and float64

Open neildhir opened this issue 6 years ago • 4 comments

Currently getting this when running nosetests having dealt with the interp1q to interp1 issue.

user:~/GaitAnalysisToolKit$ nosetests
............./usr/lib/python2.7/unittest/case.py:393: FutureWarning: get_store is deprecated and be removed in a future version
HDFStore(path, **kwargs) is the replacement
  return self.run(*args, **kwds)
/usr/lib/python2.7/unittest/case.py:329: FutureWarning: get_store is deprecated and be removed in a future version
HDFStore(path, **kwargs) is the replacement
  testMethod()
..E.....EE..E.E...E.E......F......E.....
======================================================================
ERROR: gaitanalysis.tests.test_gait.test_find_constant_speed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_gait.py", line 35, in test_find_constant_speed
    indice, constant_speed_time = find_constant_speed(time, speed, plot=False)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/gait.py", line 78, in find_constant_speed
    return len(time) - (new_indice), time[len(time) - new_indice]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

======================================================================
ERROR: gaitanalysis.tests.test_motek.TestDFlowData.test_clean_data
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 1121, in test_clean_data
    data.clean_data(ignore_hbm=True)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 1472, in clean_data
    df = self._identify_missing_markers(df)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 826, in _identify_missing_markers
    data_frame = identifier.identify(columns=self.marker_column_labels)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 173, in identify
    self.data_frame[are_constant] = np.nan
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2328, in __setitem__
    self._setitem_frame(key, value)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2366, in _setitem_frame
    self._where(-key, value, inplace=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 5098, in _where
    raise ValueError(msg.format(dtype=dt))
ValueError: Boolean array expected for the condition, not float64

======================================================================
ERROR: gaitanalysis.tests.test_motek.TestDFlowData.test_clean_data_options
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 1236, in test_clean_data_options
    data.clean_data()
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 1472, in clean_data
    df = self._identify_missing_markers(df)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 826, in _identify_missing_markers
    data_frame = identifier.identify(columns=self.marker_column_labels)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 173, in identify
    self.data_frame[are_constant] = np.nan
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2328, in __setitem__
    self._setitem_frame(key, value)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2366, in _setitem_frame
    self._where(-key, value, inplace=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 5098, in _where
    raise ValueError(msg.format(dtype=dt))
ValueError: Boolean array expected for the condition, not float64

======================================================================
ERROR: gaitanalysis.tests.test_motek.TestDFlowData.test_express
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 1072, in test_express
    data.clean_data()
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 1472, in clean_data
    df = self._identify_missing_markers(df)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 826, in _identify_missing_markers
    data_frame = identifier.identify(columns=self.marker_column_labels)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 173, in identify
    self.data_frame[are_constant] = np.nan
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2328, in __setitem__
    self._setitem_frame(key, value)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2366, in _setitem_frame
    self._where(-key, value, inplace=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 5098, in _where
    raise ValueError(msg.format(dtype=dt))
ValueError: Boolean array expected for the condition, not float64

======================================================================
ERROR: gaitanalysis.tests.test_motek.TestDFlowData.test_extract_processed_data
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 1271, in test_extract_processed_data
    dflow_data.clean_data()
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 1472, in clean_data
    df = self._identify_missing_markers(df)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 826, in _identify_missing_markers
    data_frame = identifier.identify(columns=self.marker_column_labels)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 173, in identify
    self.data_frame[are_constant] = np.nan
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2328, in __setitem__
    self._setitem_frame(key, value)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2366, in _setitem_frame
    self._where(-key, value, inplace=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 5098, in _where
    raise ValueError(msg.format(dtype=dt))
ValueError: Boolean array expected for the condition, not float64

======================================================================
ERROR: gaitanalysis.tests.test_motek.TestDFlowData.test_identify_missing_markers
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 892, in test_identify_missing_markers
    identified = dflow_data._identify_missing_markers(data_frame)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 826, in _identify_missing_markers
    data_frame = identifier.identify(columns=self.marker_column_labels)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 173, in identify
    self.data_frame[are_constant] = np.nan
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2328, in __setitem__
    self._setitem_frame(key, value)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2366, in _setitem_frame
    self._where(-key, value, inplace=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 5098, in _where
    raise ValueError(msg.format(dtype=dt))
ValueError: Boolean array expected for the condition, not float64

======================================================================
ERROR: gaitanalysis.tests.test_motek.TestDFlowData.test_interpolate_missing_markers
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 912, in test_interpolate_missing_markers
    identified = dflow_data._identify_missing_markers(df)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 826, in _identify_missing_markers
    data_frame = identifier.identify(columns=self.marker_column_labels)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 173, in identify
    self.data_frame[are_constant] = np.nan
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2328, in __setitem__
    self._setitem_frame(key, value)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2366, in _setitem_frame
    self._where(-key, value, inplace=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 5098, in _where
    raise ValueError(msg.format(dtype=dt))
ValueError: Boolean array expected for the condition, not float64

======================================================================
ERROR: gaitanalysis.tests.test_motek.TestMissingMarkerIdentfier.test_identify
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 112, in test_identify
    identified = identifier.identify(columns=marker_columns)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/motek.py", line 173, in identify
    self.data_frame[are_constant] = np.nan
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2328, in __setitem__
    self._setitem_frame(key, value)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2366, in _setitem_frame
    self._where(-key, value, inplace=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 5098, in _where
    raise ValueError(msg.format(dtype=dt))
ValueError: Boolean array expected for the condition, not float64

======================================================================
FAIL: gaitanalysis.tests.test_motek.TestDFlowData.test_orient_accelerometers
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 1062, in test_orient_accelerometers
    -relabeled_data['Back_Left_AccY'])
  File "/usr/local/lib/python2.7/dist-packages/numpy/testing/utils.py", line 1395, in assert_allclose
    verbose=verbose, header=header, equal_nan=equal_nan)
  File "/usr/local/lib/python2.7/dist-packages/numpy/testing/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(mismatch 100.0%)
 x: array([ 0.,  0.,  0., ...,  0.,  0.,  0.])
 y: array([ 0.095853,  0.085894,  0.075927, ..., -0.859578, -0.864645,
       -0.869626])

----------------------------------------------------------------------
Ran 53 tests in 22.233s

FAILED (errors=8, failures=1)

neildhir avatar Aug 22 '17 17:08 neildhir

Thanks. pandas has had a number of updates since the last release of this package. You can install an older version of pandas as a work around.

moorepants avatar Aug 22 '17 19:08 moorepants

Ah cool, yeah that's a good idea. Seems to be working for the stuff I am using it for now though.

neildhir avatar Aug 22 '17 20:08 neildhir

Can confirm that rolling back pandas==0.17.1 solves some of the problems:

user:~/GaitAnalysisToolKit$ nosetests
...............E........................F............
======================================================================
ERROR: gaitanalysis.tests.test_gait.test_find_constant_speed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_gait.py", line 35, in test_find_constant_speed
    indice, constant_speed_time = find_constant_speed(time, speed, plot=False)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/gait.py", line 78, in find_constant_speed
    return len(time) - (new_indice), time[len(time) - new_indice]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

======================================================================
FAIL: gaitanalysis.tests.test_motek.TestDFlowData.test_orient_accelerometers
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/user/cloud/GaitAnalysisToolKit/gaitanalysis/tests/test_motek.py", line 1062, in test_orient_accelerometers
    -relabeled_data['Back_Left_AccY'])
  File "/usr/local/lib/python2.7/dist-packages/numpy/testing/utils.py", line 1395, in assert_allclose
    verbose=verbose, header=header, equal_nan=equal_nan)
  File "/usr/local/lib/python2.7/dist-packages/numpy/testing/utils.py", line 778, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0

(mismatch 100.0%)
 x: array([ 0.,  0.,  0., ...,  0.,  0.,  0.])
 y: array([ 0.095853,  0.085894,  0.075927, ..., -0.859578, -0.864645,
       -0.869626])

----------------------------------------------------------------------
Ran 53 tests in 31.674s

FAILED (errors=1, failures=1)

neildhir avatar Aug 23 '17 06:08 neildhir

All these should be fixed in master. Can you confirm?

moorepants avatar Aug 30 '18 22:08 moorepants