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(
im_size=(128, 128),
det_count=128,
angles=np.linspace(0, np.pi, 180),
phantom="shepp-logan"
).get_components()
# 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
CUQIpy-CIL-0.6.0.tar.gz
(14.3 kB
view details)
Built Distribution
File details
Details for the file CUQIpy-CIL-0.6.0.tar.gz
.
File metadata
- Download URL: CUQIpy-CIL-0.6.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5af73d5bd1ea85582c149e4322bd9486b93105822e0219d6b35128e0f6ff416 |
|
MD5 | 10fb9a5fc95e9e6bff4e34b0e4e9a660 |
|
BLAKE2b-256 | 25f37b5fde7ef362cfb9aad223874ad88002740e0ce528f4041ded97b83685c2 |
File details
Details for the file CUQIpy_CIL-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: CUQIpy_CIL-0.6.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9342702e93fbea38832e5b0490d844283117fabe1ad8782d1be7a2a938e09e7a |
|
MD5 | dfe638bbbf046c06687b940d248e8138 |
|
BLAKE2b-256 | 03a0801d80035e5e0ab1e22e80baa1a503449fb47636e7ace730aa01d653cee8 |