From 6d69db657a1938cae3574ff0f2da13732c799da0 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Mar 2023 16:09:26 +0000 Subject: [PATCH 01/11] Make decorator to accept array or map input --- sunkit_image/utils/decorators.py | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 sunkit_image/utils/decorators.py diff --git a/sunkit_image/utils/decorators.py b/sunkit_image/utils/decorators.py new file mode 100644 index 00000000..b6a9c8ec --- /dev/null +++ b/sunkit_image/utils/decorators.py @@ -0,0 +1,50 @@ +import inspect +from typing import Union, Callable + +import numpy as np + +from sunpy.map import GenericMap, Map + + +def accept_array_or_map(*, arg_name: str) -> Callable[Callable, Callable]: + """ + Decorator that allows a function to accept an array or a + `sunpy.map.GenericMap` as an argument. + + This can be applied to functions that: + - Take a single array or map as input + - Return a single array that has the same pixel coordinates + as the input array. + + If the decorated function is given a map, this decorator will + automatically handle returning a map, with new data and the + original metadata. + """ + + def decorate(f: Callable) -> Callable: + sig = inspect.signature(f) + if arg_name not in sig.parameters: + raise RuntimeError(f"Could not find '{arg_name}' in function signature") + + def inner(*args, **kwargs) -> Union[np.ndarray, GenericMap]: + sig_bound = sig.bind(*args, **kwargs) + map_arg = sig_bound.arguments[arg_name] + if isinstance(map_arg, GenericMap): + map_in = True + sig_bound.arguments[arg_name] = map_arg.data + elif isinstance(map_arg, np.ndarray): + map_in = False + else: + raise ValueError(f"'{arg_name}' argument must be a sunpy map or numpy array (got type {type(map_arg)})") + + # Run decorated function + array_out = f(*sig_bound.args, **sig_bound.kwargs) + + if map_in: + return Map(array_out, map_arg.meta) + else: + return array_out + + return inner + + return decorate From a2b216cb0200aaa8999f5ea1baf601a812e90fd3 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Mar 2023 16:09:35 +0000 Subject: [PATCH 02/11] Apply array_or_map to mgn --- sunkit_image/enhance.py | 3 +++ sunkit_image/tests/test_enhance.py | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sunkit_image/enhance.py b/sunkit_image/enhance.py index ff243e48..d821bed9 100644 --- a/sunkit_image/enhance.py +++ b/sunkit_image/enhance.py @@ -6,9 +6,12 @@ import numpy as np import scipy.ndimage as ndimage +from sunkit_image.utils.decorators import accept_array_or_map + __all__ = ["mgn"] +@accept_array_or_map(arg_name="data") def mgn( data, sigma=[1.25, 2.5, 5, 10, 20, 40], diff --git a/sunkit_image/tests/test_enhance.py b/sunkit_image/tests/test_enhance.py index db58e1b7..76769537 100644 --- a/sunkit_image/tests/test_enhance.py +++ b/sunkit_image/tests/test_enhance.py @@ -8,19 +8,23 @@ from sunkit_image.tests.helpers import figure_test -@pytest.fixture +@pytest.fixture(params=["array", "map"]) @pytest.mark.remote_data -def smap(): - return sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) +def smap(request): + smap = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) + if request.param == "map": + return smap + elif request.param == "array": + return smap.data @figure_test @pytest.mark.remote_data def test_mgn(smap): - out = enhance.mgn(smap.data) - out = sunpy.map.Map(out, smap.meta) - - out.plot() + out = enhance.mgn(smap) + assert type(out) == type(smap) + if isinstance(out, sunpy.map.GenericMap): + out.plot() @pytest.fixture From 5bcf00df92dcd15b2983c7f1f62457ace90b4556 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Mar 2023 16:26:46 +0000 Subject: [PATCH 03/11] Allow map input to occult2 --- sunkit_image/tests/test_trace.py | 12 ++++++++---- sunkit_image/trace.py | 7 +++++-- sunkit_image/utils/decorators.py | 15 ++++++++++----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/sunkit_image/tests/test_trace.py b/sunkit_image/tests/test_trace.py index 70a0734b..7fadde96 100644 --- a/sunkit_image/tests/test_trace.py +++ b/sunkit_image/tests/test_trace.py @@ -4,6 +4,7 @@ import numpy as np import pytest +import sunpy.map from astropy.io import fits import sunkit_image.data.test as data @@ -19,13 +20,16 @@ ) -@pytest.fixture +@pytest.fixture(params=["array", "map"]) @pytest.mark.remote_data -def image_remote(): +def image_remote(request): with warnings.catch_warnings(): warnings.simplefilter("ignore", category=fits.verify.VerifyWarning) - im = fits.getdata("http://data.sunpy.org/sunkit-image/trace_1998-05-19T22:21:43.000_171_1024.fits") - return im + smap = sunpy.map.Map("http://data.sunpy.org/sunkit-image/trace_1998-05-19T22:21:43.000_171_1024.fits") + if request.param == "map": + return smap + elif request.param == "array": + return smap.data @pytest.fixture diff --git a/sunkit_image/trace.py b/sunkit_image/trace.py index ce87a728..c383add0 100644 --- a/sunkit_image/trace.py +++ b/sunkit_image/trace.py @@ -6,6 +6,8 @@ import numpy as np from scipy import interpolate +from sunkit_image.utils.decorators import accept_array_or_map + __all__ = [ "occult2", "bandpass_filter", @@ -17,6 +19,7 @@ ] +@accept_array_or_map(arg_name="image", output_to_map=False) def occult2(image, nsm1, rmin, lmin, nstruc, ngap, qthresh1, qthresh2): """ Implements the Oriented Coronal CUrved Loop Tracing (OCCULT-2) algorithm @@ -24,7 +27,7 @@ def occult2(image, nsm1, rmin, lmin, nstruc, ngap, qthresh1, qthresh2): Parameters ---------- - image : `numpy.ndarray` + image : `numpy.ndarray`, `sunpy.map.GenericMap` Image in which loops are to be detected. nsm1 : `int` Low pass filter boxcar smoothing constant. @@ -48,7 +51,7 @@ def occult2(image, nsm1, rmin, lmin, nstruc, ngap, qthresh1, qthresh2): ------- `list` A list of all loop where each element is itself a list of points containing - ``x`` and ``y`` coordinates for each point. + ``x`` and ``y`` pixel coordinates for each point. References ---------- diff --git a/sunkit_image/utils/decorators.py b/sunkit_image/utils/decorators.py index b6a9c8ec..29d84d88 100644 --- a/sunkit_image/utils/decorators.py +++ b/sunkit_image/utils/decorators.py @@ -6,7 +6,7 @@ from sunpy.map import GenericMap, Map -def accept_array_or_map(*, arg_name: str) -> Callable[Callable, Callable]: +def accept_array_or_map(*, arg_name: str, output_to_map=True) -> Callable[Callable, Callable]: """ Decorator that allows a function to accept an array or a `sunpy.map.GenericMap` as an argument. @@ -16,9 +16,14 @@ def accept_array_or_map(*, arg_name: str) -> Callable[Callable, Callable]: - Return a single array that has the same pixel coordinates as the input array. - If the decorated function is given a map, this decorator will - automatically handle returning a map, with new data and the - original metadata. + Parameters + ---------- + arg_name : `str` + Name of data/map argument in function signature. + output_to_map : `bool` + If `True` (the default), convert the function return to a map if a map + is given as input. For this to work the decorated function must return + an array where pixels have the same coordinates as the input map data. """ def decorate(f: Callable) -> Callable: @@ -40,7 +45,7 @@ def inner(*args, **kwargs) -> Union[np.ndarray, GenericMap]: # Run decorated function array_out = f(*sig_bound.args, **sig_bound.kwargs) - if map_in: + if map_in and output_to_map: return Map(array_out, map_arg.meta) else: return array_out From 304ab6287301e2126bb50cee1bfbc268168d5a12 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Mar 2023 16:26:50 +0000 Subject: [PATCH 04/11] Start a changelog --- changelog/xxx.feature.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/xxx.feature.rst diff --git a/changelog/xxx.feature.rst b/changelog/xxx.feature.rst new file mode 100644 index 00000000..b05a2891 --- /dev/null +++ b/changelog/xxx.feature.rst @@ -0,0 +1,6 @@ +Several functions have been updated to accept either numpy array or sunpy map inputs. +The following functions now accept either a numpy array or sunpy map, and return the same data type: +- `sunkit_image.enhance.mgn` + +The following functions now accept either a numpy array or sunpy map, and their return type is unchanged: +- `sunkit_image.trace.occult2` From 67d4853138ef3b11ca4aa8319fe7c8ad1bd3a57b Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Mar 2023 16:37:58 +0000 Subject: [PATCH 05/11] Allow arrays and maps to bandpass_filter --- changelog/xxx.feature.rst | 1 + sunkit_image/tests/conftest.py | 11 ++++++++++ sunkit_image/tests/test_enhance.py | 16 +++----------- sunkit_image/tests/test_trace.py | 35 ++++++++++++++++++------------ sunkit_image/trace.py | 1 + 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/changelog/xxx.feature.rst b/changelog/xxx.feature.rst index b05a2891..06251740 100644 --- a/changelog/xxx.feature.rst +++ b/changelog/xxx.feature.rst @@ -1,6 +1,7 @@ Several functions have been updated to accept either numpy array or sunpy map inputs. The following functions now accept either a numpy array or sunpy map, and return the same data type: - `sunkit_image.enhance.mgn` +- `sunkit_image.trace.bandpass_filter` The following functions now accept either a numpy array or sunpy map, and their return type is unchanged: - `sunkit_image.trace.occult2` diff --git a/sunkit_image/tests/conftest.py b/sunkit_image/tests/conftest.py index 16a46db6..04622de1 100644 --- a/sunkit_image/tests/conftest.py +++ b/sunkit_image/tests/conftest.py @@ -7,6 +7,7 @@ import astropy import astropy.config.paths +import sunpy.data.sample import sunpy.map from astropy.utils.data import get_pkg_data_filename from sunpy.coordinates import Helioprojective, get_earth @@ -141,3 +142,13 @@ def granule_minimap3(): ) map = sunpy.map.GenericMap(arr, header) return map + + +@pytest.fixture(params=["array", "map"]) +@pytest.mark.remote_data +def aia_171(request): + smap = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) + if request.param == "map": + return smap + elif request.param == "array": + return smap.data diff --git a/sunkit_image/tests/test_enhance.py b/sunkit_image/tests/test_enhance.py index 76769537..a424b680 100644 --- a/sunkit_image/tests/test_enhance.py +++ b/sunkit_image/tests/test_enhance.py @@ -8,21 +8,11 @@ from sunkit_image.tests.helpers import figure_test -@pytest.fixture(params=["array", "map"]) -@pytest.mark.remote_data -def smap(request): - smap = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE) - if request.param == "map": - return smap - elif request.param == "array": - return smap.data - - @figure_test @pytest.mark.remote_data -def test_mgn(smap): - out = enhance.mgn(smap) - assert type(out) == type(smap) +def test_mgn(aia_171): + out = enhance.mgn(aia_171) + assert type(out) == type(aia_171) if isinstance(out, sunpy.map.GenericMap): out.plot() diff --git a/sunkit_image/tests/test_trace.py b/sunkit_image/tests/test_trace.py index 7fadde96..e90a42c8 100644 --- a/sunkit_image/tests/test_trace.py +++ b/sunkit_image/tests/test_trace.py @@ -165,16 +165,18 @@ def test_map(): @pytest.fixture -def image(): +def test_map_ones(): return np.ones((4, 4), dtype=np.float32) -def test_bandpass_filter(image, test_map): +def test_bandpass_filter_ones(test_map_ones): expect = np.zeros((4, 4)) - result = bandpass_filter(image) + result = bandpass_filter(test_map_ones) assert np.allclose(expect, result) + +def test_bandpass_filter(test_map): expect = np.array( [ [0.0, 0.0, 0.0, 0.0], @@ -185,21 +187,26 @@ def test_bandpass_filter(image, test_map): ) result = bandpass_filter(test_map) - assert np.allclose(expect, result) - with pytest.raises(ValueError) as record: - _ = bandpass_filter(image, 5, 1) - assert str(record.value) == "nsm1 should be less than nsm2" +def test_bandpass_filter_output(aia_171): + # Check that bandpass filter works with both arrays and maps + result = bandpass_filter(aia_171) + assert type(result) == type(aia_171) + + +def test_bandpass_filter_error(test_map_ones): + with pytest.raises(ValueError, match="nsm1 should be less than nsm2"): + bandpass_filter(test_map_ones, 5, 1) -def test_smooth(image, test_map): - filtered = smooth(image, 1) - assert np.allclose(filtered, image) +def test_smooth(test_map_ones, test_map): + filtered = smooth(test_map_ones, 1) + assert np.allclose(filtered, test_map_ones) - filtered = smooth(image, 4) - assert np.allclose(filtered, image) + filtered = smooth(test_map_ones, 4) + assert np.allclose(filtered, test_map_ones) filtered = smooth(test_map, 1) assert np.allclose(filtered, test_map) @@ -217,7 +224,7 @@ def test_smooth(image, test_map): assert np.allclose(filtered, expect) -def test_erase_loop_in_image(image, test_map): +def test_erase_loop_in_image(test_map_ones, test_map): # The starting point of a dummy loop istart = 0 jstart = 1 @@ -227,7 +234,7 @@ def test_erase_loop_in_image(image, test_map): xloop = [1, 2, 3] yloop = [1, 1, 1] - result = erase_loop_in_image(image, istart, jstart, width, xloop, yloop) + result = erase_loop_in_image(test_map_ones, istart, jstart, width, xloop, yloop) expect = np.array([[0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0]]) diff --git a/sunkit_image/trace.py b/sunkit_image/trace.py index c383add0..e48570f1 100644 --- a/sunkit_image/trace.py +++ b/sunkit_image/trace.py @@ -224,6 +224,7 @@ def occult2(image, nsm1, rmin, lmin, nstruc, ngap, qthresh1, qthresh2): # The functions below this are subroutines for the OCCULT 2. +@accept_array_or_map(arg_name="image") def bandpass_filter(image, nsm1=1, nsm2=3): """ Applies a band pass filter to the image. From 70ae441a2efe27328c63815e9922b7c706a52076 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Mar 2023 16:39:47 +0000 Subject: [PATCH 06/11] Allow arrays and maps to smooth --- changelog/xxx.feature.rst | 1 + sunkit_image/tests/test_trace.py | 10 +++++++++- sunkit_image/trace.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/changelog/xxx.feature.rst b/changelog/xxx.feature.rst index 06251740..117b1b42 100644 --- a/changelog/xxx.feature.rst +++ b/changelog/xxx.feature.rst @@ -2,6 +2,7 @@ Several functions have been updated to accept either numpy array or sunpy map in The following functions now accept either a numpy array or sunpy map, and return the same data type: - `sunkit_image.enhance.mgn` - `sunkit_image.trace.bandpass_filter` +- `sunkit_image.trace.smooth` The following functions now accept either a numpy array or sunpy map, and their return type is unchanged: - `sunkit_image.trace.occult2` diff --git a/sunkit_image/tests/test_trace.py b/sunkit_image/tests/test_trace.py index e90a42c8..d0e655f2 100644 --- a/sunkit_image/tests/test_trace.py +++ b/sunkit_image/tests/test_trace.py @@ -201,13 +201,15 @@ def test_bandpass_filter_error(test_map_ones): bandpass_filter(test_map_ones, 5, 1) -def test_smooth(test_map_ones, test_map): +def test_smooth_ones(test_map_ones): filtered = smooth(test_map_ones, 1) assert np.allclose(filtered, test_map_ones) filtered = smooth(test_map_ones, 4) assert np.allclose(filtered, test_map_ones) + +def test_smooth(test_map): filtered = smooth(test_map, 1) assert np.allclose(filtered, test_map) @@ -224,6 +226,12 @@ def test_smooth(test_map_ones, test_map): assert np.allclose(filtered, expect) +def test_smooth_output(aia_171): + # Check that smooth works with both arrays and maps + result = smooth(aia_171, 1) + assert type(result) == type(aia_171) + + def test_erase_loop_in_image(test_map_ones, test_map): # The starting point of a dummy loop istart = 0 diff --git a/sunkit_image/trace.py b/sunkit_image/trace.py index e48570f1..7ed80d49 100644 --- a/sunkit_image/trace.py +++ b/sunkit_image/trace.py @@ -256,6 +256,7 @@ def bandpass_filter(image, nsm1=1, nsm2=3): return smooth(image, nsm1, "replace") - smooth(image, nsm2, "replace") +@accept_array_or_map(arg_name="image") def smooth(image, width, nanopt="replace"): """ Python implementation of the IDL's ``smooth``. From 569ef6d90582f372de011fca768f0cc0eca7600b Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 15 Mar 2023 16:46:50 +0000 Subject: [PATCH 07/11] Add new parameter doc --- sunkit_image/enhance.py | 7 ++++--- sunkit_image/trace.py | 12 +++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sunkit_image/enhance.py b/sunkit_image/enhance.py index d821bed9..e8fa9590 100644 --- a/sunkit_image/enhance.py +++ b/sunkit_image/enhance.py @@ -44,7 +44,7 @@ def mgn( Parameters ---------- - data : `numpy.ndarray` + data : `numpy.ndarray`, `sunpy.map.GenericMap` Image to be transformed. sigma : `list`, optional Range of Gaussian widths (i.e. the standard deviation of the Gaussian kernel) to transform over. @@ -75,8 +75,9 @@ def mgn( Returns ------- - `numpy.ndarray` - Normalized image. + `numpy.ndarray`, `sunpy.map.GenericMap` + Normalized image. If a map is input, a map is returned with new data + and the same metadata. References ---------- diff --git a/sunkit_image/trace.py b/sunkit_image/trace.py index 7ed80d49..87219bda 100644 --- a/sunkit_image/trace.py +++ b/sunkit_image/trace.py @@ -231,7 +231,7 @@ def bandpass_filter(image, nsm1=1, nsm2=3): Parameters ---------- - image : `numpy.ndarray` + image : `numpy.ndarray`, `sunpy.map.GenericMap` Image to be filtered. nsm1 : `int` Low pass filter boxcar smoothing constant. @@ -244,7 +244,8 @@ def bandpass_filter(image, nsm1=1, nsm2=3): Returns ------- `numpy.ndarray` - Bandpass filtered image. + Bandpass filtered image. If a map is input, a map is returned with new data + and the same metadata. """ if nsm1 >= nsm2: raise ValueError("nsm1 should be less than nsm2") @@ -263,7 +264,7 @@ def smooth(image, width, nanopt="replace"): Parameters ---------- - image : `numpy.ndarray` + image : `numpy.ndarray`, `sunpy.map.GenericMap` Image to be filtered. width : `int` Width of the boxcar window. The `width` should always be odd but if even value is given then @@ -273,8 +274,9 @@ def smooth(image, width, nanopt="replace"): Returns ------- - `numpy.ndarray` - Smoothed image. + `numpy.ndarray`, `sunpy.map.GenericMap` + Smoothed image. If a map is input, a map is returned with new data + and the same metadata. References ---------- From f76efb249fff2b9544b721c843838448de26acb7 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 9 Aug 2023 14:05:40 -0700 Subject: [PATCH 08/11] Update typing --- changelog/xxx.feature.rst | 2 ++ sunkit_image/utils/decorators.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog/xxx.feature.rst b/changelog/xxx.feature.rst index 117b1b42..52b57e55 100644 --- a/changelog/xxx.feature.rst +++ b/changelog/xxx.feature.rst @@ -1,8 +1,10 @@ Several functions have been updated to accept either numpy array or sunpy map inputs. The following functions now accept either a numpy array or sunpy map, and return the same data type: + - `sunkit_image.enhance.mgn` - `sunkit_image.trace.bandpass_filter` - `sunkit_image.trace.smooth` The following functions now accept either a numpy array or sunpy map, and their return type is unchanged: + - `sunkit_image.trace.occult2` diff --git a/sunkit_image/utils/decorators.py b/sunkit_image/utils/decorators.py index 29d84d88..48b8e910 100644 --- a/sunkit_image/utils/decorators.py +++ b/sunkit_image/utils/decorators.py @@ -6,12 +6,13 @@ from sunpy.map import GenericMap, Map -def accept_array_or_map(*, arg_name: str, output_to_map=True) -> Callable[Callable, Callable]: +def accept_array_or_map(*, arg_name: str, output_to_map=True) -> Callable[[Callable], Callable]: """ Decorator that allows a function to accept an array or a `sunpy.map.GenericMap` as an argument. This can be applied to functions that: + - Take a single array or map as input - Return a single array that has the same pixel coordinates as the input array. From 4b5414fde9e5bc3bdd8fdceb5b2963a218d8b4b0 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 9 Aug 2023 14:08:35 -0700 Subject: [PATCH 09/11] Update changelog name --- changelog/{xxx.feature.rst => 135.feature.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog/{xxx.feature.rst => 135.feature.rst} (100%) diff --git a/changelog/xxx.feature.rst b/changelog/135.feature.rst similarity index 100% rename from changelog/xxx.feature.rst rename to changelog/135.feature.rst From 8f50645c7f45dc93516d3a43829c35ef270cd425 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 9 Aug 2023 14:14:01 -0700 Subject: [PATCH 10/11] Tweak tests due to my bad merge --- sunkit_image/tests/test_trace.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sunkit_image/tests/test_trace.py b/sunkit_image/tests/test_trace.py index 04f1372b..659c3a23 100644 --- a/sunkit_image/tests/test_trace.py +++ b/sunkit_image/tests/test_trace.py @@ -25,11 +25,15 @@ def image_remote(request): with warnings.catch_warnings(): warnings.simplefilter("ignore", category=fits.verify.VerifyWarning) - smap = sunpy.map.Map("http://data.sunpy.org/sunkit-image/trace_1998-05-19T22:21:43.000_171_1024.fits") + data, header = fits.getdata( + "http://data.sunpy.org/sunkit-image/trace_1998-05-19T22:21:43.000_171_1024.fits", header=True + ) if request.param == "map": - return smap + return sunpy.map.Map((data, header)) elif request.param == "array": - return smap.data + return data + else: + raise ValueError(f"Invalid request parameter {request.param}") @pytest.fixture @@ -190,6 +194,7 @@ def test_bandpass_filter(test_map): assert np.allclose(expect, result) +@pytest.mark.remote_data def test_bandpass_filter_output(aia_171): # Check that bandpass filter works with both arrays and maps result = bandpass_filter(aia_171) @@ -226,6 +231,7 @@ def test_smooth(test_map): assert np.allclose(filtered, expect) +@pytest.mark.remote_data def test_smooth_output(aia_171): # Check that smooth works with both arrays and maps result = smooth(aia_171, 1) @@ -242,7 +248,7 @@ def test_erase_loop_in_image(test_map_ones, test_map): xloop = [1, 2, 3] yloop = [1, 1, 1] - result = _erase_loop_in_image(image, istart, jstart, width, xloop, yloop) + result = _erase_loop_in_image(test_map_ones, istart, jstart, width, xloop, yloop) expect = np.array([[0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0]]) From 8440481ee7746de65a1bab304c3a7d2b49fa751e Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 9 Aug 2023 14:35:22 -0700 Subject: [PATCH 11/11] update figure hashes --- ...es_mpl_372_ft_261_sunkit_image_dev_sunpy_500.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sunkit_image/tests/figure_hashes_mpl_372_ft_261_sunkit_image_dev_sunpy_500.json b/sunkit_image/tests/figure_hashes_mpl_372_ft_261_sunkit_image_dev_sunpy_500.json index 05e308a6..e69f4d65 100644 --- a/sunkit_image/tests/figure_hashes_mpl_372_ft_261_sunkit_image_dev_sunpy_500.json +++ b/sunkit_image/tests/figure_hashes_mpl_372_ft_261_sunkit_image_dev_sunpy_500.json @@ -1,6 +1,8 @@ { - "sunkit_image.tests.test_enhance.test_mgn": "4ef8a14c6b3290280b6fc9bc0748c8aa170760b2d43a5bbd67bb4d46ffd5408e", - "sunkit_image.tests.test_radial.test_fig_nrgf": "52b448fa9d845841066d71a1fc6e7bfc471a658d726af1cf16403ddb858fcfc0", - "sunkit_image.tests.test_radial.test_fig_fnrgf": "62621426ff8c3ee03cb1de004f9e08f63c4869dbd8b55d440adc73c74bfc5bcc", - "sunkit_image.tests.test_trace.test_occult2_fig": "c5ff1416cb51dc51ad1705174e5b13f8cb02486dc3c58fd79dc1b80534f6caf5" - } + "sunkit_image.tests.test_enhance.test_mgn[array]": "67b17ac7c343a1d568d9dfa2bb12e0041e2fc53e8ca1c0e1c2c7693eda2bd0d8", + "sunkit_image.tests.test_enhance.test_mgn[map]": "4ef8a14c6b3290280b6fc9bc0748c8aa170760b2d43a5bbd67bb4d46ffd5408e", + "sunkit_image.tests.test_radial.test_fig_nrgf": "52b448fa9d845841066d71a1fc6e7bfc471a658d726af1cf16403ddb858fcfc0", + "sunkit_image.tests.test_radial.test_fig_fnrgf": "62621426ff8c3ee03cb1de004f9e08f63c4869dbd8b55d440adc73c74bfc5bcc", + "sunkit_image.tests.test_trace.test_occult2_fig[array]": "c5ff1416cb51dc51ad1705174e5b13f8cb02486dc3c58fd79dc1b80534f6caf5", + "sunkit_image.tests.test_trace.test_occult2_fig[map]": "c5ff1416cb51dc51ad1705174e5b13f8cb02486dc3c58fd79dc1b80534f6caf5" +}