ParticleSpy package¶
Submodules¶
particlespy.particle_analysis module¶
Created on Tue Jul 31 13:35:23 2018
@author: qzo13262
- class particlespy.particle_analysis.parameters[source]¶
Bases:
object
A parameters object.
- generate(threshold='otsu', watershed=False, watershed_size=0, watershed_erosion=0, invert=False, min_size=0, store_im=False, pad=5, rb_kernel=0, gaussian=0, local_size=1)[source]¶
- particlespy.particle_analysis.particle_analysis(acquisition, parameters, particles=None, mask=array([0.0]))[source]¶
Perform segmentation and analysis of images of particles.
- acquisition: Hyperpsy signal object or list of hyperspy signal objects.
- Hyperpsy signal object containing a nanoparticle image or a list of signal
objects that contains an image at position 0 and other datasets following.
- parameters: Dictionary of parameters
The parameters can be input manually in to a dictionary or can be generated using param_generator().
- particles: list
List of already analysed particles that the output can be appended to.
- mask: Numpy array
Numpy array of same 2D size as acquisition that contains a mask of presegmented particles.
Particle_list object
- particlespy.particle_analysis.particle_analysis_series(image_series, parameters, particles=None)[source]¶
Perform segmentation and analysis of times series of particles.
- image_series: Hyperspy signal object or list of hyperspy signal objects.
- Hyperpsy signal object containing nanoparticle images or a list of signal
objects that contains a time series.
- parameters: Dictionary of parameters
The parameters can be input manually in to a dictionary or can be generated using param_generator().
- particles: list
List of already analysed particles that the output can be appended to.
Particle_list object
- particlespy.particle_analysis.time_series_analysis(particles, max_dist=1, memory=3, properties=['area'])[source]¶
Perform tracking of particles for times series data.
particles : Particle_list object. max_dist : int
The maximum distance between the same particle in subsequent images.
- memoryint
The number of frames to remember particles over.
- propertieslist
A list of particle properties to track over the time series.
Pandas DataFrame of tracjectories.
- class particlespy.particle_analysis.trainable_parameters(gaussian=[True, 1], diff_gaussian=[True, [False, 1], 1, 16], median=[True, [False, 1], 20], minimum=[True, [False, 1], 20], maximum=[True, [False, 1], 20], sobel=[True, [True, 1]], hessian=[False, [False, 1]], laplacian=[False, [False, 1]], membrane=[[False, 1], True, False, False, False, False, False])[source]¶
Bases:
object
A parameters object for trainable segmentation.
- set_diff_gaussian(enabled=True, prefilter=True, prefilter_sigma=1, low_sigma=1, high_sigma=16)[source]¶
particlespy.seg_ui module¶
Created on Mon Oct 22 15:50:08 2018
@author: qzo13262
- class particlespy.seg_ui.Application(im_hs, height)[source]¶
Bases:
PyQt5.QtWidgets.QMainWindow
particlespy.api module¶
Created on Mon Nov 5 09:48:31 2018
@author: qzo13262
- particlespy.api.plot(particle_lists, prop_list=['area'], **kwargs)[source]¶
Plots properties of all particles in the Particle_lists.
If one property given, displays a histogram of the chosen particle property.
If two properties given, displays a scatter plot of the two properties.
- particle_listslist
A list of Particle_list objects.
- prop_liststr or list
The name of a property or a list of the properties to plot.
- binsint
The number of bins in the histogram if plotting one property.
plot([particles],[‘area’])
particlespy.find_zoneaxis module¶
Created on Thu Jun 14 13:59:52 2018
@author: qzo13262
particlespy.particle_io module¶
particlespy.ptcl_class module¶
Created on Tue Jul 31 14:51:58 2018
@author: qzo13262
- class particlespy.ptcl_class.particle[source]¶
Bases:
object
A segmented particle object.
- propertiesdict
Dictionary of particle properties created by the ParticleAnalysis() function.
- originstr
Origin of particle data, e.g. filename or acquisition number.
- zonestr
Zone axis of particle.
- maskarray
Boolean array corresponding to the particle pixels on the original image.
- imageHyperspy signal object
Image of particle.
- mapsdict
Dictionary containing elemental maps of the particle.
- spectrumHyperspy signal object
Spectrum obtained from the particle.
- compositiondict
Dictionary of composition values for the particle.
- class particlespy.ptcl_class.particle_list[source]¶
Bases:
object
A particle list object.
- cluster_particles(algorithm='Kmeans', properties=None, n_clusters=2, eps=0.2, min_samples=5)[source]¶
Cluster particles in to different populations based on specified properties.
- algorithm: str
The algorithm to use for clustering. Options are ‘Kmeans’,’DBSCAN’,’OPTICS’,’AffinityPropagation’.
- properties: list
A list of the properties upon which to base the clustering.
- n_clusters: int
The number of clusters to split the data into. Used for Kmeans.
- eps: float
The distance between samples. Used for DBSCAN.
- min_samples: int
The minimum number of samples within the eps distance to be classed as a cluster. Used for DBSCAN and OPTICS.
List of Particle_list() objects.
- normalize_boxing(even=False)[source]¶
Normalizes the size of all particle images so that their dimensions are equal.
>>> particles.normalize_boxing()
- plot(prop_list=['area'], **kwargs)[source]¶
Plots properties of all particles in the Particle_list.
If one property given, displays a histogram of the chosen particle property.
If two properties given, displays a scatter plot of the two properties.
- prop_liststr or list
A particle property or a list of the names of the properties to plot.
- **kwargs
Keyword arguments for matplotlib plotting functions.
particles.plot(‘area’, bins=20)
particles.plot([‘equivalent circular diameter’,’circularity’])
particlespy.radial_profile module¶
Created on Tue May 28 09:58:37 2019
@author: qzo13262
- particlespy.radial_profile.concentric_scan_absolutedis(element_map)[source]¶
- Return:
dis_count_dict: keys ordered dict {dis0: countX0, dis1: countX1, …}
- particlespy.radial_profile.plot_profile(dist_count_dic, scale, units, mark_radius=False, radius=1.0, save=False, dir_save=None)[source]¶
Function to plot a radial profile of particle signals.
- dist_count_dicdict
Dictionary containing the distances and counts of the profile.
scale : float units : str mark_radius : bool
If true, mark the particle radius on the profile plot.
radius : float save : bool dir_save : str
Default : None
- particlespy.radial_profile.radial_profile(particle, signals, plot=True, mark_radius=False)[source]¶
Function to calculate and plot a radial profile of a signal from an individual particle.
- particleParticleSpy particle object
The particle object.
- signalslist
List of signals to plot, either ‘Image’ or element name, e.g. ‘Ag’.
- plotbool
True if plotting, False otherwise.
- mark_radiusbool
If true, mark the particle radius on the profile plot.
particlespy.segptcls module¶
Created on Tue Jul 31 15:06:08 2018
@author: qzo13262
- particlespy.segptcls.process(im, param)[source]¶
Perform segmentation of an image of particles.
- im: Hyperpsy signal object
Hyperpsy signal object containing a nanoparticle image.
- process_param: Dictionary of parameters
The parameters for segmentation.
numpy array: Labels corresponding to particles in the image.