Skip to content

Commit

Permalink
Updates from the package template (#251)
Browse files Browse the repository at this point in the history
Co-authored-by: Cadair <[email protected]>
Co-authored-by: Nabil Freij <[email protected]>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 500ebdf commit d902102
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/sunpy/package-template",
"commit": "5446d70263fff597b33ca7b0833aaeb5f3c3ac59",
"commit": "c66950b04d0a535002d122c9d5bc0f23534b530c",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.1"
rev: "v0.8.2"
hooks:
- id: ruff
args: ["--fix"]
Expand Down
13 changes: 11 additions & 2 deletions sunkit_image/stara.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from skimage.filters import median
from skimage.morphology import disk, square, white_tophat
from skimage.morphology import disk, white_tophat
from skimage.util import invert

import astropy.units as u
Expand Down Expand Up @@ -70,7 +70,16 @@ def stara(

# Median filter to remove detections based on hot pixels
m_pix = int((median_box / smap.scale[0]).to_value(u.pix))
med = median(data, square(m_pix), behavior="ndimage")

# Need to account for https://github.com/scikit-image/scikit-image/pull/7566/files
import skimage
if skimage.__version__ < "0.25.0":
from skimage.morphology import square
function = square(m_pix)
else:
from skimage.morphology import footprint_rectangle
function = footprint_rectangle((m_pix, m_pix))
med = median(data, function, behavior="ndimage")

# Construct the pixel structuring element
c_pix = int((circle_radius / smap.scale[0]).to_value(u.pix))
Expand Down

0 comments on commit d902102

Please sign in to comment.