Skip to content

Update Main from Dev - #297

Merged
carmichaelong merged 17 commits into
mainfrom
dev
Aug 25, 2026
Merged

Update Main from Dev#297
carmichaelong merged 17 commits into
mainfrom
dev

Conversation

@AlbertoCasasOrtiz

@AlbertoCasasOrtiz AlbertoCasasOrtiz commented Aug 6, 2026

Copy link
Copy Markdown
Member

@AlbertoCasasOrtiz

AlbertoCasasOrtiz commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

@carmichaelong @csherry04 I just reviewed all files and run tests. I got one test failing because of an assertion error, and I think it is because a really small error in a few values while doing scaling. This seems like float point precision issue or differences in a library version?

  • OS: Ubuntu 20.04.6 LTS
E           AssertionError:
E           Not equal to tolerance rtol=0, atol=1e-05
E           ('pelvis', 'pelvis_geom_1')
E           Mismatched elements: 3 / 3 (100%)
E           Max absolute difference: 0.00099501
E           Max relative difference: 0.00073795
E            x: array([1.349348, 1.349348, 1.478875])
E            y: array([1.348353, 1.348353, 1.479606])

This is the full test output:

(opencap-core-dev-alberto) clarkadmin@clarkadmin-Alienware-Aurora-Ryzen-Edition:~/Documents/repos-alberto/opencap-core-dev$ python -m pytest ./tests/
============================================================================================== test session starts ==============================================================================================
platform linux -- Python 3.9.20, pytest-8.4.2, pluggy-1.5.0
rootdir: /home/clarkadmin/Documents/repos-alberto/opencap-core-dev
collected 55 items

tests/test_api.py ...                                                                                                                                                                                     [  5%]
tests/test_calibration.py ........                                                                                                                                                                        [ 20%]
tests/test_main.py .......F..                                                                                                                                                                             [ 38%]
tests/test_sync.py ..................................                                                                                                                                                     [100%]

=================================================================================================== FAILURES ====================================================================================================
_____________________________________________________________________________________________ test_neutral_scaling ______________________________________________________________________________________________

tmp_path = PosixPath('/tmp/pytest-of-clarkadmin/pytest-7/test_neutral_scaling0')

    def test_neutral_scaling(tmp_path):
        sessionName = 'sync_2-cameras'
        trialName = 'neutral'
        trialID = trialName
        dataDir = tmp_path
        sessionDir = os.path.join(dataDir, 'Data', sessionName)

        prepare_test_session(
            SYNC_2CAM_DIR,
            sessionDir,
            trialName,
            ['Cam0', 'Cam1'],
            'OutputPkl_default',
        )

        main(
            sessionName,
            trialName,
            trialID,
            cameras_to_use=SYNC_2CAM_NEUTRAL_ORDER,
            dataDir=dataDir,
            genericFolderNames=True,
            scaleModel=True,
            syncVer='1.1',
        )

        output_post_augmentation_trc = os.path.join(
            sessionDir,
            'MarkerData',
            'PostAugmentation',
            f'{trialName}.trc',
        )
        ref_post_augmentation_trc = os.path.join(
            SYNC_2CAM_DIR,
            'MarkerData',
            f'{trialName}.trc',
        )
        compare_trc(output_post_augmentation_trc, ref_post_augmentation_trc, atol=1e-5)

        scaled_model = os.path.join(
            sessionDir,
            'OpenSimData',
            'Model',
            'LaiUhlrich2022_scaled.osim',
        )
        assert os.path.exists(scaled_model)
        ref_scaled_model = os.path.join(
            SYNC_2CAM_DIR,
            'OpenSimData',
            'Model',
            'LaiUhlrich2022_scaled.osim',
        )
>       compare_osim_scales(scaled_model, ref_scaled_model, atol=1e-5)

tests/test_main.py:387:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

output_osim = '/tmp/pytest-of-clarkadmin/pytest-7/test_neutral_scaling0/Data/sync_2-cameras/OpenSimData/Model/LaiUhlrich2022_scaled.osim'
ref_osim = '/home/clarkadmin/Documents/repos-alberto/opencap-core-dev/tests/opencap-test-data/Data/sync_2-cameras/OpenSimData/Model/LaiUhlrich2022_scaled.osim', atol = 1e-05

    def compare_osim_scales(output_osim, ref_osim, atol=5e-3):
        output_scale_factors = load_osim_scales(output_osim)
        ref_scale_factors = load_osim_scales(ref_osim)
        assert output_scale_factors.keys() == ref_scale_factors.keys()
        for mesh_key in ref_scale_factors:
