8000 Migrate all doc strings to use numpydoc by taldcroft · Pull Request #97 · sot/xija · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Migrate all doc strings to use numpydoc #97

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

Merged
merged 5 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

autosummary_generate = True

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
Expand All @@ -35,8 +37,13 @@
'sphinx.ext.intersphinx',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
'numpydoc',
]

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

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down Expand Up @@ -142,7 +149,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = []

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down
16 changes: 13 additions & 3 deletions xija/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@
__version__ = ska_helpers.get_version(__package__)

def test(*args, **kwargs):
'''
Run py.test unit tests.
'''
"""Run py.test unit tests.

Parameters
----------
*args :

**kwargs :


Returns
-------

"""
import testr
return testr.test(*args, **kwargs)
44 changes: 29 additions & 15 deletions xija/clogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,44 @@ def config_logger(name, format='%(message)s', datefmt=None,
stream=sys.stdout, level=logging.INFO,
filename=None, filemode='w', filelevel=None,
propagate=False):
"""
Do basic configuration for the logging system. Similar to
"""Do basic configuration for the logging system. Similar to
logging.basicConfig but the logger ``name`` is configurable and both a file
output and a stream output can be created. Returns a logger object.

The default behaviour is to create a StreamHandler which writes to
sys.stdout, set a formatter using the "%(message)s" format string, and
add the handler to the ``name`` logger.

A number of optional keyword arguments may be specified, which can alter
the default behaviour.

:param name: Logger name
:param format: handler format string
:param datefmt: handler date/time format specifier
:param stream: initialize the StreamHandler using ``stream``
(None disables the stream, default=sys.stdout)
:param level: logger level (default=INFO).
:param filename: create FileHandler using ``filename`` (default=None)
:param filemode: open ``filename`` with specified filemode ('w' or 'a')
:param filelevel: logger level for file logger (default=``level``)
:param propagate: propagate message to parent (default=False)
Parameters
----------
name :
Logger name
format :
handler format string (Default value = '%(message)s')
datefmt :
handler date/time format specifier (Default value = None)
stream :
initialize the StreamHandler using ``stream``
(None disables the stream, default=sys.stdout)
level :
logger level (default=INFO).
filename :
create FileHandler using ``filename`` (default=None)
filemode :
open ``filename`` with specified filemode ('w' or 'a') (Default value = 'w')
filelevel :
logger level for file logger (default=``level``)
propagate :
propagate message to parent (default=False)

Returns
-------
type
logging.Logger object

:returns: logging.Logger object
"""
# Get a logger for the specified name
logger = logging.getLogger(name)
Expand Down
82 changes: 65 additions & 17 deletions xija/component/base.py
9E81
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@

class Param(dict):
"""Model component parameter. Inherits from dict but adds attribute access
for convenience."""
for convenience.

Parameters
----------

Returns
-------

"""
def __init__(self, comp_name, name, val, min=-1e38, max=1e38,
fmt="{:.4g}", frozen=False):
dict.__init__(self)
Expand Down Expand Up @@ -63,9 +71,7 @@ def add_par(self, name, val=None, min=-1e38, max=1e38, fmt="{:.4g}",
self.pars.append(param)

def _getAttributeNames(self):
"""
Add dynamic attribute names for IPython completer.
"""
"""Add dynamic attribute names for IPython completer."""
return [par.name for par in self.pars]

def __getattr__(self, attr):
Expand Down Expand Up @@ -190,21 +196,35 @@ def get_dvals_tlm(self):

class Node(TelemData):
"""Time-series dataset for prediction.

If the ``sigma`` value is negative then sigma is computed from the
node data values as the specified percent of the data standard
deviation. The default ``sigma`` value is -10, so this implies
using a sigma of 10% of the data standard deviation. If ``sigma``
is set to 0 then the fit statistic is set to 0.0 for this node.

:param model: parent model
:param msid: MSID for telemetry data
:param name: component name (default=``msid``)
:param sigma: sigma value used in chi^2 fit statistic
:param quant: use quantized stats (not currently implemented)
:param predict: compute prediction for this node (default=True)
:param mask: Mask component for masking values from fit statistic
:param data: Node data (None or a single value)
Parameters
----------
model :
parent model
msid :
MSID for telemetry data
name :
component name (default=``msid``)
sigma :
sigma value used in chi^2 fit statistic
quant :
use quantized stats (not currently implemented)
predict :
compute prediction for this node (default=True)
mask :
Mask component for masking values from fit statistic
data :
Node data (None or a single value)

Returns
-------

"""
def __init__(self, model, msid, sigma=-10, quant=None,
predict=True, mask=None, name=None, data=None,
Expand All @@ -224,6 +244,13 @@ def __str__(self):
def randx(self):
"""Random X-offset for plotting which is a uniform distribution
with width = self.quant or 1.0

Parameters
----------

Returns
-------

"""
if not hasattr(self, '_randx'):
dx = self.quant or 1.0
Expand Down Expand Up @@ -307,8 +334,15 @@ class Coupling(ModelComponent):
"""\
First-order coupling between Nodes `node1` and `node2`
::

dy1/dt = -(y1 - y2) / tau

Parameters
----------

Returns
-------

"""
def __init__(self, model, node1, node2, tau):
ModelComponent.__init__(self, model)
Expand Down Expand Up @@ -350,14 +384,21 @@ class HeatSinkRef(ModelComponent):
tau does not affect the mean model temperature. This requires an extra
non-fitted parameter T_ref which corresponds to a reference temperature for
the node.::

dT/dt = U * (Te - T)
= P + U* (T_ref - T) # reparameterization

P = U * (Te - T_ref)
Te = P / U + T_ref

In code below, "T" corresponds to "Te" above. The "T" above is node.dvals.

Parameters
----------

Returns
-------

"""
def __init__(self, model, node, T=0.0, tau=20.0, T_ref=20.0):
ModelComponent.__init__(self, model)
Expand Down Expand Up @@ -399,6 +440,13 @@ def __str__(self):
class AcisFPtemp(Node):
"""Make a wrapper around MSID FPTEMP_11 because that currently comes from
the eng_archive in K instead of C.

Parameters
----------

Returns
-------

"""
def __init__(self, model, mask=None):
Node.__init__(self, model, 'fptemp_11', mask=mask)
Expand Down
Loading
0