Skip to content

Commit

Permalink
Merge pull request #287 from lsst/tickets/DM-41911
Browse files Browse the repository at this point in the history
DM-41911: Add constant extrapolation to deferred charge interp1d call.
  • Loading branch information
erykoff committed Nov 30, 2023
2 parents 59f6a91 + 2bbdde9 commit a69e4da
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/lsst/ip/isr/deferredCharge.py
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 a69e4da

Please sign in to comment.