Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/348.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Increased the minimum required version of ``scikit-image`` to 0.24.0, and replaced usage of the deprecated ``sunpy.map.GenericMap.dimensions`` property with ``sunpy.map.GenericMap.data.shape``, and removed use of ``skimage.morphology.footprint_rectangle``.
4 changes: 2 additions & 2 deletions examples/aligning_aia_with_eis_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
# Before coaligning the images, we first resample the AIA image to the same plate
# scale as the EIS image. This will ensure better results from our coalignment.

nx = (aia_map.scale.axis1 * aia_map.dimensions.x) / eis_map.scale.axis1
ny = (aia_map.scale.axis2 * aia_map.dimensions.y) / eis_map.scale.axis2
nx = (aia_map.scale.axis1 * aia_map.data.shape[1] * u.pix) / eis_map.scale.axis1
ny = (aia_map.scale.axis2 * aia_map.data.shape[0] * u.pix) / eis_map.scale.axis2

aia_downsampled = aia_map.resample(u.Quantity([nx, ny]))

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"astropy>=6.1.0",
"astropy>=7.0.0",
"numpy>=1.26.0",
"matplotlib>=3.8.0",
"scipy>=1.12.0",
"scikit-image>=0.20.0",
"scikit-image>=0.24.0",
"sunpy[map]>=7.0.0",
]

Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ filterwarnings =
ignore:leap-second auto-update failed:astropy.utils.exceptions.AstropyWarning
ignore:.*deprecated - use.*:pyparsing.warnings.PyparsingDeprecationWarning
ignore:.*argument is deprecated, use.*:pyparsing.warnings.PyparsingDeprecationWarning
# scikit-image 0.27 warns on every call to functions that will change in skimage2
ignore:`skimage\..*` is deprecated in favor of:PendingDeprecationWarning
4 changes: 2 additions & 2 deletions sunkit_image/coalignment/tests/test_coalignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def incorrect_pointing_cutout_map_and_shift(request, cutout_map):

