Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-37193: Reorganize vectorActions #108

Merged
merged 8 commits into from May 17, 2023
Merged

DM-37193: Reorganize vectorActions #108

merged 8 commits into from May 17, 2023

Conversation

taranu
Copy link
Contributor

@taranu taranu commented May 17, 2023

No description provided.

@taranu taranu force-pushed the tickets/DM-37193 branch 2 times, most recently from c598c2e to 2cc6728 Compare May 17, 2023 13:54
@@ -21,17 +21,12 @@
from __future__ import annotations

__all__ = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're trying to match the order they appear in the file, this __all__ looks like it should be:

__all__ = (
    "LoadVector",
    "DownselectVector",
    "MultiCriteriaDownselectVector",
    "ConvertUnits",
    "CalcSn",
    "ConvertFluxToMags",
    "MagDiff",
    "ExtinctionCorrectedMagDiff",
    "RAcosDec",
    "PerGroupStatistic",
    "ResidualWithPerGroupStatistic",
)



class LoadVector(VectorAction):
"""Load and return a Vector from KeyedData."""
class ConvertFluxToMags(VectorAction):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this should be named ConvertFluxToMag or ConvertFluxesToMags. I prefer the singular myself.

class LoadVector(VectorAction):
"""Load and return a Vector from KeyedData."""
class ConvertFluxToMags(VectorAction):
"""Turn nano janskies into magnitudes."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"nanojanskies", one word.

return vecA / vecB


class FractionalDifference(VectorAction):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most vector actions in the mathActions file end with the suffix Vector (all except here and ConstantValue). Is it worth considering making that consistent here too?

_LOG = logging.getLogger(__name__)


class ConstantValue(VectorAction):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most vector actions in the mathActions file end with the suffix Vector (all except here and FractionalDifference). Is it worth considering making that consistent here too? E.g., ConstantVector? ConstantValueVector?

Copy link
Contributor Author

@taranu taranu May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually considering renaming it to Scalarsomething rather than Constantsomething, but decided against it.

But to the extent that there is a naming scheme, the Vector-suffixed actions all begin with verbs (see also LoadVector and DownselectVector in vectorActions.py), whereas the unsuffixed actions are nouns (ConstantValue, MagDiff as short for MagnitudeDifference, etc). In principle you could verbify the various Diff(erence) actions since difference is a verb too, but I don't think the names would be any clearer. For ConstantValue, I can't think of a good way to verbify it at all. ReturnScalar? Actually, LoadScalar would be consistent with LoadVector, even though it's not really loading anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. In which case, I suggest leaving this (and the other non-conformant action here) as-is for the time being. Further changes can be punted to a future ticket, if desired.

@taranu taranu merged commit 41c4d2b into main May 17, 2023
7 checks passed
@taranu taranu deleted the tickets/DM-37193 branch May 17, 2023 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants