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

issue in Imsd results #705

Open
Alex-code-lab opened this issue Jul 4, 2022 · 0 comments
Open

issue in Imsd results #705

Alex-code-lab opened this issue Jul 4, 2022 · 0 comments

Comments

@Alex-code-lab
Copy link

Hello everyone,

I'm working on tracking cells during 1 hour.
I need to plot msd, so I'm using the imsd function.

However, some results are strange. So I decided to code my own msd function :

def msd_tot_perso_mieu ( Traj, lag_time, experiment_time) :
    msd = pd.DataFrame(index = list(range(lag_time,experiment_time,lag_time)))
    msd = pd.DataFrame(index = list(range(30,30*33,30)))

    # msd['lag_time'] = list(range(30,30*35,30))(.set_index('column') pour modifier plus tard)
    
    for num in range(0,max(Traj['particle'].values)+1):
        if len(Traj[Traj['particle']==num])==0 : continue;
        msd['part_{}'.format(num)] = [0]*32
        
        for i in range(1,33) : 
            XT = Traj[Traj['particle']==num]['x'].shift(0)
            YT = Traj[Traj['particle']==num]['y'].shift(0)  
            XTi = Traj[Traj['particle']==num]['x'].shift(-i)
            YTi = Traj[Traj['particle']==num]['y'].shift(-i)
            # delta_t = (time_frame/60)*(Traj.groupby(['particle'])['frame'].shift(-1)-Traj.groupby(['particle'])['frame'].shift(0))
            msd['part_{}'.format(num)][30*i] = np.nanmean((((XT-XTi)*micronperpixel)**2  +  (((YT-YTi))*micronperpixel)**2))# ou .mean()
        msd['part_{}'.format(num)].dropna()

I know that it's note the most beautiful function ever, but I'm new with pandas so I did my best.

Here is my issue : the results with IMSD function and this function are really different for my tracking.

Is it possible that IMSD does't take in account that some particles might go out and go in in different frames?

That's what it seems like, but I don't understant very well the code under Imsd.

If my function is right, I think it could be a real problem for some people, so I share this observation.

Thank you everyone,

Alex

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