Asda#

class sunkit_image.asda.Asda(vx, vy, r=3, factor=1)[source]#

Bases: object

Version 2.0 of Automated Swirl Detection Algorithm (ASDA).

References

Methods Summary

center_edge([rmin, gamma_min])

Find all swirls from gamma1, and gamma2.

gamma_values()

Calculate gamma1 and gamma2 values of velocity field vx and vy.

gen_vel(i, j)

Given a point [i, j], generate a velocity field which contains a region with a size of (2r+1) x (2r+1) centered at [i, j] from the original velocity field self.vx and self.vy.

vortex_property([image])

Calculate expanding, rotational speed, equivalent radius and average intensity of given swirls.

Methods Documentation

center_edge(rmin=4, gamma_min=0.89)[source]#

Find all swirls from gamma1, and gamma2.

Parameters:
  • rmin (int, optional) – Minimum radius of swirls, all swirls with radius less than rmin will be rejected. Defaults to 4.

  • gamma_min (float, optional) – Minimum value of gamma1, all potential swirls with peak gamma1 values less than gamma_min will be rejected.

Returns:

dict – The keys and their meanings of the dictionary are: center : Center locations of vortices, in the form of [x, y]. edge : Edge locations of vortices, in the form of [x, y]. points : All points within vortices, in the form of [x, y]. peak : Maximum/minimum gamma1 values in vortices. radius : Equivalent radius of vortices. All results are in pixel coordinates.

gamma_values()[source]#

Calculate gamma1 and gamma2 values of velocity field vx and vy.

Returns:

tuple – A tuple in form of (gamma1, gamma2), where gamma1 is useful in finding vortex centers and gamma2 is useful in finding vortex edges.

gen_vel(i, j)[source]#

Given a point [i, j], generate a velocity field which contains a region with a size of (2r+1) x (2r+1) centered at [i, j] from the original velocity field self.vx and self.vy.

Parameters:
  • i (int) – first dimension of the pixel position of a target point.

  • j (int) – second dimension of the pixel position of a target point.

Returns:

numpy.ndarray – The first dimension is a velocity field which contains a region with a size of (2r+1) x (2r+1) centered at [i, j] from the original velocity field self.vx and self.vy. the second dimension is similar as the first dimension, but with the mean velocity field subtracted from the original velocity field.

vortex_property(image=None)[source]#

Calculate expanding, rotational speed, equivalent radius and average intensity of given swirls.

Parameters:

image (numpy.ndarray) – Has to have the same shape as self.vx observational image, which will be used to calculate the average observational values of all swirls.

Returns:

tuple – The returned tuple has four components, which are:

ve : expanding speed, in the same unit as self.vx or self.vy. vr : rotational speed, in the same unit as self.vx or self.vy. vc : velocity of the center, in the form of [vx, vy]. ia : average of the observational values within the vortices if the parameter image is given.