-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from chrishavlin/rescale_option
add a data rescale option
- Loading branch information
Showing
6 changed files
with
96 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
from yt_napari._data_model import InputModel | ||
from yt_napari._model_ingestor import _process_validated_model | ||
from yt_napari._schema_version import schema_name | ||
|
||
jdicts = [] | ||
jdicts.append( | ||
{ | ||
"$schema": schema_name, | ||
"datasets": [ | ||
{ | ||
"filename": "_ytnapari_load_grid", | ||
"selections": { | ||
"regions": [ | ||
{ | ||
"fields": [{"field_name": "density", "field_type": "gas"}], | ||
"resolution": [10, 10, 10], | ||
} | ||
] | ||
}, | ||
} | ||
], | ||
} | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("jdict", jdicts) | ||
def test_load_region(jdict): | ||
jdict["datasets"][0]["selections"]["regions"][0]["rescale"] = True | ||
m = InputModel.parse_obj(jdict) | ||
layers, _ = _process_validated_model(m) | ||
im_data = layers[0][0] | ||
assert im_data.min() == 0.0 | ||
assert im_data.max() == 1.0 |
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