Skip to content

Instantly share code, notes, and snippets.

@vatch123
Created June 22, 2019 14:09
Show Gist options
  • Save vatch123/00fb51713320eabe776e7c2999f4a5ac to your computer and use it in GitHub Desktop.
Save vatch123/00fb51713320eabe776e7c2999f4a5ac to your computer and use it in GitHub Desktop.
import numpy as np
import sunpy.io
import matplotlib.pyplot as plt
import sunkit_image.enhance as enhance
aia = sunpy.io.fits.read("http://www.lmsal.com/~aschwand/software/tracing/EUVIA_20070430.fits")
# plt.imshow(aia[0].data, cmap='Reds_r')
# plt.show()
def test_image():
ima = np.zeros((11, 11), dtype=float)
ima[:,5] = 1.0
ima[3,6] = 1.0
ima[4,7] = 1.0
ima[5,8] = 1.0
ima[4,9] = 1.0
ima[3,10] = 1.0
return ima
# You can use any of the two settings to test
# image = aia[0].data
# base = 60
# qd = 0.7
# n1 = 5
# n2 = n1+2
# noise = 10
image = test_image()
base = 1
qd = 1
n1 = 1
n2 = n1+2
noise = 0
loops = enhance.occult2(image, base, noise_thresh=noise, qmed=qd, nsm1=n1, nsm2=n2, rmin=20, nmax=10000)
for loop in loops:
for points in loop:
image[points[1], points[0]] = 10000
fig4 = plt.figure()
plt.imshow(image)
fig4.canvas.set_window_title("loops")
plt.show()
len(loops)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment