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

tickets/DM-16873 #255

Merged
merged 2 commits into from Jan 19, 2019
Merged

tickets/DM-16873 #255

merged 2 commits into from Jan 19, 2019

Conversation

natelust
Copy link
Contributor

No description provided.

Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

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

Looks good. Comments are 90% documentation issues.

@@ -630,9 +632,85 @@ class MeasureMergedCoaddSourcesConfig(Config):
target=CatalogCalculationTask,
doc="Subtask to run catalogCalculation plugins on catalog"
)
inputSchema = InitInputDatasetField(
doc="Input schema for measure merged task",
Copy link
Member

Choose a reason for hiding this comment

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

Probably better to document this by giving an example of a task that produces it; it's already obvious from context that it's the input schema for this task.

storageClass="SourceCatalog"
)
refCat = InputDatasetField(
doc="Reference catalog to use",
Copy link
Member

Choose a reason for hiding this comment

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

It's not obvious at the outset what the ref_cat is going to be used for in this task. Would be good to document that at some level.

)
visitCatalogs = InputDatasetField(
doc="Source catalogs for visits which overlap input tract, patch, abstract_filter. Will be "
"further filtered in the task",
Copy link
Member

Choose a reason for hiding this comment

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

I would also add something along the lines of "for the purpose of propagating flags from image calibration and characterization to coadd objects".

doc=("Name of the input catalog to use."
"If the single band deblender was used this should be 'deblendedFlux."
"If the multi-band deblender was used this should be 'deblendedModel."
"If no deblending was performed this should be 'mergeDet'"),
Copy link
Member

Choose a reason for hiding this comment

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

I think the situation is slightly more complex than this (maybe @fred3m can confirm): if the multi-band deblender was used, I think this can be either deblendedFlux or deblendedModel.

self.match.setRefObjLoader(refObjLoader)

# Set psfcache
inputData['exposure'].getPsf().setCacheCapacity(self.config.psfCache)
Copy link
Member

Choose a reason for hiding this comment

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

Could this be done in run instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general yes this sort of thing could go in run. However in this case, runDataRef has a specific interface for this that I didn't want to change, so it is here so I don't step on gen2 toes. I will add a comment to move it to run after gen2 deprecation.

inputCatalogWcsUpdate = []
for (i, dataId) in enumerate(inputDataIds['visitCatalogs']):
key = (dataId['visit'], dataId['detector'])
if (key) in inputVisitIds:
Copy link
Member

Choose a reason for hiding this comment

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

Drop the parentheses here.

inputCatalogWcsUpdate.append(ccdRecordsWcs[key])
inputData['visitCatalogs'] = inputCatalogsToKeep
inputData['wcsUpdates'] = inputCatalogWcsUpdate
inputData['ccdInputs'] = ccdInputs
Copy link
Member

Choose a reason for hiding this comment

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

Hopefully we can clean this up more fully when we don't have to support the CmdLineTask versions of things anymore, but do you think it would be an improvement now to bundle these three arguments into (e.g.) a namedtuple or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since ccdInputs is in the interface for the existing propagate visit flags, this is something I dont want to bundle as it would just need to be unpacked later. That leaves 2 things which does not seem worth bundling. I think it is better to have an explicit function signature instead of packing things just to unpack them inside the function.


self.measurement.run(sources, exposure, exposureId=self.getExposureId(patchRef))
def run(self, exposure, sources, skyInfo, exposureId, ccdInputs=None, visitCatalogs=None, wcsUpdates=None,
butler=None):
Copy link
Member

Choose a reason for hiding this comment

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

I know we're just trying to get things done quickly right now and plan to clean up in the future, but adding parameter docs for this method might be worth doing on this ticket, especially for anyone who might need to make changes to the Gen2 version before we retire it.

@@ -165,28 +166,23 @@ def run(self, butler, coaddSources, ccdInputs, coaddWcs):
@param[in,out] coaddSources Source catalog from the coadd
@param[in] ccdInputs Table of CCDs that contribute to the coadd
@param[in] coaddWcs Wcs for coadd
@param[in] visitCatalogs List of loaded source catalogs for each input ccd in
the coadd, this is used instead of this method loading
in the catalogs itself
Copy link
Member

Choose a reason for hiding this comment

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

-> "the coadd. If provided, this is used instead of this method loading in the catalogs itself."

c = ccdRecord.get(ccdKey)
dataId = {"visit": int(v), self.config.ccdName: int(c)}
ccdSources = butler.get("src", dataId=dataId, immediate=True)
def process_ccd(ccdSources, wcsUpdate):
Copy link
Member

Choose a reason for hiding this comment

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

-> camelCase

Allow PropagateVisitFlags to optionally take a catalog of inputs to
work on instead of reading them in itself.
@natelust natelust merged commit 9fc727f into master Jan 19, 2019
@timj timj deleted the tickets/DM-16873 branch February 18, 2021 15:50
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