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.ParallelBeam2DProblem.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.2.0.post0.dev4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 340040a276bf8b53eff430811c00a8777dda9ac9b0ca99d058404a1279cf59b3 |
|
MD5 | 8c3e3064359babca85216a558959f304 |
|
BLAKE2b-256 | 7b6a4194ce3987bcc73c93b59774866dc48f079b0a2f24cc4f25ea9c15194922 |
Close
Hashes for CUQIpy_CIL-0.2.0.post0.dev4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae1ada68b48753ae19175f8cfbd3f9dc1ec712ec949b9af47c21b322c2a2f823 |
|
MD5 | e4685ef26ced5abc178d2a324bc6258a |
|
BLAKE2b-256 | 7b285f1be081a73a16ec790bebccdbf763a3dd48dfad4e98d0601960b9457d30 |