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

ASDA has no gallery example #45

Open
nabobalis opened this issue Dec 22, 2019 · 2 comments
Open

ASDA has no gallery example #45

nabobalis opened this issue Dec 22, 2019 · 2 comments

Comments

@nabobalis
Copy link
Contributor

nabobalis commented Dec 22, 2019

Currently ASDA has no gallery example.

Below is a heavy WIP one that needs many additions and explanations (answers to which I don't have). This requires reading up on the ASDA papers and the code to understand how it performs and what each parameter is.

"""
================
Detecting Swirls
================

This example showcases how to use Automated Swirl Detection Algorithm (ASDA) to
detect swirls in velocity fields.
"""

import matplotlib.pyplot as plt
import numpy as np

from sunkit_image.asda import Asda
from sunkit_image.data.test import get_test_filepath

###########################################################################
# This examples demonstrates find swirls in a 2D velocity flow field.
# We will use precomputed a flow field from our test data.
# First thing is to load the velocity field and data.

vxvy = np.load(get_test_filepath("asda_vxvy.npz"))
vx = vxvy["vx"]
vy = vxvy["vy"]
data = vxvy["data"]

###########################################################################
# Now we will call `~sunkit_image.asda.Asda` to perform swirl detection

# Initialise class
# TODO Explain Factor
lo = Asda(vx, vy, factor=1)
# Gamma
# TODO Explain Gamma
gamma = lo.gamma_values()
# Determine Swirls
# TODO Explain This
center_edge = lo.center_edge()
# Properties of Swirls
# TODO Explain This
# DO I even want this?
# Useful in a table maybe?
ve, vr, vc, ia = lo.vortex_property(image=data)

###########################################################################
# Finally we will visualize the results.

# TODO What about a swirl map?
fig, ax = plt.subplots()
ax.imshow(gamma[..., 0], origin="lower")
ax.set_title(r"$\Gamma_1$")
ax.set(xlabel="x", ylabel="y")
plt.show()

fig, ax = plt.subplots()
ax.imshow(gamma[..., 1], origin="lower")
ax.set_title(r"$\Gamma_2$")
ax.set(xlabel="x", ylabel="y")
plt.show()
@druhi021204
Copy link

can I work on this issue?

@nabobalis
Copy link
Contributor Author

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants