Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sys.exit(1)
try:
conf_disambig_map = sunpy.map.Map(file_conf_disambig)
except:
print("Could not open the conf_disambig fits file")
sys.exit(1)
try:
bitmap_map = sunpy.map.Map(file_bitmap)
except:
print("Could not open the bitmap fits file")
sys.exit(1)
try:
los_map = sunpy.map.Map(file_los)
except:
print("Could not open the LoS fits file")
sys.exit(1)
# get metadata
header = bz.meta
# get array data
bz = bz_map.data
by = by_map.data
bx_map = bx_map.data
bz_err_map = bz_err_map.data
by_err_map = by_err_map.data
bx_err_map = bx_err_map.data
conf_disambig_map = conf_disambig_map.data
bitmap_map = bitmap_map.data
sys.exit(1)
try:
bz_err_map = sunpy.map.Map(file_bz_err)
except:
print("Could not open the bz_err fits file")
sys.exit(1)
try:
by_err_map = sunpy.map.Map(file_by_err)
except:
print("Could not open the by_err fits file")
sys.exit(1)
try:
bx_err_map = sunpy.map.Map(file_bx_err)
except:
print("Could not open the bx_err fits file")
sys.exit(1)
try:
conf_disambig_map = sunpy.map.Map(file_conf_disambig)
except:
print("Could not open the conf_disambig fits file")
sys.exit(1)
try:
bitmap_map = sunpy.map.Map(file_bitmap)
except:
print("Could not open the bitmap fits file")
sys.exit(1)
sys.exit(1)
try:
by_err_map = sunpy.map.Map(file_by_err)
except:
print("Could not open the by_err fits file")
sys.exit(1)
try:
bx_err_map = sunpy.map.Map(file_bx_err)
except:
print("Could not open the bx_err fits file")
sys.exit(1)
try:
conf_disambig_map = sunpy.map.Map(file_conf_disambig)
except:
print("Could not open the conf_disambig fits file")
sys.exit(1)
try:
bitmap_map = sunpy.map.Map(file_bitmap)
except:
print("Could not open the bitmap fits file")
sys.exit(1)
try:
los_map = sunpy.map.Map(file_los)
except:
print("Could not open the LoS fits file")
sys.exit(1)
sys.exit(1)
try:
by_map = sunpy.map.Map(file_by)
except:
print("Could not open the by fits file")
sys.exit(1)
try:
bx_map = sunpy.map.Map(file_bx)
except:
print("Could not open the bx fits file")
sys.exit(1)
try:
bz_err_map = sunpy.map.Map(file_bz_err)
except:
print("Could not open the bz_err fits file")
sys.exit(1)
try:
by_err_map = sunpy.map.Map(file_by_err)
except:
print("Could not open the by_err fits file")
sys.exit(1)
try:
bx_err_map = sunpy.map.Map(file_bx_err)
except:
print("Could not open the bx_err fits file")
sys.exit(1)
# This particular image has lots of high intensity cosmic ray hits which
# cannot be effectively removed by using the default set of parameters.
# So we reduce ``sigclip``, the Laplacian to noise ratio from 4.5 to 2 to mark more hits.
# We also reduce ``objlim``, the contrast between the Laplacian image and the fine structured image
# to clean the high intensity bright cosmic ray hits.
# We also modify the ``readnoise`` parameter to obtain better results.
mask, clean_data = astroscrappy.detect_cosmics(lasco_map.data, sigclip=2, objlim=2, readnoise=4, verbose=True)
# This returns two variables - mask is a boolean array depicting whether there is
# a cosmic ray hit at that pixel, clean_data is the cleaned image after removing those
# hits.
###############################################################################
# We can now plot the cleaned image.
clean_map1 = Map(clean_data, lasco_map.meta)
fig2 = plt.figure()
clean_map1.plot()
plt.show()