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