@pytest.mark.remote_data()
def test_coalignment_eis_aia(eis_test_map, aia193_test_map):
nx = (aia193_test_map.scale.axis1 * aia193_test_map.dimensions.x) / eis_test_map.scale[0]
ny = (aia193_test_map.scale.axis2 * aia193_test_map.dimensions.y) / eis_test_map.scale[1]
nx = (aia193_test_map.scale.axis1 * aia193_test_map.data.shape[1] * u.pix) / eis_test_map.scale[0]
ny = (aia193_test_map.scale.axis2 * aia193_test_map.data.shape[0] * u.pix) / eis_test_map.scale[1]
aia193_test_downsampled_map = aia193_test_map.resample(u.Quantity([nx, ny]))
coaligned_eis_map = coalign_map(eis_test_map, aia193_test_downsampled_map, method="match_template")
# Check that correction is as expected based on known pointing offset
Expand Down
4 changes: 2 additions & 2 deletions sunkit_image/radial.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,8 @@ def fnrgf(
radial_bin_edges, map_r = find_radial_bin_edges(smap, radial_bin_edges)

# Get the Helioprojective coordinates of each pixel
x, y = np.meshgrid(*[np.arange(v.value) for v in smap.dimensions]) * u.pix
coords = smap.pixel_to_world(x, y).transform_to(frames.Helioprojective)
x, y = np.meshgrid(*[np.arange(n) for n in smap.data.shape[::-1]])
coords = smap.wcs.pixel_to_world(x, y).transform_to(frames.Helioprojective)

# Get angles associated with every pixel
angles = np.arctan2(coords.Ty.value, coords.Tx.value)
Expand Down
15 changes: 2 additions & 13 deletions sunkit_image/stara.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
import skimage
from skimage.filters import median
from skimage.morphology import disk, white_tophat
from skimage.util import invert
Expand All @@ -8,12 +7,6 @@

import sunpy.map

if skimage.__version__ < "0.25.0":
# Need to account for https://github.com/scikit-image/scikit-image/pull/7566/files
from skimage.morphology import square
else:
from skimage.morphology import footprint_rectangle

__all__ = ["stara"]


Expand Down Expand Up @@ -73,12 +66,8 @@ def stara(
# Median filter to remove detections based on hot pixels
m_pix = int((median_box / smap.scale[0]).to_value(u.pix))

if skimage.__version__ < "0.25.0":
function = square(m_pix)
else:
function = footprint_rectangle((m_pix, m_pix))

med = median(data, function, behavior="ndimage")
footprint = np.ones((m_pix, m_pix), dtype=np.uint8)
med = median(data, footprint, behavior="ndimage")

# Construct the pixel structuring element
c_pix = int((circle_radius / smap.scale[0]).to_value(u.pix))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sunkit_image.coalignment.tests.test_coalignment.test_coalignment_figure[incorrect_pointing_cutout_map_and_shift0]": "ce40f5667e62443a8a48f7fac2ea320d159f6026572e7c879d7746da800ae17e",
"sunkit_image.coalignment.tests.test_coalignment.test_coalignment_figure[incorrect_pointing_cutout_map_and_shift1]": "2b8134d3d32cc38f0855b4aca96e8a04219bd4205def9af0e87877232029f634",
"sunkit_image.coalignment.tests.test_coalignment.test_coalignment_figure[incorrect_pointing_cutout_map_and_shift2]": "f2c3574c80d36e0e0cd8c365aae037c5e5ef5fe74a4232663d1b8bc8db705f81",
"sunkit_image.coalignment.tests.test_coalignment.test_coalignment_figure[incorrect_pointing_cutout_map_and_shift0]": "cd14b11bb25e54f6b3d2f568cb183fdd057b339204f34141f311e4ef871a9561",
"sunkit_image.coalignment.tests.test_coalignment.test_coalignment_figure[incorrect_pointing_cutout_map_and_shift1]": "6214e4d20869c2239d24ecf2a24ed5a31954a15de431a6deb26134227d54e291",
"sunkit_image.coalignment.tests.test_coalignment.test_coalignment_figure[incorrect_pointing_cutout_map_and_shift2]": "b620292ff1f42c6ea60a6651d4c9d41923d709ef246ee7676c9371e67b5a34e0",
"sunkit_image.tests.test_enhance.test_mgn[array]": "d3ed034e34d03288aad08c06447fde42a8eb5c7ce4c0543a2090bb04c75fad1a",
"sunkit_image.tests.test_enhance.test_mgn[map]": "50bb490a6cc2408befe13c7f2a54f7433df80c2473dd21b619ace35de7e8f250",
"sunkit_image.tests.test_enhance.test_mgn_submap": "cf3948d3ffa8ed4eacc500bee170db68bb1a96d2cec1c92e48f74c01827dc397",
Expand All @@ -13,9 +13,9 @@
"sunkit_image.tests.test_radial.test_fig_nrgf": "57b79f69ba537ff2ee37a879048f7d1232173567cc8c7b2e46988cb8b11a5575",
"sunkit_image.tests.test_radial.test_fig_fnrgf": "42044b0b483cd9623c59530c93f4e71b817df335050a71bb9c026cbf429cd7bd",
"sunkit_image.tests.test_radial.test_fig_rhef": "1c97e4b501d6f614b8777ef36c97a1d17645287020d2979c206f84d51cce6db6",
"sunkit_image.tests.test_radial.test_multifig_rhef": "090d0416549db66274e1cfd8cd8a12cbaa2ed7062b641894977d5a75fd89c784",
"sunkit_image.tests.test_radial.test_multifig_rhef": "738021ce97cd5f7debfe4d693fa04c8ab7ba0043219cf9c8f3929d51ea1a1195",
"sunkit_image.tests.test_stara.test_stara_plot": "5aac9b08827c4e7ae77919d8cf123f4c0852e6da17c9e436408aff64cc6132e5",
"sunkit_image.tests.test_trace.test_occult2_fig[array]": "e59f4c476b6b27788ab8dc397cb0d2f34f8d6032eced289fd2eabeb324b39558",
"sunkit_image.tests.test_trace.test_occult2_fig[map]": "e59f4c476b6b27788ab8dc397cb0d2f34f8d6032eced289fd2eabeb324b39558",
"sunkit_image.tests.test_trace.test_occult2_cutout": "1b18459111342c3bab4a2c8fb08b012eef4a69767e08753d8918fe4987fa165d"
"sunkit_image.tests.test_trace.test_occult2_fig[array]": "37734310f9079bb2d0778f4bb9c525647307a2c30b8f493044afce034c3b86d5",
"sunkit_image.tests.test_trace.test_occult2_fig[map]": "37734310f9079bb2d0778f4bb9c525647307a2c30b8f493044afce034c3b86d5",
"sunkit_image.tests.test_trace.test_occult2_cutout": "63c8fddf4e4533ca52a4564f7f75fd8304b0b39275da98011539382058b94d53"
}
3 changes: 1 addition & 2 deletions sunkit_image/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def test_find_pixel_radii(aia_171):
# Calculate the pixel radii
pixel_radii = utils.find_pixel_radii(aia_171)
# The shape of the pixel radii is the same as the input map
assert pixel_radii.shape[0] == int(aia_171.dimensions[0].value)
assert pixel_radii.shape[1] == int(aia_171.dimensions[1].value)
assert pixel_radii.shape == aia_171.data.shape
# Make sure the unit is solar radii
assert pixel_radii.unit == u.R_sun
# Make sure the maximum
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ deps =
# Handle minimum dependencies via minimum_dependencies
oldestdeps: minimum_dependencies
# Figure tests need a tightly controlled environment
figure-!devdeps: astropy==7.2.0
figure-!devdeps: astropy==7.2.3
figure-!devdeps: matplotlib==3.10.8
figure-!devdeps: sunpy==7.1.0
# The following indicates which extras_require will be installed
Expand Down
Loading