Skip to content

Commit

Permalink
Resolve trackpy bug
Browse files Browse the repository at this point in the history
Resolve bug in trackpy. This removes the append function that was deprecated with Pandas 2.0 and was causing time_series_analysis to fail.
  • Loading branch information
TomSlater authored May 7, 2024
1 parent 52ad68b commit 1316bc8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions particlespy/particle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,20 @@ def time_series_analysis(particles,max_dist=1,memory=3,properties=['area']):
Returns
-------
Pandas DataFrame of tracjectories.
Pandas DataFrame of trajectories.
"""
df = pd.DataFrame(columns=['y','x']+properties+['frame'])

list_for_dataframe = []
for particle in particles.list:
pd_dict = {'x':particle.properties['x']['value'],
'y':particle.properties['y']['value']}
for property in properties:
pd_dict.update({property:particle.properties[property]['value']})
pd_dict.update({'frame':particle.properties['frame']['value']})
df = df.append([pd_dict])
list_for_dataframe.append(pd_dict)

df = pd.DataFrame(list_for_dataframe, columns=['y','x']+properties+['frame'])

t = trackpy.link(df,max_dist,memory=memory)
return(t)
Expand Down

0 comments on commit 1316bc8

Please sign in to comment.