CUQIpy plugin for CIL
Project description
CUQIpy-CIL
CUQIpy-CIL is a plugin for the CUQIpy software package.
It adds a thin wrapper around Computed Tomography (CT) forward models from the Core Imaging Library (CIL).
Installation
First install CIL. Then install CUQIpy-CIL with pip:
pip install cuqipy-cil
If CUQIpy is not installed, it will be installed automatically.
Quickstart
import numpy as np
import matplotlib.pyplot as plt
import cuqi
import cuqipy_cil
# Load a CT forward model and data from testproblem library
A, y_data, info = cuqipy_cil.testproblem.ParallelBeam2D.get_components(
im_size=(128, 128),
det_count=128,
angles=np.linspace(0, np.pi, 180),
phantom="shepp-logan"
)
# Set up Bayesian model
x = cuqi.distribution.Gaussian(np.zeros(A.domain_dim), cov=1) # x ~ N(0, 1)
y = cuqi.distribution.Gaussian(A@x, cov=0.05**2) # y ~ N(Ax, 0.05^2)
# Set up Bayesian Problem
BP = cuqi.problem.BayesianProblem(y, x).set_data(y=y_data)
# Sample from the posterior
samples = BP.sample_posterior(200)
# Analyze the samples
info.exactSolution.plot(); plt.title("Exact solution")
y_data.plot(); plt.title("Data")
samples.plot_mean(); plt.title("Posterior mean")
samples.plot_std(); plt.title("Posterior standard deviation")
For more examples, see the demos folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for CUQIpy-CIL-0.4.0.post0.dev2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4180502e286e81ceaabf9f476d66fdc44d2160d3f0a615bc260d5137ea6dbce |
|
MD5 | 8f2ae2a56e65a75d5cc83c965b190f26 |
|
BLAKE2b-256 | a4c3d7498b6f520a7ac664354329d3a247f80d094c15fec71d483f65e0c260f8 |
Close
Hashes for CUQIpy_CIL-0.4.0.post0.dev2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 102009ed5769c0f87932c9f2bad2f037672ffb075cf70be02d7ec1114e00d1f1 |
|
MD5 | 344d7ca9784126e7bc42a6a7d6f613ea |
|
BLAKE2b-256 | 64c78af6f13b4829ce6978c156cc14c19d24e4564455eb8f6168f28b1c182839 |