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-22643: convert visualizeVisit to gen3 #366

Merged
merged 3 commits into from Apr 20, 2020
Merged

DM-22643: convert visualizeVisit to gen3 #366

merged 3 commits into from Apr 20, 2020

Conversation

czwa
Copy link
Contributor

@czwa czwa commented Mar 31, 2020

Add gen3 implementation of visualizeVisit.

@czwa czwa requested a review from natelust March 31, 2020 22:45
Copy link
Contributor

@natelust natelust left a comment

Choose a reason for hiding this comment

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

Please consider how this interacts with and or suppliments, and or can make use of the Mosaic functionality in afw.display.utils.Mosaic class. You man be able to simplify some things, and use just as a framework for working with the butler.

binning: 8
connections.inputExp: 'calexp'
connections.outputExp: 'calexpBin'
moz:
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use more descriptive labels for these tasks

)


class VisBinTask(pipeBase.PipelineTask,
Copy link
Contributor

Choose a reason for hiding this comment

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

It is more verbose, but I think our coding standards perfer longer descriptive names, so something like VisualizeBinTask. On that note, I am not sure what the "bin" is in this name, maybe be more descriptive there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to me. Renamed to Visualize{Action}ExpTask, as they are tasks that Bin/Mosaic Exposure data for Visualization.


class VisBinTask(pipeBase.PipelineTask,
pipeBase.CmdLineTask):
"""Task for focal plane visualization.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please expand this doc string just a bit, maybe some what/and or how

config:
binning: 8
connections.inputExp: 'calexp'
connections.outputExp: 'calexpBin'
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to set these since it appears you are using the default names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not. It's likely an artifact from me changing those defaults before making the PR.


binned = inputExp.getMaskedImage()
binned = afwMath.binImage(binned, self.config.binning)
outputExp = afwImage.makeExposure(binned)
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is going to be an exposure, you should copy all the associated info from an exposure, ie the exposure info and such.

python/lsst/pipe/tasks/visualizeVisit.py Outdated Show resolved Hide resolved
if hasattr(image, "getImage"):
image = image.getImage()

image = afwMath.rotateImageBy90(image, detector.getOrientation().getNQuarter())
Copy link
Contributor

Choose a reason for hiding this comment

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

You should check if they actually need rotated or put a comment saying that rotateImageBy90 does the check, It would be a shame to do lots of linear algebra with identity matrices

python/lsst/pipe/tasks/visualizeVisit.py Outdated Show resolved Hide resolved
python/lsst/pipe/tasks/visualizeVisit.py Show resolved Hide resolved
pipelineConnections=VisMosaicConnections):
"""Configuration for focal plane visualization.
"""
binning = pexConfig.Field(
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is binning done on the focal plane exposure that is done from binned exposures? So if you bin exposures by 8, and then set this binning to 8 the final is 64 times smaller? This seems a bit unclear. If I am correct (or if I am not) please write more doc string to describe this, and maybe put it in comments. Someone just reading the configs might guess that this value must be set to match the other from the other task for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is multiplicative. I'll update the docstring to make that clear, and to mention why this is a good thing.

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've updated the docstring again to fix my incorrect understanding, after some additional testing from Yusra and Lee. The two numbers must agree between tasks, and so I've added a contract enforcing that to the default pipeline.

@czwa czwa force-pushed the tickets/DM-22643 branch 2 times, most recently from 8c03013 to 28444d3 Compare April 9, 2020 21:31
description: Visualize full visit/focal plane with binned and mosaic images.
tasks:
binning:
class: lsst.pipe.tasks.visualizeVisit.VisualizeBinExpTask
Copy link
Contributor

Choose a reason for hiding this comment

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

You should not even need to specify class here, just do binning: lsst.pipe.tasks.visualizeVisit.VisualizeBinExpTask

@czwa czwa merged commit 8a917ba into master Apr 20, 2020
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