diff --git a/python/lsst/pipe/tasks/background.py b/python/lsst/pipe/tasks/background.py index beb6f0cde..a15c04bb3 100644 --- a/python/lsst/pipe/tasks/background.py +++ b/python/lsst/pipe/tasks/background.py @@ -612,14 +612,14 @@ def __init__(self, config, dims, transform, values=None, numbers=None): values.set(0.0) else: values = values.clone() - assert(values.getDimensions() == self.dims) + assert values.getDimensions() == self.dims self._values = values if numbers is None: numbers = afwImage.ImageF(self.dims) # float for dynamic range and convenience numbers.set(0.0) else: numbers = numbers.clone() - assert(numbers.getDimensions() == self.dims) + assert numbers.getDimensions() == self.dims self._numbers = numbers def __reduce__(self): diff --git a/python/lsst/pipe/tasks/configurableActions/_configurableActionStructField.py b/python/lsst/pipe/tasks/configurableActions/_configurableActionStructField.py index 8e7368895..4a371f534 100644 --- a/python/lsst/pipe/tasks/configurableActions/_configurableActionStructField.py +++ b/python/lsst/pipe/tasks/configurableActions/_configurableActionStructField.py @@ -161,7 +161,7 @@ def _config(self) -> Config: # Config Fields should never outlive their config class instance # assert that as such here value = self._config_() - assert(value is not None) + assert value is not None return value @property diff --git a/python/lsst/pipe/tasks/healSparseMappingProperties.py b/python/lsst/pipe/tasks/healSparseMappingProperties.py index 25127c054..f60e65b19 100644 --- a/python/lsst/pipe/tasks/healSparseMappingProperties.py +++ b/python/lsst/pipe/tasks/healSparseMappingProperties.py @@ -166,13 +166,18 @@ def compute_approx_psf_size_and_shape(ccd_row, ra, dec, nx=20, ny=20, orderx=2, ("psf_e2", "f8"), ("psf_area", "f8")]) - cheb_size = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_size, ctrl) + # Protect against nans which can come in at the edges and masked regions. + good = np.isfinite(psf_size) + x = x[good] + y = y[good] + + cheb_size = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_size[good], ctrl) psf_array["psf_size"] = cheb_size.evaluate(pixel_x, pixel_y) - cheb_e1 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e1, ctrl) + cheb_e1 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e1[good], ctrl) psf_array["psf_e1"] = cheb_e1.evaluate(pixel_x, pixel_y) - cheb_e2 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e2, ctrl) + cheb_e2 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e2[good], ctrl) psf_array["psf_e2"] = cheb_e2.evaluate(pixel_x, pixel_y) - cheb_area = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_area, ctrl) + cheb_area = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_area[good], ctrl) psf_array["psf_area"] = cheb_area.evaluate(pixel_x, pixel_y) return psf_array diff --git a/tests/test_configurableActions.py b/tests/test_configurableActions.py index ec87d3068..733c95b9b 100644 --- a/tests/test_configurableActions.py +++ b/tests/test_configurableActions.py @@ -36,7 +36,7 @@ def __call__(self): return self.var def validate(self): - assert(self.var is not None) + assert self.var is not None class ActionTest2(ConfigurableAction): @@ -46,7 +46,7 @@ def __call__(self): return self.var def validate(self): - assert(self.var is not None) + assert self.var is not None class ActionTest3(ConfigurableAction): @@ -56,7 +56,7 @@ def __call__(self): return self.var def validate(self): - assert(self.var is not None) + assert self.var is not None class ConfigurableActionsTestCase(unittest.TestCase):