diff --git a/python/lsst/analysis/tools/actions/vector/selectors.py b/python/lsst/analysis/tools/actions/vector/selectors.py index eb2b4dfa4..08036ec2a 100644 --- a/python/lsst/analysis/tools/actions/vector/selectors.py +++ b/python/lsst/analysis/tools/actions/vector/selectors.py @@ -331,7 +331,7 @@ class SnSelector(SelectorBase): doc="Suffix to add to fluxType to specify uncertainty column", default="Err" ) bands = ListField[str]( - doc="The bands to apply the signal to noise cut in." "Takes precedence if bands passed to call", + doc="The bands to apply the signal to noise cut in. Takes precedence if bands passed to call", default=[], ) @@ -400,7 +400,7 @@ class SkyObjectSelector(FlagSelector): bands = ListField[str]( doc="The bands to apply the flags in, takes precedence if band supplied in kwargs", - default=["i"], + default=[], ) def getInputSchema(self) -> KeyedDataSchema: @@ -749,7 +749,7 @@ class InjectedClassSelector(InjectedObjectSelector): default="ref_source_type", ) key_injection_flag = Field[str]( - doc="Key for the field indicating that the object was not injected" " (per band)", + doc="Key for the field indicating that the object was not injected (per band)", default="ref_{band}_injection_flag", ) name_class = Field[str]( diff --git a/python/lsst/analysis/tools/actions/vector/vectorActions.py b/python/lsst/analysis/tools/actions/vector/vectorActions.py index ff8ca6674..bd84d5213 100644 --- a/python/lsst/analysis/tools/actions/vector/vectorActions.py +++ b/python/lsst/analysis/tools/actions/vector/vectorActions.py @@ -192,7 +192,7 @@ def __call__(self, data: KeyedData, **kwargs) -> Vector: class ConvertFluxToMag(VectorAction): - """Turn nano janskies into magnitudes.""" + """Turn nanojanskys into magnitudes.""" vectorKey = Field[str](doc="Key of flux vector to convert to mags") fluxUnit = Field[str](doc="Astropy unit of flux vector", default="nJy") @@ -232,7 +232,7 @@ class MagDiff(VectorAction): ----- The flux columns need to be in units (specifiable in the fluxUnits1 and 2 config options) that can be converted - to janskies. This action doesn't have any calibration + to janskys. This action doesn't have any calibration information and assumes that the fluxes are already calibrated. """ @@ -270,12 +270,12 @@ class ExtinctionCorrectedMagDiff(VectorAction): ) ebvCol = Field[str](doc="E(B-V) Column Name", default="ebv") band1 = Field[str]( - doc="Optional band for magDiff.col1. Supercedes column name prefix", + doc="Optional band for magDiff.col1. Supersedes column name prefix", optional=True, default=None, ) band2 = Field[str]( - doc="Optional band for magDiff.col2. Supercedes column name prefix", + doc="Optional band for magDiff.col2. Supersedes column name prefix", optional=True, default=None, ) @@ -302,7 +302,7 @@ def __call__(self, data: KeyedData, **kwargs) -> Vector: for band in (col1Band, col2Band): if band not in self.extinctionCoeffs: _LOG.warning( - "%s band not found in coefficients dictionary: %s" " Not applying extinction correction", + "%s band not found in coefficients dictionary: %s. Not applying extinction correction", band, self.extinctionCoeffs, ) @@ -421,7 +421,7 @@ class IsMatchedObjectSameClass(VectorAction): doc="The key of the boolean field selecting observed galaxies", ) key_is_target_star = Field[str]( - doc="The key of the boolean field selecting observed starss", + doc="The key of the boolean field selecting observed stars", ) def __call__(self, data: KeyedData, **kwargs) -> Vector: diff --git a/tests/test_actions.py b/tests/test_actions.py index f85408158..dfbe01ff2 100644 --- a/tests/test_actions.py +++ b/tests/test_actions.py @@ -239,11 +239,11 @@ def _testMath(self, ActionType, truth, num_vectors: int = 2, compare_exact: bool letters = ("A", "B") bands = ("r", "i") actions = { - f"action{letters[num]}": LoadVector(vectorKey=f"{{band{num+1}}}_vector") + f"action{letters[num]}": LoadVector(vectorKey=f"{{band{num + 1}}}_vector") for num in range(num_vectors) } action = ActionType(**actions, **kwargs) - kwargs_bands = {f"band{num+1}": bands[num] for num in range(num_vectors)} + kwargs_bands = {f"band{num + 1}": bands[num] for num in range(num_vectors)} result = action(self.data, **kwargs_bands) self._checkSchema(action, [action.vectorKey for action in actions.values()]) if compare_exact: @@ -449,8 +449,7 @@ def setUp(self): # Needed for testCalcRhoStatistics. @staticmethod def getMatrixElements(size, e1, e2): - # puting guards just in case e1 or e2 are - # supprior to 1, but unlikely. + # putting guards just in case e1 or e2 are superior to 1, but unlikely. if abs(e1) >= 1: e1 = 0 if abs(e2) >= 1: @@ -464,7 +463,6 @@ def getMatrixElements(size, e1, e2): return [L[0, 0], L[1, 1], L[0, 1]] def testCalcRhoStatistics(self): - # just check if runs rho = CalcRhoStatistics() rho.treecorr.nbins = 21 @@ -630,11 +628,11 @@ def testSnSelector(self): np.testing.assert_array_equal(result, truth) def testSkyObjectSelector(self): - # Test default + # Test with kwargs selector = SkyObjectSelector() keys = ["{band}_pixelFlags_edge", "{band}_pixelFlags_nodata", "sky_object"] self._checkSchema(selector, keys) - result = selector(self.data) + result = selector(self.data, bands=["i"]) truth = np.zeros(self.size, dtype=bool) truth[15] = 1 truth[17] = 1