Skip to content
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
34 changes: 0 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,6 @@ install-dev: ## Install development dependencies
marimo: ## Run marimo for editing notebooks
@./dev/marimo edit

.PHONY: notebook
notebook: ## Run Jupyter notebook server
@poetry run ./dev/start-jupyter 9095


.PHONY: book
book: ## Build static jupyter {book}
poetry run jupyter-book build notebooks --all
@cp notebooks/CNAME notebooks/_build/html/CNAME


.PHONY: nbconvert
nbconvert: ## Convert notebooks to myst markdown
poetry run ./dev/nbconvert

.PHONY: nbsync
nbsync: ## Sync python myst notebooks to .ipynb files - needed for vs notebook development
poetry run ./dev/nbsync

.PHONY: sphinx-config
sphinx-config: ## Build sphinx config
poetry run jupyter-book config sphinx notebooks

.PHONY: docs
docs: ## build documentation
@cp docs/index.md readme.md
Expand All @@ -56,21 +33,10 @@ docs: ## build documentation
docs-serve: ## serve documentation
@poetry run mkdocs serve --livereload --watch quantflow --watch docs

.PHONY: sphinx
sphinx: ## Build sphinx docs
poetry run sphinx-build notebooks path/to/book/_build/html -b html


.PHONY: publish
publish: ## Release to pypi
@poetry publish --build -u __token__ -p $(PYPI_TOKEN)


.PHONY: publish-book
publish-book: ## publish the book to github pages
poetry run ghp-import -n -p -f notebooks/_build/html


.PHONY: tests
tests: ## Unit tests
@./dev/test
Expand Down
81 changes: 81 additions & 0 deletions app/double_exponential_sampling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import marimo

__generated_with = "0.19.7"
app = marimo.App(width="medium")


@app.cell
def _():
import marimo as mo
from app.utils import nav_menu
nav_menu()
return (mo,)


@app.cell
def _(mo):
mo.md(r"""
# Double Exponential Sampling

Here we sample the Asymmetric Laplace distribution, a.k.a double exponential
We will set the mean to 0 and the variance to 1 so that the distribution is fully determined by the asymmetric parameter $\kappa$.

```python
from quantflow.utils.distributions import DoubleExponential
```
""")
return


@app.cell
def _():
from quantflow.utils.distributions import DoubleExponential
from quantflow.utils import bins
import numpy as np

def simulate_double_exponential(log_kappa: float, samples: int):
pr = DoubleExponential.from_moments(kappa=np.exp(log_kappa))
data = pr.sample(samples)
pdf = bins.pdf(data, num_bins=50, symmetric=0)
pdf["simulation"] = pdf["pdf"]
pdf["analytical"] = pr.pdf(pdf.index)
cha = pr.pdf_from_characteristic()
return pdf, cha
return (simulate_double_exponential,)


@app.cell
def _(mo):
samples = mo.ui.slider(start=100, stop=10000, step=100, value=1000, debounce=True, label="Samples")
log_kappa = mo.ui.slider(start=-2, stop=2, step=0.1, value=0.1, debounce=True, label="Asymmetry - $\log \kappa$")

controls = mo.hstack([samples, log_kappa], justify="start")
controls
return log_kappa, samples


@app.cell
def _(log_kappa, samples, simulate_double_exponential):
df, cha = simulate_double_exponential(log_kappa.value, samples.value)
return cha, df


@app.cell
def _(cha, df):
import plotly.graph_objects as go

simulation = go.Bar(x=df.index, y=df["simulation"], name="simulation")
analytical = go.Scatter(x=df.index, y=df["analytical"], name="analytical")
characteristic = go.Scatter(x=cha.x, y=cha.y, name="from characteristic", mode="markers")
fig = go.Figure(data=[simulation, characteristic, analytical])
fig
return


@app.cell
def _():
return


if __name__ == "__main__":
app.run()
1 change: 0 additions & 1 deletion app/gaussian_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
def _():
import marimo as mo
from app.utils import nav_menu

nav_menu()
return (mo,)

Expand Down
3 changes: 3 additions & 0 deletions dev/marimo
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
set -e

export PYTHONPATH=${PWD}:${PYTHONPATH}
ENV_FILE="${PWD}/.env"
touch ${ENV_FILE}
export $(grep -v '^#' ${ENV_FILE} | xargs)

poetry run marimo "$@"
7 changes: 0 additions & 7 deletions dev/nbconvert

This file was deleted.

7 changes: 0 additions & 7 deletions dev/nbsync

This file was deleted.

8 changes: 0 additions & 8 deletions dev/notebook_config.json

This file was deleted.

11 changes: 0 additions & 11 deletions dev/start-jupyter

This file was deleted.

1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ nav:
- Examples:
- Gaussian Sampling: examples/gaussian-sampling
- Poisson Sampling: examples/poisson-sampling
- Double Exponential Sampling: examples/double-exponential-sampling
- Hurst: examples/hurst
- Supersmoother: examples/supersmoother
- API Reference:
Expand Down
65 changes: 0 additions & 65 deletions notebooks/examples/exponential_sampling.md

This file was deleted.

60 changes: 0 additions & 60 deletions notebooks/examples/gaussian_sampling.md

This file was deleted.

19 changes: 0 additions & 19 deletions notebooks/examples/overview.md

This file was deleted.

Loading