Let decay interp receive an interpolator
@@ -56,15 +56,22 @@ class LinearFast(MetricObject):
return np.reshape(f, array_args[0].shape)
-class LinearFastDecay(LinearFast):
- def __init__(
- self, f_val, grids, limit_func, decay_weights=None, extrap_options=None
- ):
- super().__init__(f_val, grids, extrap_options)
+class DecayInterp(MetricObject):
- self.limit_func = limit_func
- self.upper_limits = np.array([x[-1] for x in grids])
+ distance_criteria = ["interp_f_val", "grid_list"]
+
+ def __init__(self, interp, limit_fun, decay_weights=None):
+
+ self.interp = interp
+ self.limit_fun = limit_fun
+
+
+ self.interp_f_val = self.interp.f_val
+ self.grid_list = self.interp.grid_list
+
+ self.upper_limits = np.array([x[-1] for x in self.grid_list])
+ self.dim = len(self.grid_list)
if decay_weights is None:
# By default, make weights the inverse of upper grid limits
@@ -98,7 +105,7 @@ class LinearFastDecay(LinearFast):
upper_ex_nearest = np.minimum(upper_ex_points, self.upper_limits[None, :])
# Find function evaluations with regular extrapolation
- f = eval_linear(self.Grid, self.f_val, col_args, self.extrap_options)
+ f = self.interp(*[col_args[:,i] for i in range(self.dim)])
# Get base extrapolations and limiting function at the extrapolating points
upper_f_ex = f[upper_ex_inds]
