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-13417 cleanup error reporting and docstrings in cameraGeom.utils #338

Merged
merged 4 commits into from Apr 17, 2018

Conversation

parejkoj
Copy link
Contributor

No description provided.

@PaulPrice
Copy link
Contributor

"Start cleaning up method" doesn't tell me anything useful. What method are you cleaning up? How are you cleaning up? Why are you cleaning up?

Copy link
Contributor

@PaulPrice PaulPrice left a comment

Choose a reason for hiding this comment

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

Commit messages need a LOT more info.
Some numpydoc types need to be fixed.
Numpydoc "Returns" format is wrong.

"""!Make an Image of a Camera
"""Make an Image of a Camera.

Put each ccd's image in the correct location and orientation on the focal
Copy link
Contributor

Choose a reason for hiding this comment

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

"ccd" --> "CCD"? Or maybe "detector"?

@@ -706,8 +710,8 @@ def makeImageFromCamera(camera, detectorNameList=None, background=numpy.nan, buf
@param[in] bufferSize Size of border in binned pixels to make around the camera image
@param[in] imageSource Source to get ccd images. Must have a getCcdImage method
@param[in] imageFactory Type of image to build
@param[in] binSize bin factor
@return an image of the camera
@param[in] binSize Step size between samples per image.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this makes less sense than "bin factor".

@param[in] binSize bin factor
@return an image of the camera
@param[in] binSize Step size between samples per image.
@return an afw.image.Image of the entire camera.
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought you were numpydocifying?


Returns
-------
`lsst.afw.geom.SkyWcs`
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to specify a name:

ampWcs : `lsst.afw.geom.SkyWcs`

@@ -73,17 +82,29 @@ def prepareWcsData(wcs, amp, isTrimmed=True):

def plotFocalPlane(camera, fieldSizeDeg_x=0, fieldSizeDeg_y=None, dx=0.1, dy=0.1, figsize=(10., 10.),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are the defaults for fieldSizeDeg_x and fieldSizeDeg_y different?

Why are there underscores in the 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.

I have no idea about either of those comments, I'm just bringing the documentation up to standard. Do you know why?

Choose a reason for hiding this comment

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

  1. git blame reveals that @kfindeisen added the arguments (and the underscores)
  2. The _y default is None so that it defaults to the value provided for _x; seems reasonable

Copy link
Member

Choose a reason for hiding this comment

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

I did not add the arguments, I merely renamed them from pupil* to field*. I can trace them back as far as @SimonKrughoff in 2014, they may be even older.

In any case, I have no objections to these names being brought up to convention if somebody feels it's within scope.

Source to get ccd images. Must have a `getCcdImage()` method.
imageFactory : `lsst.afw.image.Image`
Type of image to make
detectorNameList : `list`
Copy link
Contributor

Choose a reason for hiding this comment

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

`list` of `str`

Use all Detectors if None.
binSize : `int`
Step size between samples.
i.e. `np.linspace(0, bbox.getHeight(), bbox.getHeight()/binSize)`
Copy link
Contributor

Choose a reason for hiding this comment

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

The "i.e." ("that is") is saying how it's used, not what it is.

Copy link
Member

Choose a reason for hiding this comment

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

Where do we stand here? Paul's saying that this is e.g. not i.e. (and I agree), but I don't think that this is a helpful doc string even then. The original doc for binSize in makeImageFromCcd was "Bin the image by this factor in both dimensions" which is implemented in ccdImage = afwMath.binImage(ccdImage, binSize) and I think that that's what we should be saying here.

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'll go with that one.

There were at least 4 different definitions of the binSize parameter used in the various functions defined in this file. It would have helped if they were all self-consistent to start with.

title : `str
Title in display
showWcs : `bool
whether to include a WCS in the display
Copy link
Contributor

Choose a reason for hiding this comment

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

"Include a Wcs in the display?"


Returns
-------
The mosaic image.
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix.

@@ -447,6 +448,8 @@ def _prepareImage(self, ccd, im, binSize, allowRotate=True):
def getCcdImage(self, ccd, imageFactory=afwImage.ImageF, binSize=1):
"""Return an image of the specified ccd, and also the (possibly updated) ccd"""

log = lsst.log.Log.getLogger("cameraGeom.utils.ButlerImage")
Copy link
Contributor

Choose a reason for hiding this comment

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

Add "afw" prefix?

Ditto below.

Cleanup, correct, and expand on existing docstrings, in addition to converting
them from doxygen->numpydoc.
skip None images without swallowing exceptions
@parejkoj parejkoj merged commit 5f205ba into master Apr 17, 2018
@ktlim ktlim deleted the tickets/DM-13417 branch August 25, 2018 06:44
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

6 participants