Skip to content

Commit

Permalink
Remove test against scipy
Browse files Browse the repository at this point in the history
  • Loading branch information
matbryan52 committed Jan 12, 2024
1 parent eacd7ee commit 7c96e2a
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import functools

import numpy as np
from numpy.testing import assert_allclose
import pytest
from scipy.signal import correlate2d

import libertem.masks as m
from libertem.utils.generate import cbed_frame
from libertem.io.dataset.memory import MemoryDataSet
from libertem.udf.masks import ApplyMasksUDF

from libertem_blobfinder import common
import libertem_blobfinder.common.correlation
from libertem_blobfinder.common.correlation import process_frames_fast
import libertem_blobfinder.common.patterns
from libertem_blobfinder.common.patterns import UserTemplate
import libertem_blobfinder.udf.refinement # noqa F401


Expand Down Expand Up @@ -205,29 +199,3 @@ def test_standalone_full():
print(peaks - refineds)

assert np.allclose(refineds[0], peaks, atol=0.5)


@pytest.mark.parametrize(
'where', ((0, 0), (2, 3)),
)
@pytest.mark.parametrize(
'peak', ((1, 1), (3, 2)),
)
def test_scipy_correlate2d(where, peak):
frame = np.zeros((5, 6))
frame[where] = 1
pattern = frame.copy()
correlated = correlate2d(frame, pattern, mode='same')
ref_center = np.unravel_index(
np.argmax(correlated),
frame.shape
)
centers, refineds, heights, elevations = process_frames_fast(
pattern=UserTemplate(pattern),
frames=np.array([frame]),
peaks=np.array([peak]),
upsample=False
)
print(frame)
print(ref_center, centers[0, 0])
assert_allclose(ref_center, centers[0, 0])

0 comments on commit 7c96e2a

Please sign in to comment.