Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure NCMAPSS scaling range is tuple #61

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rul_datasets/reader/ncmapss.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def __init__(
truncate_degraded_only: bool = False,
resolution_seconds: int = 1,
padding_value: float = 0.0,
scaling_range: Optional[Tuple[int, int]] = (0, 1),
scaling_range: Tuple[int, int] = (0, 1),
) -> None:
"""
Create a new reader for the New C-MAPSS dataset. The maximum RUL value is set
Expand Down Expand Up @@ -173,7 +173,7 @@ def __init__(
self.run_split_dist = run_split_dist or self._get_default_split(self.fd)
self.resolution_seconds = resolution_seconds
self.padding_value = padding_value
self.scaling_range = scaling_range
self.scaling_range = tuple(scaling_range)

if self.resolution_seconds > 1 and window_size is None:
warnings.warn(
Expand Down
8 changes: 8 additions & 0 deletions tests/reader/test_ncmapss.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,11 @@ def test_feature_select(prepared_ncmapss):
features, _ = reader.load_complete_split("dev", "dev")

assert features[0].shape[2] == 10


@pytest.mark.parametrize("scaling_range", [(0, 1), [0, 1]])
def test_scaling_range_is_tuple(scaling_range):
reader = NCmapssReader(1, scaling_range=scaling_range)

assert isinstance(reader.scaling_range, tuple)
assert reader.scaling_range == (0, 1)
Loading