Skip to content

Commit

Permalink
Added simple documentation with mkdocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
DuncDennis committed Mar 12, 2023
1 parent b5d1a2c commit 7dc8077
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 4 deletions.
12 changes: 12 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Welcome to LorenzPy

This site contains the documentation for the `LorenzPy` Python package
that can be used to simulate and measure discrete and continuous chaotic dynamical
systems.

## Contents:

1. [Reference](reference.md) The API reference.

## Project Overview:
::: lorenzpy
8 changes: 8 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### LorenzPy package:
::: lorenzpy

### simulations module:
::: lorenzpy.simulations

### measures module:
::: lorenzpy.measures
7 changes: 7 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
site_name: LorenzPy Docs

theme:
name: "material"

plugins:
- mkdocstrings
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ dev = [
"black==22.12.0",
"mypy==1.1.1",
"ruff==0.0.254",
"mkdocs",
"mkdocstrings[python]",
"mkdocs-material"
]
plot = [
"plotly==5.13.1",
Expand Down
48 changes: 44 additions & 4 deletions src/lorenzpy/simulations.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
"""Simulate various chaotic system to generate artificial data.
"""Simulate various continuous and discrete chaotic dynamical system.
Every dynamical system is represented as a class.
The general syntax for simulating the trajectory is:
trajectory = SystemClass(parameters=<default>).simulate(time_steps,
starting_point=<default>)
The available classes are:
- Lorenz63
The system's parameters are introduced in the class's constructor.
For example when creating a system object of the Lorenz63, the Lorenz parameters,
sigma, rho, beta, and the timestep dt are parsed as:
sys_obj = Lorenz63(sigma=10, rho=10, beta=5, dt=1)
Each sys_obj contains a "simulate" function.
To simulate 1000 time-steps of the Lorenz63 system call:
sys_obj.simulate(1000).
The general syntax to create a trajectory of a System is given as:
trajectory = <SystemClass>(<parameters>=<default>).
simulate(time_steps, starting_point=<default>)
Examples:
>>> import lorenzpy.simulations as sims
>>> data = sims.Lorenz63().simulate(1000)
>>> data.shape
(1000, 3)
"""

from __future__ import annotations
Expand Down Expand Up @@ -171,3 +194,20 @@ def flow(self, x: np.ndarray) -> np.ndarray:
x[0] * x[1] - self.beta * x[2],
]
)


def double_num(x: float) -> float:
"""Double a number.
Examples:
>>> double_num(3)
6
Args:
x: Input number to be doubled.
Returns:
Double of x.
"""
return 2 * x

0 comments on commit 7dc8077

Please sign in to comment.