Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/lsst/analysis/tools/actions/vector/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[],
)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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](
Expand Down
12 changes: 6 additions & 6 deletions python/lsst/analysis/tools/actions/vector/vectorActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 5 additions & 7 deletions tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -629,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
Expand Down
Loading