-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60c8f02
commit 7870f72
Showing
4 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import numpy as np | ||
import pytest | ||
from xarray import DataArray | ||
|
||
from depiction.image.feature_selection import FeatureSelectionIQR, select_features | ||
from depiction.image.multi_channel_image import MultiChannelImage | ||
|
||
|
||
@pytest.fixture() | ||
def image() -> MultiChannelImage: | ||
return MultiChannelImage( | ||
DataArray( | ||
[[[1.0, 2, 0.0], [1.0, 5, 0.5], [1.0, 10, 0.0], [1.0, 20, 0.5], [1.0, 30, 0.0], [1.0, 40, 0.5]]], | ||
dims=("y", "x", "c"), | ||
coords={"c": ["channel1", "channel2", "channel3"]}, | ||
attrs={"bg_value": np.nan}, | ||
) | ||
) | ||
|
||
|
||
def test_select_features_iqr(image): | ||
fs = FeatureSelectionIQR.model_validate(dict(n_features=2)) | ||
selection = select_features(feature_selection=fs, image=image) | ||
assert selection == ["channel2", "channel3"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters