-
Notifications
You must be signed in to change notification settings - Fork 44
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
ProjectionOperator Bug Fix (Issue #1990) #2065
Open
M-A-Demir
wants to merge
13
commits into
master
Choose a base branch
from
projectionop_bug_1990
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
080c437
Update in response to issue #1990: ProjectionOperator device input is…
M-A-Demir e0b5a30
Update developer_guide.rst
M-A-Demir 24bfd81
Added unittest.skipUnless for new tests requiring ASTRA
M-A-Demir 3948680
Merge branch 'master' of github.com:TomographicImaging/CIL into proje…
M-A-Demir 1fd05dc
Added unittest.skipUnless for new tests requiring ASTRA
M-A-Demir b808f14
Merge branch 'projectionop_bug_1990' of github.com:TomographicImaging…
M-A-Demir dbafb16
Fixed unittest.parametrize test errors - Needed to make class TestAst…
M-A-Demir 17306ab
Added unittest.skipUnless conditions for CPU and GPU tests
M-A-Demir 488ebb8
Reverted changes to env setup bash script (temporarily)
M-A-Demir afd11d7
Added pip_install_pkgs list for pip packages, and line at end that ex…
M-A-Demir 5ca13dc
Updated test logic for clarity and example in developer_guide.rst
M-A-Demir d7f6077
Merge branch 'master' of github.com:TomographicImaging/CIL into proje…
M-A-Demir 72bb484
Merge branch 'master' into projectionop_bug_1990
hrobarts 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 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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -22,14 +22,15 @@ | |||||||
from utils import has_astra, has_nvidia, initialise_tests | ||||||||
from utils_projectors import TestCommon_ProjectionOperatorBlockOperator | ||||||||
from cil.utilities import dataexample | ||||||||
from unittest_parametrize import param, parametrize, ParametrizedTestCase | ||||||||
|
||||||||
initialise_tests() | ||||||||
|
||||||||
if has_astra: | ||||||||
from cil.plugins.astra.operators import AstraProjector2D, AstraProjector3D | ||||||||
from cil.plugins.astra.operators import ProjectionOperator | ||||||||
|
||||||||
class TestAstraProjectors(unittest.TestCase): | ||||||||
class TestAstraProjectors(ParametrizedTestCase, unittest.TestCase): | ||||||||
def setUp(self): | ||||||||
|
||||||||
N = 128 | ||||||||
|
@@ -70,6 +71,46 @@ def setUp(self): | |||||||
|
||||||||
self.norm = 14.85 | ||||||||
|
||||||||
|
||||||||
def test_ProjectionOperator_img_geom_default(self): | ||||||||
K = ProjectionOperator(image_geometry=None, acquisition_geometry=self.ag, device='gpu') | ||||||||
assert(K.volume_geometry == self.ag.get_ImageGeometry()) | ||||||||
|
||||||||
def test_ProjectionOperator_acq_geom_default(self): | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
with self.assertRaises(TypeError): | ||||||||
ProjectionOperator(image_geometry=self.ig, acquisition_geometry=None, device='gpu') | ||||||||
|
||||||||
def test_ProjectionOperator_all_default(self): | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
with self.assertRaises(TypeError): | ||||||||
ProjectionOperator(image_geometry=None, acquisition_geometry=None, device='gpu') | ||||||||
|
||||||||
@parametrize("device, raise_error, err_type", | ||||||||
[param('cpu', False, None, id="cpu_NoError"), | ||||||||
param('CPU', False, None, id="CPU_NoError"), | ||||||||
param('InvalidInput', True, ValueError, id="InvalidInput_ValueError")]) | ||||||||
@unittest.skipUnless(has_astra, "Requires ASTRA") | ||||||||
def test_ProjectionOperator_2Ddata(self, device, raise_error: bool, err_type): | ||||||||
if raise_error: | ||||||||
with self.assertRaises(err_type): | ||||||||
ProjectionOperator(self.ig, self.ag, device) | ||||||||
else: | ||||||||
assert isinstance(ProjectionOperator(self.ig, self.ag, device), object) | ||||||||
|
||||||||
@parametrize("device, raise_error, err_type", | ||||||||
[param('gpu', False, None, id="gpu_NoError"), | ||||||||
param('GPU', False, None, id="GPU_NoError"), | ||||||||
param('cpu', True, NotImplementedError, id="cpu_NotImplementedError"), | ||||||||
param('CPU', True, NotImplementedError, id="CPU_NotImplementedError"), | ||||||||
param('InvalidInput', True, ValueError, id="InvalidInput_ValueError")]) | ||||||||
@unittest.skipUnless(has_astra and has_nvidia, "Requires ASTRA GPU") | ||||||||
def test_ProjectionOperator_3Ddata(self, device, raise_error: bool, err_type): | ||||||||
if raise_error: | ||||||||
with self.assertRaises(err_type): | ||||||||
ProjectionOperator(self.ig3, self.ag3, device) | ||||||||
else: | ||||||||
assert isinstance(ProjectionOperator(self.ig3, self.ag3, device), object) | ||||||||
|
||||||||
|
||||||||
def foward_projection(self, A, ig, ag): | ||||||||
image_data = ig.allocate(None) | ||||||||
image_data.fill(1) | ||||||||
|
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 |
---|---|---|
|
@@ -49,3 +49,6 @@ dependencies: | |
- numba | ||
- tqdm | ||
- zenodo_get >=1.6 | ||
- pip | ||
- pip: | ||
- unittest-parametrize |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.