-
-
Notifications
You must be signed in to change notification settings - Fork 583
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
Example Change, Travis Change, Doc Change #2338
Changes from 10 commits
4c855e2
7677f0e
82e9123
ab56427
e9a8336
9946ad8
e27bf6e
96a6536
181d970
c4709ce
d7cdef0
203becd
e2e6444
60a778c
d1f5f2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
""" | ||
================================= | ||
Finding and masking bright pixels | ||
================================= | ||
|
||
How to find and overplot the location of the brightest | ||
pixel and then mask any pixels out the area around this region. | ||
""" | ||
from __future__ import print_function, division | ||
|
||
import numpy as np | ||
import numpy.ma as ma | ||
import matplotlib.pyplot as plt | ||
|
||
import astropy.units as u | ||
|
||
import sunpy.map | ||
from sunpy.data.sample import AIA_171_IMAGE | ||
|
||
############################################################################### | ||
# We first create the Map using the sample data and import the coordinate | ||
# functionality. | ||
aia = sunpy.map.Map(AIA_171_IMAGE) | ||
|
||
############################################################################### | ||
# Now to find the single brightest pixel, we will maximium of the AIA image. | ||
# Note that we transform from pixel space to the world corodiate system. | ||
pixel_pos = np.argwhere(aia.data == aia.data.max())*u.pixel | ||
hpc_max = aia.pixel_to_world(pixel_pos[:, 1], pixel_pos[:, 0]) | ||
|
||
############################################################################### | ||
# Let's now plot the results. We will overlay the SunPy lon/lat grid. | ||
fig = plt.figure() | ||
ax = plt.subplot(projection=aia) | ||
aia.plot() | ||
ax.plot_coord(hpc_max, 'bx', color='white', marker='x', markersize=15) | ||
plt.show() | ||
|
||
############################################################################### | ||
# Now we create a new custom AIAMap with a mask around the brightest pixel. | ||
# We have to build two arrays which include all of the x and y pixel indices. | ||
# These indices are for the entire image. | ||
# We must not forget to add the correct units because we will next pass | ||
# into a SunPy function which all require them. | ||
x, y = np.meshgrid(*[np.arange(v.value) for v in aia.dimensions]) * u.pixel | ||
|
||
############################################################################### | ||
# Now we can convert this to helioprojective coordinates and create a new | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this text now seems out of sync with the rest of the example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought i changed that. Seems not! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well thats still correct to what i do in the code no? |
||
# array which contains the normalized radial position for each pixel adjusted | ||
# for the position of the brightest pixel (using `hpc_max`). | ||
hpc_mask = aia.pixel_to_world(x, y) | ||
r_mask = np.sqrt((hpc_mask.Tx-hpc_max.Tx) ** 2 + (hpc_mask.Ty-hpc_max.Ty) ** 2) / aia.rsun_obs | ||
mask = ma.masked_less_equal(r_mask, 0.1) | ||
scaled_map = sunpy.map.Map(aia.data, aia.meta, mask=mask.mask) | ||
|
||
############################################################################### | ||
# Let's now plot the new Map! | ||
fig = plt.figure() | ||
ax = plt.subplot(projection=scaled_map) | ||
scaled_map.plot() | ||
plt.show() |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a useful changelog entry!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES THEY ARE