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-33012 Update faro base class refcat loader to return single DataFrame #116

Merged
merged 3 commits into from Jan 12, 2022

Conversation

psferguson
Copy link
Contributor

Previously the _getReferenceCatalog returned the loaded refcat and a corrected refcat.
The corrected refcat had color trasformations applied, but had a nested list containing these magnitudes.
This caused downstream problems in using the matchter_probablistic task.

The _getReferenceCatalog has been updated to return a single data frame that is a hstack of the refCat, and refCatCorrected.

@@ -126,6 +128,8 @@ def _getReferenceCatalog(self, butlerQC, dataIds, refCats, filterList, epoch=Non
refCatCorrected : `numpy.ndarray`
Catalog of reference objects with proper motions and color terms
(optionally) applied.
refCatFrame: pandas.dataframe
Copy link
Collaborator

@bechtol bechtol Jan 5, 2022

Choose a reason for hiding this comment

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

The returns have changed such that refCat and refCatCorrected are no longer being returned. In that case, these should be removed from the list of returns in the documentation. I think it is still useful to have the documentation that describes what is included in the merged reference catalog DataFrame, but maybe this information goes in the docstring after the one-line description and before the listing of Parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed this docstring has been changed with a longer description at the beginning and the following returns

Returns
-------
refCat: pandas.dataframe
a reference catalog with original columns and corrected
coordinates (ra,dec) and reference magnitudes (refMag-/refMagErr)

Copy link
Collaborator

@bechtol bechtol left a comment

Choose a reason for hiding this comment

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

Would it make sense to change refCatFrame -> refCat since downstream users of the reference catalog will simply expect a DataFrame?

@psferguson
Copy link
Contributor Author

It also occurs to me that we may want to make sure there are no duplicate columns, and if there are probably supersede the catalog columns with the corrected columns.
This sort of occurs with coord_ra/dec which gets converted from radians to degrees.
But I could also imagine the magnitudes having the same column names in the refcat and filterList.

@bechtol
Copy link
Collaborator

bechtol commented Jan 5, 2022

Yes, it would be a good idea to check for any duplicated columns. However, doesn't the refMag- prefix make it unlikely to have a conflict of the column names for magnitudes? I think also the ra dec is unlikely to create a conflict because the reference catalog uses coord_ra and coord_dec as the standard coordinate column names -- is that correct?

@psferguson
Copy link
Contributor Author

Ah your are right, I had misremembered about adding the refMag prefix in. This should not not be an issue.
Do we want to return both coord_ra and ra or just the corrected version?

@bechtol
Copy link
Collaborator

bechtol commented Jan 10, 2022

Ah your are right, I had misremembered about adding the refMag prefix in. This should not not be an issue. Do we want to return both coord_ra and ra or just the corrected version?

My inclination is return both at least for now (partly as a check that proper motions have been applied). In that case, we will need to be clear in the documentation about the meaning of (and distinction between) the two columns.

applying a proper motion correction and reference magnitudes transformed to the lsst bandpass.

returns a refCat with both the original loaded reference catalog and
the coorected coordinates (ra,dec) and reference magnitudes (refMag-/refMagErr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest (refMag-/refMagErr-) and also below just for consistency.

The doc string might want to use the words "color terms" when referring to the reference magnitudes to make clear that the fluxes of reference objects have been converted to the photometric system of the data that is being analyzed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated:

Loads the lsst.afw.table.SimpleCatalog reference catalog, computes ra and dec
(optionally) applying a proper motion correction. Also, color terms
are (optionally) applied to the reference magnitudes in order to transform
them to the data's photometric system.

returns a refCat with both the original loaded reference catalog and
the coorected coordinates (ra,dec) and transformed reference magnitudes
(refMag-/refMagErr-)

Copy link
Collaborator

@bechtol bechtol left a comment

Choose a reason for hiding this comment

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

Thanks. Looks great. Two very minor comments.

Copy link
Contributor

@edennihy edennihy left a comment

Choose a reason for hiding this comment

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

No additional comments, nice work on clarifying the docstring

@psferguson psferguson marked this pull request as ready for review January 11, 2022 23:57
@psferguson
Copy link
Contributor Author

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