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

First Pass Documentation (docstrings) For Process Folder #87

Merged
merged 5 commits into from
Apr 22, 2024
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
6 changes: 5 additions & 1 deletion model/src/pyrenew/process/ar.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def sample(
name : str, optional
Name of the parameter passed to numpyro.sample.
**kwargs : dict, optional
Ignored.
Additional keyword arguments passed through to internal sample()
calls, should there be any.

Returns
-------
Expand All @@ -85,4 +86,7 @@ def _ar_scanner(carry, next):

@staticmethod
def validate():
"""
Validates inputted parameters, implementation pending.
"""
return None
6 changes: 5 additions & 1 deletion model/src/pyrenew/process/firstdifferencear.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def sample(
name : str, optional
Passed to ARProcess.sample(), by default "trend_rw"
**kwargs : dict, optional
Ignored.
Additional keyword arguments passed through to internal sample()
calls, should there be any.

Returns
-------
Expand All @@ -67,4 +68,7 @@ def sample(

@staticmethod
def validate():
"""
Validates inputted parameters, implementation pending.
"""
return None
35 changes: 32 additions & 3 deletions model/src/pyrenew/process/rtrandomwalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
Parameters
----------
Rt0_dist : dist.Distribution, optional
Initial distributiono of Rt, defaults to
Initial distribution of Rt, defaults to
dist.TruncatedNormal( loc=1.2, scale=0.2, low=0 )
Rt_transform : AbstractTransform, optional
Transformation applied to the sampled Rt0, defaults
Expand All @@ -44,7 +44,35 @@ def __init__(
return None

@staticmethod
def validate(Rt0_dist, Rt_transform, Rt_rw_dist):
def validate(
Rt0_dist: dist.Distribution,
Rt_transform: AbstractTransform,
Rt_rw_dist: dist.Distribution,
) -> None:
"""
Validates Rt0_dist, Rt_transform, and Rt_rw_dist.

Parameters
----------
Rt0_dist : dist.Distribution, optional
Initial distribution of Rt, expected dist.Distribution
Rt_transform : any
Transformation applied to the sampled Rt0, expected
AbstractTransform
Rt_rw_dist : any
Randomwalk process, expected dist.Distribution.

Returns
-------
None

Raises
------
AssertionError
If Rt0_dist or Rt_rw_dist are not dist.Distribution or if
Rt_transform is not AbstractTransform.

"""
assert isinstance(Rt0_dist, dist.Distribution)
assert isinstance(Rt_transform, AbstractTransform)
assert isinstance(Rt_rw_dist, dist.Distribution)
Expand All @@ -61,7 +89,8 @@ def sample(
n_timepoints : int
Number of timepoints to sample.
**kwargs : dict, optional
Ignored.
Additional keyword arguments passed through to internal sample()
calls, should there be any.

Returns
-------
Expand Down
6 changes: 5 additions & 1 deletion model/src/pyrenew/process/simplerandomwalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def sample(
init : float, optional
Initial point of the walk, by default None
**kwargs : dict, optional
Ignored.
Additional keyword arguments passed through to internal sample()
calls, should there be any.

Returns
-------
Expand All @@ -65,4 +66,7 @@ def sample(

@staticmethod
def validate():
"""
Validates inputted parameters, implementation pending.
"""
return None