-
Notifications
You must be signed in to change notification settings - Fork 2
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
Incorporate filters to enhance LD plots appearance #11
Comments
So far, the use of gradient-based filters for extraction of manifold curves from LD maps has been explored. See Issues #17 #18 #20 #25 However, the above seems ineffective to provide neat curves as graphical outputs highlighting the distinction of stable and unstable manifolds. @vkrajnak ... below, I provide example code-lines implementing this, alongside their graphical output. After computing LD values LD_forward = compute_lagrangian_descriptor(grid_parameters, vector_field, tau, p_value)
LD_backward = compute_lagrangian_descriptor(grid_parameters, vector_field, -tau, p_value) We used import matplotlib.pyplot as plt
from scipy.ndimage import laplace
fig, (ax1,ax2) = plt.subplots(1,2,figsize=(8,4),dpi=200,sharex=True,sharey=True)
ax1_min, ax1_max, N1 = slice_parameters[0]
ax2_min, ax2_max, N2 = slice_parameters[1]
points_ax1 = np.linspace(ax1_min, ax1_max, N1)
points_ax2 = np.linspace(ax2_min, ax2_max, N2)
X, Y = np.meshgrid(points_ax1, points_ax2)
LD = LD_forward + LD_backward
ax1.contourf(points_ax1, points_ax2,LD,cmap='bone',levels=200)
tol = 0.01
#compute laplacian
LD = LD_forward
scalar = laplace(LD)
scalar = scalar/scalar.max()
scalar = scalar**2
LDm = np.ma.masked_where(scalar < tol, scalar )
ax2.pcolor(X, Y, LDm, cmap='bwr')
# compute laplacian
LD = LD_backward
scalar = laplace(LD)
scalar = scalar/scalar.max()
scalar = scalar**2
LDm = np.ma.masked_where(scalar < tol, scalar )
ax2.pcolor(X, Y, -LDm, cmap='bwr')
#ax1.set_xlim(-4,4)
#ax1.set_ylim(-1,1)
ax1.set_xlim(-5.5, 5.5)
ax1.set_ylim(-1.25, 1.25)
fig.suptitle("$ PES(k = k_c), \Delta H_0 = "+str(dH)+" : LD_p^{total}, p = 1/2, \\tau$ = "+str(tau), fontsize=14, y=1.04)
ax1.set_xlabel("$x$")
ax2.set_xlabel("$x$")
ax1.set_ylabel("$p_x$")
fig.tight_layout()
plt.show() |
@vkrajnak Just remembered I posted some code where I show how to use the Laplacian to highlight the location of invariant manifolds. Maybe keep this in mind when working on the implementation of filters. |
A proof of concept can be found on the |
For the future, this can be done by defining our own filters, OR
Use other filters implemented by other Python libraries for image-processing.
The text was updated successfully, but these errors were encountered: