Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Mar 30, 2024
1 parent d7f6b4d commit 444d612
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .rtd-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: rtd_sunkit_image
channels:
- conda-forge
dependencies:
- python=3.10
- python=3.12
- pip
- graphviz!=2.42.*,!=2.43.*
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ repository = "https://github.com/LM-SAL/irispy-lmsal"
all = ["sunkit_image"]
tests = [
"sunkit_image[all]",
'dask',
'pytest-astropy',
'pytest-mpl',
]
Expand Down
6 changes: 3 additions & 3 deletions sunkit_image/tests/test_asda.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ def test_asda_artificial():
vmax = 2.0 # rotating speed
rmax = 50 # radius
ratio = 0.2 # ratio of expanding speed over rotating speed
with pytest.raises(ValueError, match="Keyword 'r' must be an integer"):
with pytest.raises(TypeError, match="Keyword 'r' must be an integer"):
lo = asda.Lamb_Oseen(vmax=vmax, rmax=rmax, ratio_vradial=ratio, factor=1, r=1.2)

with pytest.raises(ValueError, match="Keyword 'factor' must be an integer"):
with pytest.raises(TypeError, match="Keyword 'factor' must be an integer"):
lo = asda.Lamb_Oseen(vmax=vmax, rmax=rmax, ratio_vradial=ratio, factor=1.2, r=1)

with pytest.raises(ValueError, match="Keyword 'factor' must be an integer"):
with pytest.raises(TypeError, match="Keyword 'factor' must be an integer"):
lo = asda.Lamb_Oseen(vmax=vmax, rmax=rmax, ratio_vradial=ratio, factor=1.2, r=1)

with pytest.warns(UserWarning, match="One of the input parameters is missing, setting both to 'None'"):
Expand Down
6 changes: 3 additions & 3 deletions sunkit_image/tests/test_enhance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def map_test():

def test_multiscale_gaussian(map_test):
# Assuming the algorithm works fine then the below two should be equal.
expect1 = enhance.mgn(map_test, [1])
expect2 = enhance.mgn(map_test, [1, 1])
expect1 = enhance.mgn(map_test, sigma=[1])
expect2 = enhance.mgn(map_test, sigma=[1, 1])
assert np.allclose(expect1, expect2)

result1 = np.zeros((4, 4), dtype=float)
expect3 = enhance.mgn(map_test, [1])
expect3 = enhance.mgn(map_test, sigma=[1])
assert np.allclose(result1, expect3)

# This is a dummy test.
Expand Down
2 changes: 1 addition & 1 deletion sunkit_image/tests/test_granule.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_get_threshold_range():


def test_get_threshold_errors():
with pytest.raises(ValueError, match="Input data must be an instance of a np.ndarray"):
with pytest.raises(TypeError, match="Input data must be an instance of a np.ndarray"):
_get_threshold([], "li")
with pytest.raises(ValueError, match="Method must be one of: li, otsu, yen, mean, minimum, triangle, isodata"):
_get_threshold(np.array([[1, 2], [1, 2]]), "banana")
Expand Down
5 changes: 4 additions & 1 deletion sunkit_image/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def _erase_loop_in_image(image, istart, jstart, width, xloop, yloop):
return image


def _loop_add(lengths, xloop, yloop, iloop, loops):
def _loop_add(lengths, xloop, yloop, zloop, iloop, loops): # NOQA: ARG001
"""
Adds the current loop to the output structures by interpolating the
coordinates.
Expand All @@ -381,6 +381,9 @@ def _loop_add(lengths, xloop, yloop, iloop, loops):
The ``x`` coordinates of all the points of the loop.
yloop : `numpy.ndarray`
The ``y`` coordinates of all the points of the loop.
zloop : `numpy.ndarray`
The flux intensity at every point of the loop.
TODO: Unuzed variable. Determine if it is needed.
iloop : `int`
The current loop number.
loops : `list`
Expand Down
2 changes: 1 addition & 1 deletion sunkit_image/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_points_in_poly():

def test_reform_2d():
test_data = np.asarray([[0, 0], [1, 2], [3, 4]])
with pytest.raises(ValueError, match="Parameter 'factor' must be an integer!"):
with pytest.raises(TypeError, match="Parameter 'factor' must be an integer!"):
utils.reform2d(test_data, 2.2)
with pytest.raises(ValueError, match="Input array must be 2d!"):
utils.reform2d(test_data[0], 2)
Expand Down

0 comments on commit 444d612

Please sign in to comment.