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-15681: convert skymap documentation to numpydoc #25

Merged
merged 2 commits into from Dec 19, 2018

Conversation

DavidStaker
Copy link

No description provided.

@DavidStaker DavidStaker changed the title all to numpydoc - WIP tickets/DM-15681 - convert skymap documentation to numpydoc Sep 10, 2018
Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

I've left some comments: see if you can apply them to the rest of the code, and I'll take another look (so I'm not making the same comment repeatedly). Please ask questions if my comments aren't clear (or if I got something wrong about the documentation policy).

doc/lsst.skymap/index.rst Outdated Show resolved Hide resolved
doc/skymap/index.rst Outdated Show resolved Hide resolved
python/lsst/skymap/baseSkyMap.py Outdated Show resolved Hide resolved
python/lsst/skymap/baseSkyMap.py Outdated Show resolved Hide resolved
python/lsst/skymap/baseSkyMap.py Outdated Show resolved Hide resolved
python/lsst/skymap/baseSkyMap.py Outdated Show resolved Hide resolved
python/lsst/skymap/baseSkyMap.py Outdated Show resolved Hide resolved
python/lsst/skymap/detail/dodecahedron.py Outdated Show resolved Hide resolved
@return a list of face centers (in index order); each a unit vector (numpy array)
Returns
-------
results : `self.faceVecList[:]`
Copy link
Contributor

Choose a reason for hiding this comment

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

that's not a type

Copy link
Author

Choose a reason for hiding this comment

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

Does this also just count as "callable"?

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 it's a np.ndarray.

python/lsst/skymap/detail/dodecahedron.py Outdated Show resolved Hide resolved
@jonathansick
Copy link
Member

Hey @DavidStaker, just to alert you that something might be wonky with the Git history here. Generally a PR shouldn't have a merge commit from another PR (did you update your branch using the green button)? There's also some Git merge conflict markup in doc/lsst.skymap/index.rst.

@parejkoj parejkoj dismissed their stale review December 18, 2018 00:44

Made my own edits: Russell is reviewing now.

Copy link
Contributor

@r-owen r-owen left a comment

Choose a reason for hiding this comment

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

Please take another pass. If you want help I am willing.

@@ -0,0 +1,47 @@
.. py:currentmodule:: lsst.skymap

.. _lsst.skymap:
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 is redundant with the title on line 6 and on my home Mac that redundancy gives a warning

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

There shouldn't be a pre-existing label with this name. I'll take a look around the package to see what's up.

Copy link
Member

Choose a reason for hiding this comment

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

I can't reproduce the warning with the lsst.skymap label.

These are the only warnings I get:

/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.BaseSkyMapConfig.compare:12: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.BaseSkyMapConfig.loadFromStream:7: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.DodecaSkyMapConfig.compare:12: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.DodecaSkyMapConfig.loadFromStream:7: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.EquatSkyMapConfig.compare:12: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.EquatSkyMapConfig.loadFromStream:7: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.baseSkyMap.BaseSkyMapConfig.compare:12: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.baseSkyMap.BaseSkyMapConfig.loadFromStream:7: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.healpixSkyMap.HealpixSkyMapConfig.compare:12: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.healpixSkyMap.HealpixSkyMapConfig.loadFromStream:7: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.ringsSkyMap.RingsSkyMapConfig.compare:12: WARNING: Unexpected indentation.
/Users/jsick/lsst/pipelines_lsst_io_stack/stacks/d_2018_12_07/stack/miniconda3-4.5.4-fcd27eb/DarwinX86/pex_config/16.0-8-g4734f7a/python/lsst/pex/config/config.py:docstring of lsst.skymap.ringsSkyMap.RingsSkyMapConfig.loadFromStream:7: WARNING: Unexpected indentation.
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] py-api/lsst.skymap.ringsSkyMap.RingsSkyMapConfig
generating indices...
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 12 warnings.

The HTML pages are in doc/_build/html.

Copy link
Member

Choose a reason for hiding this comment

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

@r-owen what version of Sphinx do you have installed?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, that's dope. I'm still very interested in getting to the bottom of the warning Russell is experiencing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was seeing it at home. I'll have to check it there.

Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot to do this last night. But I am confused. @jonathansick why isn't the link redundant? I thought all titles made links automatically, so:

