Skip to content

Getting started

Logo pdm-managed PyPI Python 3.11 Commits build docs tests Coverage Status Algorithm description

Efficient framework for building surrogates of multidisciplinary systems. Uses the adaptive multi-index stochastic collocation (AMISC) technique.

Installation

We highly recommend using pdm:

pip install --user pdm
cd <your-project>
pdm init
pdm add amisc
However, you can also install normally:
pip install amisc
To install from an editable local directory (e.g. for development), first fork the repo and then:
git clone https://github.com/<your-username>/amisc.git
pdm add -e ./amisc --dev  # or..
pip install -e ./amisc    # similarly
This way you can make changes to amisc locally while working on some other project for example. You can also quickly set up a dev environment with:
git clone https://github.com/<your-username>/amisc.git
cd amisc
pdm install  # reads pdm.lock and sets up an identical venv

Quickstart

import numpy as np

from amisc.system import SystemSurrogate, ComponentSpec
from amisc.rv import UniformRV

def fun1(x):
    return dict(y=x * np.sin(np.pi * x))

def fun2(x):
    return dict(y=1 / (1 + 25 * x ** 2))

x = UniformRV(0, 1, 'x')
y = UniformRV(0, 1, 'y')
z = UniformRV(0, 1, 'z')
model1 = ComponentSpec(fun1, exo_in=x, coupling_out=y)
model2 = ComponentSpec(fun2, coupling_in=y, coupling_out=z)

inputs = x
outputs = [y, z]
system = SystemSurrogate([model1, model2], inputs, outputs)
system.fit()

x_test = system.sample_inputs(10)
y_test = system.predict(x_test)

Contributing

See the contribution guidelines.

Citations

AMISC paper [1].