Skip to content

Commit

Permalink
Add constant extrapolation to deferred charge interp1d call.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Nov 29, 2023
1 parent e0aac6f commit 027219e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/lsst/ip/isr/deferredCharge.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,20 @@ def __init__(self, size, emission_time, pixel, trap_type, coeffs):
raise ValueError('Unknown trap type: %s', self.trap_type)

if self.trap_type == 'spline':
# Note that ``spline`` is actually a piecewise linear interpolation
# in the model and the application, and not a true spline.
centers, values = np.split(np.array(self.coeffs, dtype=np.float64), 2)
# Ensure all NaN values are stripped out
values = values[~np.isnan(centers)]
centers = centers[~np.isnan(centers)]
centers = centers[~np.isnan(values)]
values = values[~np.isnan(values)]
self.interp = interp.interp1d(centers, values)
self.interp = interp.interp1d(
centers,
values,
bounds_error=False,
fill_value=[values[0], values[-1]],
)

self._trap_array = None
self._trapped_charge = None
Expand Down

0 comments on commit 027219e

Please sign in to comment.