>           np.testing.assert_allclose(
                output_scale_factors[mesh_key],
                ref_scale_factors[mesh_key],
                rtol=0,
                atol=atol,
                err_msg=str(mesh_key),
            )
E           AssertionError:
E           Not equal to tolerance rtol=0, atol=1e-05
E           ('pelvis', 'pelvis_geom_1')
E           Mismatched elements: 3 / 3 (100%)
E           Max absolute difference: 0.00099501
E           Max relative difference: 0.00073795
E            x: array([1.349348, 1.349348, 1.478875])
E            y: array([1.348353, 1.348353, 1.479606])

tests/test_main.py:96: AssertionError
--------------------------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------------------------
Using cameras: ['Cam1', 'Cam0']
Running OpenPose for Cam1
Running OpenPose for Cam0
You tried to filter 30 Hz signal with cutoff freq of 500. Will filter at 15 instead.
You tried to filter 30 Hz signal with cutoff freq of 500. Will filter at 15 instead.
Writing synchronized videos
1/1 - 1s - 616ms/epoch - 616ms/step
1/1 - 1s - 950ms/epoch - 950ms/step
Static phase of 0.10s detected in staticPose between [0.67, 0.77].
writing Neutral video
=============================================================================================== warnings summary ================================================================================================
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:10
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:10: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    _nlv = LooseVersion(_np_version)

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:11
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:11: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    _np_version_under1p16 = _nlv < LooseVersion("1.16")

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:12
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:12: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    _np_version_under1p17 = _nlv < LooseVersion("1.17")

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:13
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:13: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    _np_version_under1p18 = _nlv < LooseVersion("1.18")

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:14
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:14: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    _np_version_under1p19 = _nlv < LooseVersion("1.19")

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:15
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py:15: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    _np_version_under1p20 = _nlv < LooseVersion("1.20")

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/setuptools/_distutils/version.py:337
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/setuptools/_distutils/version.py:337
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/setuptools/_distutils/version.py:337
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/setuptools/_distutils/version.py:337
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/setuptools/_distutils/version.py:337
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/setuptools/_distutils/version.py:337
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/setuptools/_distutils/version.py:337: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    other = LooseVersion(other)

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/function.py:125
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/function.py:125
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/pandas/compat/numpy/function.py:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(_np_version) >= LooseVersion("1.17.0"):

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/matplotlib/__init__.py:169
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/matplotlib/__init__.py:169
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/matplotlib/__init__.py:169
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/matplotlib/__init__.py:169
../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/matplotlib/__init__.py:169
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/matplotlib/__init__.py:169: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(module.__version__) < minver:

../../../anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/flatbuffers/compat.py:19
  /home/clarkadmin/anaconda3/envs/opencap-core-dev-alberto/lib/python3.9/site-packages/flatbuffers/compat.py:19: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================ short test summary info ============================================================================================
FAILED tests/test_main.py::test_neutral_scaling - AssertionError:
============================================================================= 1 failed, 54 passed, 20 warnings in 91.21s (0:01:31) ==============================================================================

@AlbertoCasasOrtiz

Copy link
Copy Markdown
Member Author

I also updated changelog with these changes in this PR.

@carmichaelong

Copy link
Copy Markdown
Contributor

@AlbertoCasasOrtiz I merged the update to the tests from @csherry04 into dev. Let us know if that addresses your concerns, or if there are any other remaining (in case you have to pass it off to us before your vacation).

@AlbertoCasasOrtiz

Copy link
Copy Markdown
Member Author

By relaxing the tolerance, tests are passing now both on the Ubuntu and Windows machine. If there is nothing else to test, I thinkg this should be ready to merge.

@AlbertoCasasOrtiz AlbertoCasasOrtiz self-assigned this Aug 24, 2026
@AlbertoCasasOrtiz

Copy link
Copy Markdown
Member Author

@carmichaelong Feel free to merge this one when ready. I checked the code again and everything seems ok.

@carmichaelong

Copy link
Copy Markdown
Contributor

Tests look good in my environment as well

@carmichaelong
carmichaelong merged commit 85fc927 into main Aug 25, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants