Skip to content

Commit

Permalink
fixup! Detector: add crosstalk matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulPrice committed Aug 24, 2017
1 parent 2350101 commit e9e7827
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion python/lsst/afw/cameraGeom/cameraConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def getCrosstalk(self, numAmps):
"""Return a 2-D numpy array of crosstalk coefficients of the proper shape"""
if not self.crosstalk:
return None
return np.array(self.crosstalk, dtype=np.float32).reshape((numAmps, numAmps))
try:
return np.array(self.crosstalk, dtype=np.float32).reshape((numAmps, numAmps))
except:
raise RuntimeError("Cannot reshape 'crosstalk' coefficients to square matrix")


class CameraConfig(pexConfig.Config):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ def addBadCameraSys(dw):
np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0], dtype=np.float32), # 1D
):
self.assertRaises(TypeError, DetectorWrapper, crosstalk=crosstalk)
# This breaks in the Detector ctor: wrong shape
# These break in the Detector ctor: wrong shape
self.assertRaises(lsst.pex.exceptions.InvalidParameterError,
DetectorWrapper, crosstalk=np.array([[1.0, 2.0], [3.0, 4.0]]))
self.assertRaises(lsst.pex.exceptions.InvalidParameterError,
DetectorWrapper, crosstalk=np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]))

def testTransform(self):
"""Test the transform method
Expand Down

0 comments on commit e9e7827

Please sign in to comment.