###########
lsst.skymap
###########

should make an anchor lsst.skymap which is the same as the anchor above that my build complained about.

Copy link
Member

Choose a reason for hiding this comment

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

If you use a link target, like

.. _lsst.skymap:

###########
lsst.skymap
###########

It means you can link to that page/title with a ref:

:ref:`lsst.skymap`

Without the label, the ref role won't make a link. Now, if it does, that means that another lsst.skymap label is defined elsewhere, which wouldn't be good.

It's true that Sphinx always autoslugifies headings and turns those into permalink, regardless of their being a link target associated with the header. But those automatic anchor links are only accessible from HTML, and aren't accessible from reStructuredText's ref role.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jonathansick thank you for the explanation. Today when I got home I tried package-docs clean followed by package-docs build and saw no warnings. I don't know where that warning came from.

``lsst.skymap`` is developed at https://github.com/lsst/skymap.
You can find Jira issues for this module under the `skymap <https://jira.lsstcorp.org/issues/?jql=project%20%3D%20DM%20AND%20component%20%3D%20skymap>`_ component.

.. If there are topics related to developing this module (rather than using it), link to this from a toctree placed here.
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest deleting this line

.. If there are topics related to developing this module (rather than using it), link to this from a toctree placed here.

.. .. toctree::
.. :maxdepth: 1
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 is redundant with the toctree on line 19 (but examine the built html if in doubt).

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, this is in the template example.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

But you can delete the comment right now if you like.

