Commit 53c0d64a authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'single_plot_and_cosmetics' into 'NIFTy_5'

Single plot and cosmetics

See merge request !310
parents a976d920 037a9476
Pipeline #46631 passed with stages
in 19 minutes and 19 seconds
......@@ -66,9 +66,12 @@ class ScalingOperator(EndomorphicOperator):
return x
if fct == 0.:
return full(self.domain, 0.)
if (mode & 10) != 0:
MODES_WITH_ADJOINT = self.ADJOINT_TIMES | self.ADJOINT_INVERSE_TIMES
MODES_WITH_INVERSE = self.INVERSE_TIMES | self.ADJOINT_INVERSE_TIMES
if (mode & MODES_WITH_ADJOINT) != 0:
fct = np.conj(fct)
if (mode & 12) != 0:
if (mode & MODES_WITH_INVERSE) != 0:
fct = 1./fct
return x*fct
......
......@@ -29,6 +29,7 @@ from .multi_field import MultiField
from .operators.block_diagonal_operator import BlockDiagonalOperator
from .operators.diagonal_operator import DiagonalOperator
from .operators.distributors import PowerDistributor
from .plot import Plot
__all__ = ['PS_field', 'power_analyze', 'create_power_operator',
'create_harmonic_smoothing_operator', 'from_random',
......@@ -37,7 +38,7 @@ __all__ = ['PS_field', 'power_analyze', 'create_power_operator',
'sin', 'cos', 'tan', 'sinh', 'cosh',
'absolute', 'one_over', 'clip', 'sinc',
'conjugate', 'get_signal_variance', 'makeOp', 'domain_union',
'get_default_codomain']
'get_default_codomain', 'single_plot']
def PS_field(pspace, func):
......@@ -434,3 +435,14 @@ def get_default_codomain(domainoid, space=None):
ret = [dom for dom in domainoid]
ret[space] = domainoid[space].get_default_codomain()
return DomainTuple.make(ret)
def single_plot(field, **kwargs):
"""Creates a single plot using `Plot`.
Keyword arguments are passed to both `Plot.add` and `Plot.output`.
"""
p = Plot()
p.add(field, **kwargs)
if 'title' in kwargs:
del(kwargs['title'])
p.output(**kwargs)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment