-
Notifications
You must be signed in to change notification settings - Fork 83
Add shot_select support with set_unpack_params() method #276
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f32ee0c
Initial plan
Copilot ac516e2
Add shot_select parameter support to Params class
Copilot 8bca4a0
Update shot_select to use rawparams struct for LibRaw 0.21+
Copilot a99de4c
Add tests for shot_select parameter
Copilot d1ed981
Fix trailing whitespace and remove obsolete shot_select from params s…
Copilot cb32aa3
Move shot_select from postprocess to imread/open_file/open_buffer
Copilot 8fee04c
Refactor: create set_unpack_params() method instead of adding shot_se…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,45 @@ | ||
| """ | ||
| Test for shot_select parameter functionality | ||
| """ | ||
| import os | ||
| import pytest | ||
| import rawpy | ||
|
|
||
| thisDir = os.path.dirname(__file__) | ||
| rawTestPath = os.path.join(thisDir, 'iss030e122639.NEF') | ||
|
|
||
|
|
||
| def test_shot_select_parameter_via_imread(): | ||
| """Test that shot_select parameter can be passed to imread""" | ||
| # Test default shot_select=0 | ||
| with rawpy.imread(rawTestPath, shot_select=0) as raw: | ||
| rgb = raw.postprocess(no_auto_bright=True) | ||
| assert rgb is not None | ||
| assert rgb.shape[2] == 3 # RGB image | ||
|
|
||
|
|
||
| def test_shot_select_nonexistent_image(): | ||
| """Test that shot_select=1 raises error for single-image files""" | ||
| # Test shot_select=1 on a file with only one image should raise an error | ||
| with pytest.raises(rawpy.LibRawRequestForNonexistentImageError): | ||
| with rawpy.imread(rawTestPath, shot_select=1) as raw: | ||
| rgb = raw.postprocess(no_auto_bright=True) | ||
|
|
||
|
|
||
| def test_shot_select_via_open_file(): | ||
| """Test that shot_select can be passed via open_file""" | ||
| raw = rawpy.RawPy() | ||
| raw.open_file(rawTestPath, shot_select=0) | ||
| raw.unpack() | ||
| rgb = raw.postprocess() | ||
| assert rgb is not None | ||
| assert rgb.shape[2] == 3 | ||
| raw.close() | ||
|
|
||
|
|
||
| def test_shot_select_default_value(): | ||
| """Test that default shot_select value is 0""" | ||
| with rawpy.imread(rawTestPath) as raw: | ||
| rgb = raw.postprocess() | ||
| assert rgb is not None | ||
| assert rgb.shape[2] == 3 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.