Commit c9c5cfe0 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

tweaks

parent 96be7ff9
Pipeline #19277 passed with stage
in 4 minutes and 42 seconds
......@@ -37,7 +37,7 @@ class IterationController(with_metaclass(NiftyMeta, type('NewBase',
The concrete convergence criteria can be chosen by inheriting from this
class; the implementer has full flexibility to use whichever criteria are
appropriate for a particular problem - as ong as they can be computed from
appropriate for a particular problem - as long as they can be computed from
the information passed to the controller during the iteration process.
"""
......
......@@ -33,12 +33,19 @@ __all__ = ['create_power_field',
def create_power_field(domain, power_spectrum, dtype=None):
if not callable(power_spectrum):
raise TypeError("power_spectrum must be callable")
power_domain = PowerSpace(domain)
fp = Field(power_domain, val=power_spectrum(power_domain.k_lengths),
dtype=dtype)
if not callable(power_spectrum): # we have a Field living on a PowerSpace
if not isinstance(power_spectrum, Field):
raise TypeError("Field object expected")
if len(power_spectrum.domain) != 1:
raise ValueError("exactly one domain required")
if not isinstance(power_spectrum.domain[0], PowerSpace):
raise TypeError("PowerSpace required")
power_domain = power_spectrum.domain[0]
fp = Field(power_domain, val=power_spectrum.val, dtype=dtype)
else:
power_domain = PowerSpace(domain)
fp = Field(power_domain, val=power_spectrum(power_domain.k_lengths),
dtype=dtype)
f = fp.power_synthesize_special()
if not issubclass(fp.dtype.type, np.complexfloating):
......
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