Closed mogres closed 1 year ago
Looks good to me!
I see broken tests.. floating point comparisons.. and combined with the int casting in the code change, I'm not sure what happened. But the precision for the float comparisons seems way too high. Usually in a unit test you would never test for equality with floating point numbers that possibly had math run on them, but use an epsilon.
I see broken tests.. floating point comparisons.. and combined with the int casting in the code change, I'm not sure what happened. But the precision for the float comparisons seems way too high. Usually in a unit test you would never test for equality with floating point numbers that possibly had math run on them, but use an epsilon.
Yup, looks like very small floating point errors are causing the tests to fail in an OS-dependent way. I'm not sure what the best way to deal with this is, would be happy to get some input. Any thoughts @ascibisz?
Looked into the bug a bit, currently there's an equality assertion between two tuples containing a dictionary and a float array in a few tests. Pytest does have an approx
function that handles float array comparison with an epsilon (https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest-approx) that might work if we compare the elements of the tuple?
Something like:
# test_cellpack_convert.py, 156
assert expected_bundleData_data[0] == bundleData["data"][0] && expected_bundleData_data[1] == pytest.approx(bundleData["data"][1]
Also relevant stackoverflow thread if this is happening elsewhere: https://stackoverflow.com/questions/56046524/check-if-python-dictionaries-are-equal-allowing-small-difference-for-floats
Looked into the bug a bit, currently there's an equality assertion between two tuples containing a dictionary and a float array in a few tests. Pytest does have an
approx
function that handles float array comparison with an epsilon (https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest-approx) that might work if we compare the elements of the tuple?Something like:
# test_cellpack_convert.py, 156 assert expected_bundleData_data[0] == bundleData["data"][0] && expected_bundleData_data[1] == pytest.approx(bundleData["data"][1]
Also relevant stackoverflow thread if this is happening elsewhere: https://stackoverflow.com/questions/56046524/check-if-python-dictionaries-are-equal-allowing-small-difference-for-floats
I'm trying out a fix using numpy isclose which might work. Will keep you posted!
Patch coverage: 100.00%
and no project coverage change.
Comparison is base (
b2ab7fe
) 92.55% compared to head (14b17a1
) 92.56%.
:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Problem
Refer to #153
Solution
Type of change
Steps to Verify:
Refer to this notebook which creates a single simularium file from multiple cytosim simulations
Screenshots:
Simularium trajectory with multiple actin filaments visualized simultaneously
Keyfiles:
simulariumio/data_objects/trajectory_data.py