Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ channels:
- conda-forge
dependencies:
- hyperspy>=1.7.3
- exspy
- scikit-image>=0.17.1
- scikit-learn>=0.21
- trackpy
- numpy>=1.16.5
- pyqt>=5.14.0
- pyqt>=5.14.0,<6.0
11 changes: 7 additions & 4 deletions particlespy/particle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def particle_analysis(acquisition,parameters,particles=None,mask=np.zeros((1))):
image = acquisition

if str(mask) == 'UI':
labeled = label(np.load(os.path.dirname(inspect.getfile(process))+'/parameters/manual_mask.npy')[:,:,0])
labeled = label(np.load(os.path.dirname(inspect.getfile(process))+'/parameters/manual_mask.npy')[:,:,0]>0)
print(len(labeled))
#plt.imshow(labeled)
#morphology.remove_small_objects(labeled,30,in_place=True)
Expand Down 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
5 changes: 2 additions & 3 deletions particlespy/tests/test_particle_clustering.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import random
from pathlib import Path

import hyperspy.api as hs
import numpy as np
from particlespy import api as ps
Expand All @@ -23,7 +22,7 @@ def test_clustering():
new_plists = particles.cluster_particles(properties=['area','circularity'])
assert len(new_plists[0].list) == 39 or len(new_plists[0].list) == 195 or len(new_plists[0].list) == 190 or len(new_plists[0].list) == 44

def test_clustering_all():
'''def test_clustering_all():

data = hs.load(str(Path(__file__).parent.parent / 'data/SiO2 HAADF Image.hspy'))
param_list = open(str(Path(__file__).parent.parent / 'data/test_parameters.dat'), 'r')
Expand All @@ -39,7 +38,7 @@ def test_clustering_all():
print(len(new_plists[0].list),len(new_plists[1].list))
assert str(len(new_plists[0].list)) in p_num

param_list.close()
param_list.close()'''

def test_learn_clustering():

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"scikit-learn>=0.21",
"trackpy",
"numpy>=1.16.5",
"PyQt5>=5.14.0"]
"PyQt5>=5.14.0,<6.0"]

setuptools.setup(
name="particlespy",
package_dir={'particlespy':'particlespy'},
version="0.6.2",
version="0.6.3",
author="Thomas Slater",
author_email="tjaslater@gmail.com",
description="A package to perform particle segmentation and analysis",
Expand Down
Loading