Skip to content

ENH: Add FORBILD phantom in 2d#694

Merged
adler-j merged 2 commits intomasterfrom
forbild_phantom
Nov 18, 2016
Merged

ENH: Add FORBILD phantom in 2d#694
adler-j merged 2 commits intomasterfrom
forbild_phantom

Conversation

@adler-j
Copy link
Member

@adler-j adler-j commented Oct 31, 2016

This adds the FORBILD 2d phantom to the phantoms package:

img

At some point we should perhaps consider adding the 3d case, for that I would go for simply adding a phantom generator from the format specified by the phantomgruppe at Erlangen.

i = (equation1 <= 1.0)

# Handle clipping surfaces
if nclip > 0:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for if here, the for loop will be empty and not run otherwise.


# Handle clipping surfaces
if nclip > 0:
for j in range(1, nclip + 1):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

j is not used so might as well for _ in range(nclip):

transposeravel(ycoord) - phantomE[k, 1]])
D = np.array([[1 / phantomE[k, 2], 0],
[0, 1 / phantomE[k, 3]]])
phi = phantomE[k, 4] * np.pi / 180
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use deg2rad

if nclip > 0:
for j in range(1, nclip + 1):
d = phantomC[0, nclipinfo]
psi = phantomC[1, nclipinfo] * np.pi / 180.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use deg2rad

If true, insers a small resolution insert to the left.
ear : `bool`
If true, insers a ear-like structure to the right.
"""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define output

Copy link
Member

@kohr-h kohr-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool phantom, just fix some minor stuff.

resolution : `bool`
If true, insers a small resolution insert to the left.
ear : `bool`
If true, insers a ear-like structure to the right.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert
an ear-like structure

----------
resolution : `bool`
If true, insers a small resolution insert to the left.
ear : `bool`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no backticks


Parameters
----------
resolution : `bool`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no backticks

Parameters
----------
resolution : `bool`
If true, insers a small resolution insert to the left.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True
insert
resolution insert - ?? resolution test pattern?

phantomC = C[:, :12]
else:
phantomE = np.vstack([leftear, E, E_cavity])
phantomC = C
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you come up with all that stuff yourself? If yes, great, if no, add a reference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a reference in the main function:

.. _algorithm: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3426508/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I basically ported this to python

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah didn't see it. Okay, perhaps add it here too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit spammy to have it twice, especially given that this is a private function.

resolution : `bool`, optional
If true, insers a small resolution insert to the left.
ear : `bool`, optional
If true, insers a ear-like structure to the right.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste from above - insert corrected version

.. _algorithm: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3426508/
"""
def transposeravel(arr):
"""Implement matlabs ``transpose(arr(:))``."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MATLAB's

[-np.sin(phi), np.cos(phi)]])
f = phantomE[k, 5]
nclip = int(phantomE[k, 6])
equation1 = np.sum(((D.dot(Q)).dot(Vx0))**2, axis=0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8-ify


See Also
--------
shepp_logan : A more simple phantom with similar uses, also works in 3d.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simpler
for similar purposes
works -> working

if not isinstance(space, DiscreteLp):
raise TypeError('`space` must be a `DiscreteLp`')
if not space.ndim == 2:
raise TypeError('`space` must be two dimensional')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two-dimensional

If true, insers a small resolution insert to the left.
ear : `bool`, optional
If true, insers a ear-like structure to the right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output also missing here

@adler-j
Copy link
Member Author

adler-j commented Nov 18, 2016

Changes fixed. Merge after CI.

@adler-j adler-j merged commit 610ea9b into master Nov 18, 2016
@adler-j adler-j deleted the forbild_phantom branch November 18, 2016 13:58
@kohr-h kohr-h removed the reviewed label Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants