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-36182: Cleanup and document functors.py. #811

Merged
merged 1 commit into from Jul 11, 2023
Merged

Conversation

leeskelvin
Copy link
Contributor

No description provided.

@leeskelvin leeskelvin force-pushed the tickets/DM-36182 branch 8 times, most recently from 1357711 to 2a4562c Compare July 6, 2023 16:30
@@ -778,7 +785,7 @@ def __init__(self, col, calib=None, **kwargs):
if calib is not None:
self.fluxMag0 = calib.getFluxMag0()[0]
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

self.fluxMag0 = calib.getFluxMag0()[0]
warnings.warn(
"Config field 'calib' is deprecated, and will be removed after v27.",
Copy link
Member

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".

Copy link
Contributor Author

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..

@@ -778,7 +785,7 @@ def __init__(self, col, calib=None, **kwargs):
if calib is not None:
self.fluxMag0 = calib.getFluxMag0()[0]
Copy link
Member

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.

``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
Copy link
Contributor

Choose a reason for hiding this comment

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

multi-level

Copy link
Contributor

@taranu taranu left a 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.

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.
Copy link
Contributor

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?

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
Copy link
Contributor

Choose a reason for hiding this comment

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

by the ...fluxName function?

"""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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

"""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
Copy link
Contributor

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...

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

the SDSS trace...

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

the HSM trace...

@@ -1019,6 +1068,15 @@ def _func(self, df):


class HsmFwhm(Functor):
"""Functor to calculate PSF FWHM with second moments measured from the
Copy link
Contributor

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
Copy link
Contributor

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):
Copy link
Contributor

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.

Copy link
Contributor Author

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@leeskelvin leeskelvin merged commit 36c42b5 into main Jul 11, 2023
2 checks passed
@leeskelvin leeskelvin deleted the tickets/DM-36182 branch July 11, 2023 15:49
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

3 participants