Skip to content

Test main pipeline regressions - #290

Open
csherry04 wants to merge 3 commits into
opencap-org:devfrom
csherry04:test-main-pipeline-regressions
Open

Test main pipeline regressions#290
csherry04 wants to merge 3 commits into
opencap-org:devfrom
csherry04:test-main-pipeline-regressions

Conversation

@csherry04

Copy link
Copy Markdown

With this main test file will have added calibration, neutral, 5 cam calibration, and 5 cam motion tests. Some helpers added for readability as well

@csherry04
csherry04 force-pushed the test-main-pipeline-regressions branch from 9bee73e to 86313a5 Compare July 24, 2026 20:18
@carmichaelong
carmichaelong self-requested a review July 30, 2026 21:36

@carmichaelong carmichaelong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @csherry04! I left a bunch of notes throughout. Overall, biggest things to clean up are what's getting copied to make sure tests may not "accidentally" pass and would better replicate the real structure of what inputs look like at run time.

Comment thread tests/test_main.py Outdated
pd.testing.assert_frame_equal(
output_trc_df, ref_trc_df, check_exact=False, atol=atol
)
assert output_trc_df.isna().sum().sum() == ref_trc_df.isna().sum().sum()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this assert necessary given assert_frame_equal above?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to find it in their documentation, but some stack overflow posts say that nan's should be treated correctly with assert_frame_equal. If that's the case, this assert seems like a weaker condition (just counting)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely redundant, fixed

Comment thread tests/test_main.py
dataDir=dataDir,
genericFolderNames=True,
poseDetector='openpose',
resolutionPoseDetection='1x736',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding syncVer=1.0 here, so the test doesn't change even if default sync version changes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread tests/test_main.py Outdated
trialID = trialName
dataDir = tmp_path
sessionDir = os.path.join(dataDir, 'Data', sessionName)
shutil.copytree(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be better to only copy the necessary files, rather than all the files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might also be helpful to add some short comments for maintenance to explain the high-level strategy and location of copying these files. It's a little hard to trace (see comments below)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or if the copies are simplified, might not need a comment if it's pretty straightforward like in some other cases here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have added helper to copy in just the necessary files, hopefully makes it more scoped and understandable

Comment thread tests/test_main.py Outdated
)

for camName in ['Cam0', 'Cam1']:
production_pickle = os.path.join(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a whole directory is copied, but then extra copies are needed for a specific file to a different specific folder (local_pickle_dir)? I might be missing something, but seems like copies could be streamlined

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was due to the fact that the path expected was different to what was in the original directory so was first copying the full thing then correcting the path to the pickle, should be fixed with the new helper

Comment thread tests/test_main.py Outdated
'PreAugmentation',
f'{trialName}.trc',
)
assert os.path.exists(output_pre_augmentation_trc)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why assert just pre-augmented markers (rather than both along with post-augmented, or neither)? Can main() exit without throwing an error (and thus these asserts would be needed)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree was unnecessary to do any intermediate check, removed

Comment thread tests/test_main.py Outdated
trialID = trialName
dataDir = tmp_path
sessionDir = os.path.join(dataDir, 'Data', sessionName)
shutil.copytree(LAB_5CAM_DIR, sessionDir)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments here, as with the above neutral scaling test

Comment thread tests/test_main.py Outdated
f'{trialName}.mot',
)
# excludes the setup motion
compare_mot_files(output_mot, ref_mot, 2, 9)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using 2.0 and 9.0 just to make it clearer these are floats (even though it's less of an issue with Python 3+)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread tests/test_main.py
'Model',
'LaiUhlrich2022_scaled.osim',
)
assert os.path.exists(scaled_model)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue with copying the whole folder tree is that the scaled_model here looks to be part of the copy, so this assert might never fail (or actually silently let errors through)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed with helper

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.

2 participants