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-36182: Cleanup and document functors.py. #811
Conversation
1357711
to
2a4562c
Compare
python/lsst/pipe/tasks/functors.py
Outdated
@@ -778,7 +785,7 @@ def __init__(self, col, calib=None, **kwargs): | |||
if calib is not None: | |||
self.fluxMag0 = calib.getFluxMag0()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to remove calib
, we should first document that this is an unused argument in the docstring, remove this line and instead raise a deprecation warning here. I'd follow a pattern similar to these lines: https://github.com/lsst/pex_config/blob/aa9e307f6b0b52071272d5b1404e053a96c8fdb0/python/lsst/pex/config/config.py#L1543-L1546
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this revision (just pushed) look to you? Future deprecation ticket: DM-39914.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, as long as you're sure getFluxMag0
exists. My GitHub search returns no implementation of it. If that's the case, I'd remove it right away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And either way, the warning should come first before it executes the code in the if
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this hasn't been deprecated officially yet, people may still want to use this to access older data. I realize that this may not be something we need to support here, but regardless, my feeling was that it costs us nothing to keep it in for now just in case.
2a4562c
to
78857ba
Compare
python/lsst/pipe/tasks/functors.py
Outdated
self.fluxMag0 = calib.getFluxMag0()[0] | ||
warnings.warn( | ||
"Config field 'calib' is deprecated, and will be removed after v27.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Config field
is applicable here. It should perhaps be "calib
argument".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to The 'calib' argument is deprecated, and will be removed after v27.
.
python/lsst/pipe/tasks/functors.py
Outdated
@@ -778,7 +785,7 @@ def __init__(self, col, calib=None, **kwargs): | |||
if calib is not None: | |||
self.fluxMag0 = calib.getFluxMag0()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, as long as you're sure getFluxMag0
exists. My GitHub search returns no implementation of it. If that's the case, I'd remove it right away.
78857ba
to
33542b0
Compare
python/lsst/pipe/tasks/functors.py
Outdated
``deepCoadd_obj`` dataset; that is, a DataFrame with a multi-level column | ||
index, with the levels of the column index being ``band``, ``dataset``, and | ||
``column``. | ||
It has since been generalized to apply to DataFrames without mutli-level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multi-level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. I have nitpicky suggestions/questions but nothing particularly important.
python/lsst/pipe/tasks/functors.py
Outdated
it gets to have those levels in the column index. | ||
|
||
Parameters | ||
---------- | ||
filt : str | ||
Filter upon which to do the calculation | ||
Filter upon which to do the calculation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change to say it's actually the band, like the docstring says?
python/lsst/pipe/tasks/functors.py
Outdated
calib : `lsst.afw.image.calib.Calib` (optional) | ||
Object that knows zero point. | ||
Name of flux column from which to compute magnitude. | ||
Can be parseable by `~lsst.pipe.tasks.functors.fluxName` function; that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by the ...fluxName
function?
python/lsst/pipe/tasks/functors.py
Outdated
"""Functor to calculate SDSS trace radius size for sources""" | ||
"""Functor to calculate SDSS trace radius size for sources. | ||
|
||
SDSS trace radius size is a measure of size equal to the square root of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer The SDSS trace radius size...
. But slightly more importantly, I think the functor name ought to be SDSS Trace Radius
, as I think radius is strictly more specific than size. I suppose changing the actual functor class name is not worth the effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think renaming of functors is beyond the scope of this ticket. If you feel strongly about this though, please do set up a follow-up ticket to make this singular change.
python/lsst/pipe/tasks/functors.py
Outdated
"""Functor to calculate HSM trace radius size for sources""" | ||
"""Functor to calculate HSM trace radius size for sources. | ||
|
||
HSM trace radius size is a measure of size equal to the square root of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HSM trace radius size...
python/lsst/pipe/tasks/functors.py
Outdated
@@ -974,7 +1005,13 @@ def _func(self, df): | |||
|
|||
|
|||
class PsfSdssTraceSizeDiff(Functor): | |||
"""Functor to calculate SDSS trace radius size difference (%) between object and psf model""" | |||
"""Functor to calculate SDSS trace radius size difference (%) between the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the SDSS trace...
python/lsst/pipe/tasks/functors.py
Outdated
@@ -1001,7 +1044,13 @@ def _func(self, df): | |||
|
|||
|
|||
class PsfHsmTraceSizeDiff(Functor): | |||
"""Functor to calculate HSM trace radius size difference (%) between object and psf model""" | |||
"""Functor to calculate HSM trace radius size difference (%) between the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the HSM trace...
python/lsst/pipe/tasks/functors.py
Outdated
@@ -1019,6 +1068,15 @@ def _func(self, df): | |||
|
|||
|
|||
class HsmFwhm(Functor): | |||
"""Functor to calculate PSF FWHM with second moments measured from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PSF FWHM using...
@@ -1067,6 +1143,15 @@ def _func(self, df): | |||
|
|||
|
|||
class RadiusFromQuadrupole(Functor): | |||
"""Calculate the radius from the quadrupole moments. | |||
This returns the fourth root of the determinant of the second moments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's supposed to be a newline between this line and the one above.
@@ -1067,6 +1143,15 @@ def _func(self, df): | |||
|
|||
|
|||
class RadiusFromQuadrupole(Functor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really should have been DeterminantRadius
to be consistent with the TraceRadius
usages above, but I suppose it's not worth changing at this point either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, if you feel strongly, please do put this on a follow-up ticket.
- base_PsfFlux | ||
filt: HSC-G | ||
count: | ||
sourceId: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the motivation for this change? The previous example was out of date, or non-functional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial motivation was to replace the mis-named flags section and replace the MagDiff examples, as MagDiff was going away. On review, MagDiff remains, but the example edits here were preserved to showcase more typical examples.
33542b0
to
a216322
Compare
No description provided.