Skip to content

Commit

Permalink
Apply numpydoc style to docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
taldcroft committed Nov 19, 2023
1 parent 44c3bfe commit c2c2b9c
Show file tree
Hide file tree
Showing 15 changed files with 801 additions and 320 deletions.
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Don't show summaries of the members in each class along with the
# class' docstring
numpydoc_show_class_members = False

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode']
'sphinx.ext.viewcode',
'numpydoc']

try:
import matplotlib.sphinxext.plot_directive
Expand Down
4 changes: 3 additions & 1 deletion kadi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def test(*args, **kwargs):
def create_config_file(overwrite=False):
"""Create the configuration file for the kadi package.
:param overwrite: bool
Parameters
----------
overwrite : bool
Force updating the file if it already exists.
"""
from astropy import config
Expand Down
20 changes: 16 additions & 4 deletions kadi/commands/command_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,29 @@ def cmd_set_rts(*args, date=None):
def cmd_set_obsid(obs_id, date=None):
"""Return a command set that updates the commanded ObsID.
:param obsid: obsid
:returns: list of command defs suitable for generate_cmds()
Parameters
----------
obsid
obsid
Returns
-------
list of command defs suitable for generate_cmds()
"""
return (dict(type="MP_OBSID", tlmsid="COAOSQID", params=dict(ID=obs_id)),)


def cmd_set_maneuver(*args, date=None):
"""Return a command set that initiates a maneuver to the given attitude ``att``.
:param att: attitude compatible with Quat() initializer
:returns: list of command defs suitable for generate_cmds()
Parameters
----------
att
attitude compatible with Quat() initializer
Returns
-------
list of command defs suitable for generate_cmds()
"""
att = Quat(args)
return (
Expand Down
19 changes: 13 additions & 6 deletions kadi/commands/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,23 @@ def get_cmds(start=None, stop=None, inclusive_stop=False, scenario=None, **kwarg
>>> tlmsid='wsvidalldn') cmds = commands.get_cmds(msid='aflcrset')
>>> print(cmds)
:param start: DateTime format (optional) Start time, defaults to beginning
Parameters
----------
start : DateTime format (optional) Start time, defaults to beginning
of available commands (2002:001)
:param stop: DateTime format (optional) Stop time, defaults to end of available
stop : DateTime format (optional) Stop time, defaults to end of available
commands
:param inclusive_stop: bool, include commands at exactly ``stop`` if True.
:param scenario: str, None
inclusive_stop
bool, include commands at exactly ``stop`` if True.
scenario : str, None
Commands scenario (applicable only for V2 commands)
:param kwargs: key=val keyword argument pairs for filtering
kwargs
key=val keyword argument pairs for filtering
:returns: :class:`~kadi.commands.commands.CommandTable` of commands
Returns
-------
CommandTable
Commands in the interval and matching the filter criteria.
"""
commands_version = os.environ.get("KADI_COMMANDS_VERSION", conf.commands_version)
if commands_version == "2":
Expand Down
22 changes: 14 additions & 8 deletions kadi/commands/commands_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@ def get_cmds(start=None, stop=None, inclusive_stop=False, **kwargs):
>>> tlmsid='wsvidalldn') cmds = commands.get_cmds(msid='aflcrset')
>>> print(cmds)
:param start: DateTime format (optional) Start time, defaults to beginning
of available commands (2002:001)
:param stop: DateTime format (optional) Stop time, defaults to end of available
commands
:param inclusive_stop: bool, include commands at exactly ``stop`` if True.
:param kwargs: key=val keyword argument pairs for filtering
:returns: :class:`~kadi.commands.commands.CommandTable` of commands
Parameters
----------
start : DateTime format (optional)
Start time, defaults to beginning of available commands (2002:001)
stop : DateTime format (optional)
Stop time, defaults to end of available commands
inclusive_stop : bool
Include commands at exactly ``stop`` if True.
**kwargs : dict
key=val keyword argument pairs for filtering
Returns
-------
:class:`~kadi.commands.commands.CommandTable` of commands
"""
out = _find(start, stop, inclusive_stop, IDX_CMDS, PARS_DICT, **kwargs)
out.rev_pars_dict = weakref.ref(REV_PARS_DICT)
Expand Down
Loading

0 comments on commit c2c2b9c

Please sign in to comment.