From b88bcff2ba3549c40d5fc1e1e8f06f0af7adebd9 Mon Sep 17 00:00:00 2001 From: Lee Kelvin Date: Fri, 20 Mar 2026 08:11:24 -0700 Subject: [PATCH 1/3] Address basic formatting/typo issues --- .../lsst/analysis/tools/actions/vector/selectors.py | 4 ++-- .../analysis/tools/actions/vector/vectorActions.py | 12 ++++++------ tests/test_actions.py | 8 +++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/python/lsst/analysis/tools/actions/vector/selectors.py b/python/lsst/analysis/tools/actions/vector/selectors.py index 3e1dabddc..7d837a448 100644 --- a/python/lsst/analysis/tools/actions/vector/selectors.py +++ b/python/lsst/analysis/tools/actions/vector/selectors.py @@ -330,7 +330,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=[], ) @@ -745,7 +745,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 a13e8edd4..dc68a036c 100644 --- a/python/lsst/analysis/tools/actions/vector/vectorActions.py +++ b/python/lsst/analysis/tools/actions/vector/vectorActions.py @@ -191,7 +191,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") @@ -231,7 +231,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. """ @@ -269,12 +269,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, ) @@ -301,7 +301,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, ) @@ -420,7 +420,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 53f8f7ca5..d4ac3bb89 100644 --- a/tests/test_actions.py +++ b/tests/test_actions.py @@ -238,11 +238,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: @@ -448,8 +448,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: @@ -463,7 +462,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 From 5146f4a38e2364f6c481fb90b278bed088c13b5a Mon Sep 17 00:00:00 2001 From: Lee Kelvin Date: Fri, 20 Mar 2026 09:06:52 -0700 Subject: [PATCH 2/3] Remove i-band default in SkyObjectSelector --- python/lsst/analysis/tools/actions/vector/selectors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lsst/analysis/tools/actions/vector/selectors.py b/python/lsst/analysis/tools/actions/vector/selectors.py index 7d837a448..f695c99f1 100644 --- a/python/lsst/analysis/tools/actions/vector/selectors.py +++ b/python/lsst/analysis/tools/actions/vector/selectors.py @@ -399,7 +399,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: From 827f1082c0133c7536030a5d1481256a00cdefd7 Mon Sep 17 00:00:00 2001 From: Lee Kelvin Date: Fri, 20 Mar 2026 11:35:01 -0700 Subject: [PATCH 3/3] Update unit tests for SkyObjectSelector edits --- tests/test_actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_actions.py b/tests/test_actions.py index d4ac3bb89..7b7587a27 100644 --- a/tests/test_actions.py +++ b/tests/test_actions.py @@ -627,11 +627,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