Skip to content

Commit

Permalink
Fix fitGains on load when stored incorrectly.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Oct 17, 2024
1 parent 261e0ae commit 15db866
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions python/lsst/ip/isr/crosstalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,16 @@ def fromDict(cls, dictionary):
else:
calib.ampGainRatios = np.zeros_like(calib.coeffs)
if 'fitGains' in dictionary:
calib.fitGains = np.array(dictionary['fitGains']).reshape(calib.nAmp)
# Compatibility for matrices that were stored with fitGains
# of length 1.
fitGains = np.array(dictionary['fitGains'])
if len(fitGains) == 1:
# Expand to the correct number of amps, all zero (unknown).
calib.fitGains = np.zeros(calib.nAmp)
else:
calib.fitGains = np.array(dictionary['fitGains']).reshape(calib.nAmp)
else:
calib.fitGains = np.zeros_like(calib.nAmp)
calib.fitGains = np.zeros(calib.nAmp)

calib.interChip = dictionary.get('interChip', None)
if calib.interChip:
Expand Down

0 comments on commit 15db866

Please sign in to comment.