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-33960: Add astrometry residuals with refcat plots #22

Merged
merged 3 commits into from Jun 20, 2022

Conversation

cmsaunders
Copy link
Contributor

No description provided.

__all__ = ["CatalogMatchTaskConfig", "CatalogMatchTask"]


class AstropyMatchTaskConfig(pexConfig.Config):
Copy link
Contributor

Choose a reason for hiding this comment

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

If a task is called AstropyMatchTask, convention is to call the corresponding config AstropyMatchConfig. (I saw a couple places where this convention was not followed in analysis_drp so I'm guessing you just copied and pasted from there).

ConfigClass = AstropyMatchTaskConfig

def __init__(self, **kwargs):
super().__init__(**kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

This __init__ doesn't do anything different than super's __init__. Whole method unnecessary.


separations = d2d[goodMatches]

return refMatchIndices, targetMatchIndices, separations
Copy link
Contributor

Choose a reason for hiding this comment

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

run methods in Tasks should return a Struct.

return pipeBase.Struct(refMatchIndices=refMatchIndices,
                       targetMatchIndices=targetMatchIndices
                       separations=separations)

The Task frameowrk expects shit. Reasons for this is that is that devs can extend the method to return more later without breaking any calling code. Default runQuantum tries writes the keys of the Struct as output.

"y": "$Dec_{target} - Dec_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import CoaddPlotFlagSelector, StarIdentifier
from lsst.analysis.drp.calcFunctors import AstromDiff
Copy link
Contributor

Choose a reason for hiding this comment

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

needs a newline

"_target" for duplicated column names, plus a column with the
angular separation between matches.
"""

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh, I can never remember which is right!

# Join the catalogs for the matched catalogs
refMatches = self.refCat.iloc[refMatches].reset_index()
sourceMatches = targetCatalog.iloc[targetMatches].reset_index()
matchedCat = sourceMatches.join(refMatches, lsuffix='_target', rsuffix='_ref')
Copy link
Contributor

Choose a reason for hiding this comment

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

What's it joining on if there's no index or "on" arg?

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 default for 'on' is to join on the index.

self.refCat = refCat.asAstropy().to_pandas()


class CatalogMatchVisitTaskConnections(pipeBase.PipelineTaskConnections, dimensions=("visit", "skymap"),
Copy link
Contributor

@yalsayyad yalsayyad Mar 15, 2022

Choose a reason for hiding this comment

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

@natelust Out of curiosity, why we need skymap here? Is it to get the refCat shards to be found?

"""

ConfigClass = CatalogMatchVisitTaskConfig
_DefaultName = "catalogMatchTask"
Copy link
Contributor

Choose a reason for hiding this comment

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

convention is "catalogMatch" for the DefaultNames. lowercase. Leave off the word Task.

inputs = butlerQC.get(inputRefs)

dataFrame = inputs["catalog"].get()
inputs['catalog'] = dataFrame
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooof, I just realized that you're reading in the entire objectTable_tract and making a copy of the whole thing. Don't deferLoad if you're going to read in the whole thing, but I'm going to think about alternatives to this, because this not the way if we want the analysis_drp to be fast and memory efficient.

# dataframe
skyCircle = self.refObjLoader.loadSkyCircle(center,
radius,
'i',
Copy link
Contributor

Choose a reason for hiding this comment

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

intentionally hardcoded band?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the band is ignored by a config, but you apparently have to put in something.

selectorActions.flagSelector: VisitPlotFlagSelector
sourceSelectorActions.sourceSelector.band: ""
python: |
from lsst.analysis.drp.dataSelectors import VisitPlotFlagSelector
Copy link
Contributor

Choose a reason for hiding this comment

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

needs newline.

@cmsaunders cmsaunders force-pushed the tickets/DM-33960 branch 3 times, most recently from 216cd9b to e3797a2 Compare March 16, 2022 19:46
@cmsaunders cmsaunders force-pushed the tickets/DM-33960 branch 3 times, most recently from 925d0de to 73f0207 Compare April 27, 2022 19:48
Copy link
Contributor

@yalsayyad yalsayyad 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. This is next on the list of plots/metrics to migrate to analysis_tools as an example

@cmsaunders cmsaunders merged commit 8673edb into main Jun 20, 2022
@cmsaunders cmsaunders deleted the tickets/DM-33960 branch June 20, 2022 20:02
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