Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nosetests failures, mainly to do with Booleans and float64 #138

Open
neildhir opened this issue Aug 22, 2017 · 4 comments
Open

Nosetests failures, mainly to do with Booleans and float64 #138

neildhir opened this issue Aug 22, 2017 · 4 comments

Comments

@neildhir
Copy link

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)
@moorepants
Copy link
Member

moorepants commented Aug 22, 2017

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.

@neildhir
Copy link
Author

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

@neildhir
Copy link
Author

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)

@moorepants
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants