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

memory not stable between runs #776

Open
freemansw1 opened this issue Oct 25, 2024 · 0 comments
Open

memory not stable between runs #776

freemansw1 opened this issue Oct 25, 2024 · 0 comments

Comments

@freemansw1
Copy link
Contributor

It seems that memory, under certain conditions, is not stable/deterministic. I've put an example below. At some times, the value of particle at index 10 is 3, and at others it is 4. Both are reasonable choices, but it should always select one or the other, not both.

I've tried to dig into the source code with an eye to a PR, but frankly I'm struggling to understand how the memory module works. I'm happy to put some effort into a PR, but need a bit more insight there before putting one together.

I'm on an M2 Mac, Python 3.12.7, trackpy version 0.6.4.

import pandas as pd
import trackpy
import numpy as np

y_coords = [2, 3, 0, 10, 3, 1, 11, 4, 1, 2, 12, 5, 0]
x_coords = [3, 4, 4, 14, 4, 5, 15, 5, 2, 6, 16, 6, 1]
frame =    [2, 2, 2,  2, 3, 3,  3, 4, 4, 4,  4, 5, 5]

trackpy_df = pd.DataFrame({"y": y_coords, "x": x_coords, "frame": frame})
pred = trackpy.predict.NearestVelocityPredict(                
        initial_guess_positions=[[1,2],[4,5]],
        initial_guess_vels=[[1,1],[-1,-1]],
        pos_columns=['y', 'x'],
        span=1,
)
out = pred.link_df(trackpy_df, search_range = 1.8, memory=1, t_column="frame", neighbor_strategy="BTree",
                adaptive_step=None,
                adaptive_stop=None,
)

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

1 participant