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

docstring updating #118

Merged
merged 1 commit into from
Oct 22, 2024
Merged

docstring updating #118

merged 1 commit into from
Oct 22, 2024

Conversation

yoachim
Copy link
Member

@yoachim yoachim commented Oct 17, 2024

Lots of docstring formatting in example_scheduler.py

Copy link
Member

@rhiannonlynne rhiannonlynne left a comment

Choose a reason for hiding this comment

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

list of float (etc) needs to change to list [float] (etc)

exptime : `float`
The exposure time to use per visit (seconds).
Default 29.2
filter1s : `list` of `str`
Copy link
Member

Choose a reason for hiding this comment

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

HA_min(_max) : float
footprints : `rubin_scheduler.scheduler.utils.footprints.Footprints`
The footprints to be used.
night_pattern : `list` of `bool`
Copy link
Member

Choose a reason for hiding this comment

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

list [bool]

The weight on basis function that tries to stay avoid filter changes.
Default 3.0 (uniteless).
Copy link
Member

Choose a reason for hiding this comment

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

unitless

exptime : `float`
The exposure time to use per visit (seconds).
Default 29.2
filter1s : `list` of `str`
Copy link
Member

Choose a reason for hiding this comment

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

list [str]

nside : `int`
The HEALpix nside to use. Defaults to DEFAULT_NSIDE
filtername : `str`
The filter name for the first observation. Default "g".
Copy link
Member

Choose a reason for hiding this comment

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

Where we have a default value, it will show up in the docstring when this is built in the docs (see first screenshot). Because the docstring and the call are right next to each other, we don't have to repeat the default values in the docstring (and, as you can see in the second screenshot, it can make it all look messier).

I think if we're using None so that it defaults to some other value within the code, that "Default None will be set to xxxx" is useful, or it can be useful to know if we're setting the default for a good reason that other people should know (and then probably not change) - but otherwise we should probably get out of the habit of repeating our defaults.

Screenshot 2024-10-21 at 7 06 12 PM Screenshot 2024-10-21 at 7 08 24 PM

Copy link
Member Author

Choose a reason for hiding this comment

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

But if you pull up the docstring from the command line or in a notebook the call signature and the relevant section of the docstring can get totally separated.

image

Copy link
Member

Choose a reason for hiding this comment

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

I guess I was thinking that
Screenshot 2024-10-22 at 2 21 22 PM
is still less readable than this (where removing the additional Default lines means that the whole thing is shorter)
Screenshot 2024-10-22 at 2 24 24 PM

My main problem is that the defaults that are in these sections tend to get outdated. If these are kept up to date, I'll be ok.

@yoachim yoachim merged commit 6752517 into main Oct 22, 2024
7 checks passed
@rhiannonlynne rhiannonlynne deleted the u/yoachim/doc-formatting branch October 22, 2024 23:23
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.

2 participants