-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove unnecessary encoding lines * Docstring revisions * Add interface documentation * Docstring revision * Remove unnecessary encoding line * Add tests * Remove unnecessary import * Add option to restrict the number of blobs based on their scale-space intensity * Add max_num_features keyword argument * Add tests for max_num_features * Add documentation about feature selection when max_num_features is not None * Add area to cell attributes and option to choose the maximum number of cells by area * Add tests for max_num_features * Add normalization of blob intensities by multiplication with sigma**2 * Fix typo in if clause * Adjust the number of columns to include cell area * Sord IDs to ensure correct comparison * Fix incorrect indexing * Remove unused metadata variable * Rename input to input_field to avoid redefining a built-in
- Loading branch information
Showing
7 changed files
with
106 additions
and
27 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
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 pytest | ||
import numpy as np | ||
from pysteps import feature | ||
from pysteps.tests.helpers import get_precipitation_fields | ||
|
||
arg_names = ["method", "max_num_features"] | ||
arg_values = [("blob", None), ("blob", 5), ("shitomasi", None), ("shitomasi", 5)] | ||
|
||
|
||
@pytest.mark.parametrize(arg_names, arg_values) | ||
def test_feature(method, max_num_features): | ||
input_field, _ = get_precipitation_fields(0, 0, True, True, None, "mch") | ||
|
||
detector = feature.get_method(method) | ||
|
||
kwargs = {"max_num_features": max_num_features} | ||
output = detector(input_field.squeeze(), **kwargs) | ||
|
||
assert isinstance(output, np.ndarray) | ||
assert output.ndim == 2 | ||
assert output.shape[0] > 0 | ||
if max_num_features is not None: | ||
assert output.shape[0] <= max_num_features | ||
assert output.shape[1] == 2 |
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