Commit f2ed0660 authored by inhuszar's avatar inhuszar
Browse files

Parameters can be changed on copying.

parent 28b9c95e
......@@ -68,7 +68,8 @@ class Interpolator(TIRLObject):
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INITIALISATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
def __init__(self, source, tensor_axes=(), radius=1, hold=False,
threads=-1, verbose=False, ipkwargs=None, **kwargs):
threads=-1, verbose=False, ipkwargs=None, fill_value=None,
**kwargs):
"""
Initialisation of Interpolator.
......@@ -116,6 +117,10 @@ class Interpolator(TIRLObject):
# Initialise metaparameters
self.kwargs = kwargs
if fill_value is None:
self.kwargs.update(fill_value=ts.FILL_VALUE)
else:
self.kwargs.update(fill_value=fill_value)
# Set interpolation source values
......@@ -487,7 +492,7 @@ class Interpolator(TIRLObject):
else:
return True
def copy(self):
def copy(self, **newparams):
"""
Copy constructor. Subclasses that define their constructor signature
differently MAY find it necessary to overload this constructor as well.
......@@ -498,10 +503,11 @@ class Interpolator(TIRLObject):
"""
kwargs = {k: v for k, v in self.kwargs.items()
if k not in self.RESERVED_KWARGS}
obj = type(self)(
source=self.values, tensor_axes=self.tensor_axes,
kw = dict(source=self.values, tensor_axes=self.tensor_axes,
radius=self.radius, hold=self.hold, threads=self.threads,
verbose=self.verbose, ipkwargs=self.ipkwargs, **kwargs)
kw.update(newparams)
obj = type(self)(**kw)
return obj
@classmethod
......
Supports Markdown
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