soft-matter / trackpy

Python particle tracking toolkit
http://soft-matter.github.io/trackpy
Other
437 stars 131 forks source link

TST: Weird dtype switching on Windows #744

Closed nkeim closed 6 months ago

nkeim commented 7 months ago

Tests fail on all Windows builds, with error FAILED trackpy/tests/test_motion.py::TestDrift::test_constant_drift - AssertionError: DataFrame.index are different

Here is one of the failing tests:

    def test_no_drift(self):
        N = 10
        expected = DataFrame({'x': np.zeros(N), 'y': np.zeros(N)}).iloc[1:]
        expected = expected.astype('float')
        expected.index.name = 'frame'
        expected.columns = ['x', 'y']
        # ^ no drift measured for Frame 0

        actual = tp.compute_drift(self.dead_still)
>       assert_frame_equal(actual, expected[['y', 'x']])

In this case, actual has index dtype int32 and expected is int64. From reviewing the source code, it's unclear how the switch could happen anywhere, except perhaps in a low-level numpy or scipy function. The best course of action might be to wait for new versions of these dependencies to be released.

This was first observed in #743.

caspervdw commented 6 months ago

This is fixed in #747 ; apparently pandas defaults to int32 in windows if you do .astype(int), and to int64 on other platforms

nkeim commented 6 months ago

🤣

Thanks!!