Skip to content

Commit

Permalink
style: small doc and ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eckelsjd committed Aug 28, 2024
1 parent f48841f commit fe0e8cd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ jobs:
with:
body_path: body.md
tag_name: ${{ github.ref_name }}
files: dist/**
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
![Logo](https://raw.githubusercontent.com/eckelsjd/uqtils/main/docs/assets/logo.svg)

[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm-project.org)
[![Python version](https://img.shields.io/badge/python-3.11+-blue.svg?logo=python&logoColor=cccccc)](https://www.python.org/downloads/)
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-orange.json)](https://github.com/eckelsjd/copier-numpy)
[![PyPI](https://img.shields.io/pypi/v/uqtils?logo=python&logoColor=%23cccccc)](https://pypi.org/project/uqtils)
![build](https://img.shields.io/github/actions/workflow/status/eckelsjd/uqtils/deploy.yml?logo=github)
![docs](https://img.shields.io/github/actions/workflow/status/eckelsjd/uqtils/docs.yml?logo=materialformkdocs&logoColor=%2523cccccc&label=docs)
![tests](https://img.shields.io/github/actions/workflow/status/eckelsjd/uqtils/tests.yml?logo=github&logoColor=%2523cccccc&label=tests)
![Code Coverage](https://img.shields.io/badge/coverage-87%25-yellowgreen?logo=codecov)
![Code Coverage](https://img.shields.io/badge/coverage-88%25-yellowgreen?logo=codecov)

Assorted utilities for uncertainty quantification and scientific computing.

Expand Down
2 changes: 1 addition & 1 deletion docs/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions src/uqtils/example.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Examples for using the package."""
# ruff: noqa: F841
# ruff: noqa: I001

def normal_example():
"""Sample and plot a normal pdf."""
# --8<-- [start:normal]
import numpy as np

import uqtils as uq

ndim = 3
Expand All @@ -25,7 +25,6 @@ def gradient_example():
"""Evaluate 1d and multivariate gradients."""
# --8<-- [start:gradient]
import numpy as np

import uqtils as uq

# 1d example
Expand Down Expand Up @@ -55,7 +54,6 @@ def mcmc_example():
"""Sample from a logpdf distribution using MCMC."""
# --8<-- [start:mcmc]
import numpy as np

import uqtils as uq

def fun(x):
Expand All @@ -78,12 +76,11 @@ def sobol_example():
"""Do Sobol' analysis on the Ishigami test function."""
# --8<-- [start:sobol]
import numpy as np
import uqtils as uq

from uqtils.sobol import ishigami, sobol_sa

model = lambda x: ishigami(x)['y']
model = lambda x: uq.ishigami(x)['y']
sampler = lambda shape: np.random.rand(*shape, 3) * (2 * np.pi) - np.pi
n_samples = 1000

S1, ST = sobol_sa(model, sampler, n_samples)
S1, ST = uq.sobol_sa(model, sampler, n_samples)
# --8<-- [end:sobol]
4 changes: 2 additions & 2 deletions src/uqtils/sobol.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from uqtils import ax_default

__all__ = ['sobol_sa']
__all__ = ['sobol_sa', 'ishigami']


def sobol_sa(model, sampler, num_samples: int, qoi_idx: list[int] = None, qoi_labels: list[str] = None,
Expand Down Expand Up @@ -229,5 +229,5 @@ def sobol_sa(model, sampler, num_samples: int, qoi_idx: list[int] = None, qoi_la


def ishigami(x, a=7.0, b=0.1):
"""For testing Sobol indices: https://doi.org/10.1109/ISUMA.1990.151285"""
"""For testing Sobol indices: [Ishigami function](https://doi.org/10.1109/ISUMA.1990.151285)"""
return {'y': np.sin(x[..., 0:1]) + a*np.sin(x[..., 1:2])**2 + b*(x[..., 2:3]**4)*np.sin(x[..., 0:1])}

0 comments on commit fe0e8cd

Please sign in to comment.