mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-07-08 05:10:09 +02:00
Merge pull request #67 from SAY-5/fix-np-int-visualize
Replace removed np.int alias with int in visualize
This commit is contained in:
commit
f80fc3f8f4
@ -52,9 +52,9 @@ class InteractivePlotter:
|
|||||||
self.spec_slices = spec_slices
|
self.spec_slices = spec_slices
|
||||||
self.call_info = call_info
|
self.call_info = call_info
|
||||||
# _, self.labels = np.unique([cc['class'] for cc in call_info], return_inverse=True)
|
# _, self.labels = np.unique([cc['class'] for cc in call_info], return_inverse=True)
|
||||||
self.labels = np.zeros(len(call_info), dtype=np.int)
|
self.labels = np.zeros(len(call_info), dtype=int)
|
||||||
self.annotated = np.zeros(
|
self.annotated = np.zeros(
|
||||||
self.labels.shape[0], dtype=np.int
|
self.labels.shape[0], dtype=int
|
||||||
) # can populate this with 1's where we have labels
|
) # can populate this with 1's where we have labels
|
||||||
self.labels_cols = [
|
self.labels_cols = [
|
||||||
colors[self.labels[ii]] for ii in range(len(self.labels))
|
colors[self.labels[ii]] for ii in range(len(self.labels))
|
||||||
|
|||||||
22
tests/test_utils/test_visualize.py
Normal file
22
tests/test_utils/test_visualize.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from batdetect2.utils.visualize import InteractivePlotter
|
||||||
|
|
||||||
|
|
||||||
|
def test_interactive_plotter_init_builds_integer_label_arrays():
|
||||||
|
feats_ds = np.zeros((2, 2))
|
||||||
|
spec_slices = [np.zeros((4, 6)), np.zeros((4, 8))]
|
||||||
|
call_info = [{"class": "a"}, {"class": "b"}]
|
||||||
|
|
||||||
|
plotter = InteractivePlotter(
|
||||||
|
feats_ds=feats_ds,
|
||||||
|
feats=feats_ds,
|
||||||
|
spec_slices=spec_slices,
|
||||||
|
call_info=call_info,
|
||||||
|
freq_lims=[0, 1],
|
||||||
|
allow_training=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert plotter.labels.shape == (2,)
|
||||||
|
assert np.issubdtype(plotter.labels.dtype, np.integer)
|
||||||
|
assert np.issubdtype(plotter.annotated.dtype, np.integer)
|
||||||
Loading…
Reference in New Issue
Block a user