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-31964: Fixup dimensions on ProcessCcdWithFakesTask/MatchFakesTask #611

Merged
merged 10 commits into from Dec 15, 2021

Conversation

morriscb
Copy link
Contributor

Add code to concatenate fake catalogs.

Fix linting.

Add compose fakes to variablity code.

Debug matchFakes.

Add docs

Simplify unittests.

Remove unnessecary runQuantum test.

Change coding dimensions.

Fix linting.

Output tract numbers.

Fix linting.

Access tractId

Access tractId

Fix ra/decColName usage.

@morriscb morriscb changed the title DM-31964: Fixup dimenions on ProcessCcdWithFakesTask/MatchFakesTask DM-31964: Fixup dimensions on ProcessCcdWithFakesTask/MatchFakesTask Nov 30, 2021
for fakeCatRef in fakeCats:
cat = fakeCatRef.get(
datasetType=self.config.connections.fakeCats,
immediate=True)
Copy link
Member

@timj timj Nov 30, 2021

Choose a reason for hiding this comment

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

There is no immediate keyword for get(). Or maybe I'm misunderstanding. DeferredDatasetHandle.get() doesn't take a datasetType parameter either.

# Make sure all data is within the inner part of the tract.
outputCat.append(cat[
skyMap.findTractIdArray(cat[self.config.raColName],
cat[self.config.decColName],
Copy link

Choose a reason for hiding this comment

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

@morriscb shouldn't these column names be self.config.ra_col and self.config.dec_col given that self.config.raColName and self.config.decColName are going to be deprecated?

fakeCats = cT.Input(
doc="Set of catalogs of fake sources to draw inputs from. We will "
"from one of these that fully contains our exposure or the is "
"closest the visit boresight.",
Copy link

Choose a reason for hiding this comment

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

@morriscb I guess the description here has a word missing between L68 and L69. L69 has the is. I believe the description also does not reflect the fact that it gathers fake sources from other neighboring tracts as done in composeFakeCat.

Copy link
Contributor

Choose a reason for hiding this comment

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

As above, the doc string here doesn't read well - can you rephrase?

outputCat.append(cat[
skyMap.findTractIdArray(cat[self.config.insertFakes.raColName],
cat[self.config.insertFakes.decColName],
degrees=False)
Copy link

Choose a reason for hiding this comment

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

@morriscb Same comment as above: self.config.insertfakes.raColName and self.config.insertFakes.decColName should be changed to self.config.ra_col and self.config.dec_col to remove deprecated column names.

if externalSkyWcsCatalogRef.dataId["tract"] == tractId:
externalSkyWcsCatalog = externalSkyWcsCatalogRef.get(
datasetType=self.config.connections.externalSkyWcsTractCatalog)
break
Copy link

Choose a reason for hiding this comment

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

@morriscb I have seen this return in some places with no externalSkyWcsCatalog because the condition is never satisfied. You could let it use the last externalSkyWcsCatalog with an else statement like:

else:
    externalSkyWcsCatalog = externalSkyWcsCatalogRef.get(datasetType=self.config.connections.externalSkyWcsTractCatalog)

Similar problem for the photoCalib below in addition to a bug (see below L391).

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for @surhudm's thinking above - it would be good for this large if/elif block to have a fall-back option in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the condition is never satisfied, that means there is no wcs or photocalib for that tract. I'm not sure what the safest fall back position. Likely people doing who have written the analysis code and use these calibs should decide.

for externalPhotoCalibCatalogRef in externalPhotoCalibCatalogList:
if externalPhotoCalibCatalogRef.dataId["tract"] == tractId:
externalPhotoCalibCatalog = externalPhotoCalibCatalogRef.get(
datasetType=self.config.connections.externalSkyWcsTractCatalog)
Copy link

Choose a reason for hiding this comment

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

@morriscb Shouldn't this be the externalPhotoCalibCatalog connection instead of the SkyWcsTractCatalog? @sr525 spotted this.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 again - seems like a copy/paste typo.


Returns
-------
fakeCat : `pandas.core.frame.DataFrame`
fakeCats : `pandas.core.frame.DataFrame`
Copy link
Contributor

Choose a reason for hiding this comment

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

Please explain why this has been pluralized in the description for the parameter.

@@ -197,7 +124,8 @@ def testTrimCat(self):
"""Test that the correct number of sources are in the ccd area.
"""
matchTask = MatchFakesTask()
result = matchTask._trimFakeCat(self.fakeCat, self.exposure)
result = matchTask._trimFakeCat(
self.fakeCat, self.exposure)
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't need to be on a new line.

Add code to concatenate fake catalogs.

Fix linting.

Add compose fakes to variablity code.

Debug matchFakes.

Add docs

Simplify unittests.

Remove unnessecary runQuantum test.

Change coding dimensions.

Fix linting.

Output tract numbers.

Fix linting.

Access tractId

Access tractId

Fix ra/decColName usage.

Remove immediate arg.
@morriscb morriscb merged commit 9276d3b into main Dec 15, 2021
@morriscb morriscb deleted the tickets/DM-31964 branch December 15, 2021 16:52
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

4 participants