Finding the brightest pixel

Reference: corresponding sunpy webpage.

using SunPy, PythonCall
using SunPy: Map
@py import sunpy.data.sample: AIA_171_IMAGE
@py import astropy.units as u

aia = Map(AIA_171_IMAGE)
pixel_pos = Tuple(argmax(aia')) .* u.pixel
hpc_max = aia.wcs.pixel_to_world(pixel_pos...)
Python:
<SkyCoord (Helioprojective: obstime=2011-06-07T06:33:02.880, rsun=696000.0 km, …
    (-0.00406429, 0.04787238, 1.51846026e+11)>): (Tx, Ty) in arcsec
    (714.77561397, -359.55428773)>

Let’s now plot the results.

@py import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(projection=aia)
aia.plot(axes=ax)
ax.plot_coord(hpc_max, "wx", fillstyle="none", markersize=10)
fig
Example block output

Acceleration

julia> using Chairmarks
julia> @py import numpy as np
julia> @b sunpy.map.Map(AIA_171_IMAGE) @py(np.argwhere(_.data == _.data.max()))WARNING: VerifyWarning: Invalid 'BLANK' keyword in header. The 'BLANK' keyword is only applicable to integer data, and will be ignored in this HDU. [astropy.io.fits.hdu.image] 2.979 ms (4 allocs: 64 bytes)
julia> @b Map(AIA_171_IMAGE) argmax(_')2.301 ms