Skip to content

Commit

Permalink
changelog, fix oldestdeps, fix mypy problem
Browse files Browse the repository at this point in the history
  • Loading branch information
emolter committed Sep 27, 2024
1 parent 83a8f1f commit d41546a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions changes/292.apichange.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `outlier_detection` median calculators from jwst.
10 changes: 6 additions & 4 deletions src/stcal/outlier_detection/median.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import tempfile
import warnings
from pathlib import Path
from typing import Any

import numpy as np

Expand Down Expand Up @@ -74,11 +75,12 @@ def __init__(self: MedianComputer,
self.buffer_size = buffer_size
self.dtype = dtype
if self.in_memory:
self._median_computer = np.empty(full_shape, dtype=dtype)
computer: Any = np.empty(full_shape, dtype=dtype)
else:
self._median_computer = OnDiskMedian(full_shape,
dtype=dtype,
buffer_size=buffer_size)
computer = OnDiskMedian(full_shape,
dtype=dtype,
buffer_size=buffer_size)
self._median_computer: Any = computer

def append(self: MedianComputer,
data: np.ndarray,
Expand Down
8 changes: 4 additions & 4 deletions tests/outlier_detection/test_median.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_disk_appendable_array(tmpdir):

slice_shape = (8,7)
dtype = "float32"
tempdir = tmpdir / Path("tmptest")
tempdir = Path(tmpdir) / Path("tmptest")
Path.mkdir(tempdir)
fname = tempdir / "test.bin"

Expand Down Expand Up @@ -58,7 +58,7 @@ def test_disk_appendable_array_bad_inputs(tmpdir):

slice_shape = (8, 7)
dtype = "float32"
tempdir = tmpdir / Path("tmptest")
tempdir = Path(tmpdir) / Path("tmptest")
fname = "test.bin"

# test input directory does not exist
Expand Down Expand Up @@ -92,7 +92,7 @@ def test_on_disk_median(tmpdir):
library_length = 3
frame_shape = (21, 20)
dtype = "float32"
tempdir = tmpdir / Path("tmptest")
tempdir = Path(tmpdir) / Path("tmptest")
Path.mkdir(tempdir)
shape = (library_length, *frame_shape)

Expand Down Expand Up @@ -171,7 +171,7 @@ def test_on_disk_median_bad_inputs(tmpdir):
library_length = 3
frame_shape = (21, 20)
dtype = "float32"
tempdir = tmpdir / Path("tmptest")
tempdir = Path(tmpdir) / Path("tmptest")
Path.mkdir(tempdir)
shape = (library_length, *frame_shape)

Expand Down

0 comments on commit d41546a

Please sign in to comment.