:no-main-docstr:
:no-inheritance-diagram:
.. automodapi:: lsst.skymap.detail
.. automodapi:: lsst.skymap.baseSkyMap
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed? baseSkyMap is included by skymap/__init__.py unlike the others (detail, cachingSkyMap...). I'm a bit surprised that the modules listed in lines 45-47 are not included, but they aren't and changing that may be out of scope (though I wouldn't complain if you did it).

Parameters
----------
config : `BaseSkyMapConfig` or None
The configuration for this SkyMap; if None use the default config.
Copy link
Contributor

Choose a reason for hiding this comment

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

The parameters should be moved to the class doc string any __init__.py should not have any doc string. https://developer.lsst.io/python/numpydoc.html#documenting-classes

Sorry about that. I wrote a lot of this before that rule and until that rule I always documented __init__.py.

Please look for this everywhere in the package.


Returns
-------
tractList :
Copy link
Contributor

Choose a reason for hiding this comment

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

Specify the type as `list` of `TractInfo` and simplify the text on the next line (e.g. "Tracts which include...").


@note
Notes
-----
Copy link
Contributor

Choose a reason for hiding this comment

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

Again the note is obsolete (sorry I missed that when I got rid of afw.Coord).

Parameters
----------
coordList : `list` of `lsst.geom.SpherePoint`
list of sky coordinates
Copy link
Contributor

Choose a reason for hiding this comment

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

ICRS sky coordinates

@@ -364,7 +426,7 @@ def __init__(self, ident, patchInnerDimensions, patchBorder, ctrCoord, radius, t
self._vertexCoordList = finalWcs.pixelToSky(bboxD.getCorners())

def _minimumBoundingBox(self, wcs):
"""The minimum bounding box is calculated using the nominated radius"""
"""The minimum bounding box is calculated using the nominated radius."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider rewording as a proper doc string, e.g.

"""Calculate the minimum bounding box for the tract, given the WCS,
and the nominated radius.
"""

@warning: this is not a deep copy
Notes
-----
**Warning:** this is not a deep copy
Copy link
Contributor

Choose a reason for hiding this comment

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

SkyWcs is immutable, so this note is obsolete.

I suggest specifying the return type of afw.math.SkyWcs.

@parejkoj
Copy link
Contributor

Ok, I think I took care of all your comments, @r-owen. Still no build warnings for me.

Copy link
Contributor

@r-owen r-owen left a comment

Choose a reason for hiding this comment

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

Some of the things I looked at haven't been fixed. I didn't check the others.

@@ -0,0 +1,47 @@
.. py:currentmodule:: lsst.skymap

.. _lsst.skymap:
Copy link
Contributor

Choose a reason for hiding this comment

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

I was seeing it at home. I'll have to check it there.


class Dodecahedron:
"""A dodecahedron

Contains positions of faces and associated vertices
Copy link
Contributor

Choose a reason for hiding this comment

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

Still no docs for the constructor parameter here or for DodecaSkyMap. Please look harder for this. All classes should document their constructor arguments.

- This routine will be more efficient if coord is ICRS.
- If coord is equidistant between multiple sky tract centers then one is arbitrarily chosen.
- The default implementation is not very efficient; subclasses may wish to override.

Copy link
Contributor

Choose a reason for hiding this comment

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

I still find 4 instances of this. Did you push your changes?

@parejkoj
Copy link
Contributor

I think I hadn't pushed between going to your office and you looking at it. It is pushed now (your above comments no longer apply).

Copy link
Contributor

@r-owen r-owen left a comment

Choose a reason for hiding this comment

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

Still some changes to make, but at this point I'd say make them and merge.

-------
reList : `list` of `TractInfo` or `PatchInfo`
For tracts and patches that contain, or may contain, the specified
region. The list will be empty if there is no overlap.
Copy link
Contributor

Choose a reason for hiding this comment

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

The return type is wrong. This function returns `list` of (`TractInfo`, `list` of `PatchInfo`)

See RingSkyMap.py for a skymap that has this correct. Please make them the same. (You could delete the version in RingSkyMap if the rendered document picks it up from the base class).

Returns
-------
result : `distTractInfoList`
TractInfo of tract whose center is nearest the specified coord.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong. It should read tractInfo : `TractInfo`

all subclasses, but called only by the base class implementation of
`getSha1()`.
`getSha1` .
Copy link
Contributor

Choose a reason for hiding this comment

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

Also for the register method below: the name and registry arguments should be documented. @TallJimbo wrote this code so I am hoping he can weigh in on this.

name is of type str and if Jim cannot provide a better description then I suggest you use "Name of sky map" but it is too vague to make me happy.
I don't know the data type for a Gen3 butler registry. Jim?

@@ -0,0 +1,47 @@
.. py:currentmodule:: lsst.skymap

.. _lsst.skymap:
Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot to do this last night. But I am confused. @jonathansick why isn't the link redundant? I thought all titles made links automatically, so:

###########
lsst.skymap
###########

should make an anchor lsst.skymap which is the same as the anchor above that my build complained about.

@@ -76,24 +76,30 @@ class BaseSkyMap:

See TractInfo for more information.

Parameters
----------
config : `BaseSkyMapConfig` or None
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest config : `BaseSkyMapConfig` (optional)
and look for all other instances of config : because there is a wide variation in how this is listed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I cleaned it up as best I could: there's also variation in the __init__ call signatures (some default None, some don't).

Returns
-------
finalBBox : `lsst.geom.Box2I`
revised bounding box,
Copy link
Contributor

Choose a reason for hiding this comment

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

"Revised bounding box" (with or without a final period). Please don't end with a comma.

finalBBox : `lsst.geom.Box2I`
revised bounding box,
wcs : `lsst.afw.geom.SkyWcs`
revised Wcs
Copy link
Contributor

Choose a reason for hiding this comment

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

"Revised WCS"

ICRS sky coordinate of center of inner region of tract; also used as
the CRVAL for the WCS.
vertexCoordList : `list` of `lsst.afw.geom.SpherePoint`
Of vertices that define the boundaries of the inner region.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Vertices that define" or "List of vertices that define". Looks like an error from automatic conversion.

Notes
-----
warning:
- This may give incorrect answers on regions that are larger than a tract
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix to make warning bold and render the items as an unordered list:

**warning:**

- This may give...
- This uses...
  (especially if..

Returns
-------
result : `list` of `lsst.skymap.PatchInfo`
List of PatchInfo for patches that contain, or may contain, the specified region.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is too long. The warnings below are also too long.

WERKSQUAD and others added 2 commits December 19, 2018 13:06
Update doc/ directory to contain pipelines RST files.

Fix `__all__`
@parejkoj parejkoj changed the title tickets/DM-15681 - convert skymap documentation to numpydoc DM-15681: convert skymap documentation to numpydoc Dec 19, 2018
@parejkoj parejkoj merged commit 5858431 into master Dec 19, 2018
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

5 participants