Skip to main content

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


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.post0.dev6.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cuqipy_cil-0.6.0.post0.dev6-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file cuqipy_cil-0.6.0.post0.dev6.tar.gz.

File metadata

  • Download URL: cuqipy_cil-0.6.0.post0.dev6.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cuqipy_cil-0.6.0.post0.dev6.tar.gz
Algorithm Hash digest
SHA256 ea6109fea81104713dacac4c1785c69ab2d1494fb49ad336e3b0caf25b770007
MD5 77710a9e7ca03445412a5024049794c4
BLAKE2b-256 68e9721ea0ab248e6b47917b54814cd42dd1e7fa5e7e1882664ed62c96570e1f

See more details on using hashes here.

File details

Details for the file cuqipy_cil-0.6.0.post0.dev6-py3-none-any.whl.

File metadata

File hashes

Hashes for cuqipy_cil-0.6.0.post0.dev6-py3-none-any.whl
Algorithm Hash digest
SHA256 96e7f505859918870528e3370c4df24ef482708806f28290953a23a12a3d2f5b
MD5 904d27f97ba5e8db954e73c1c4ffc44f
BLAKE2b-256 e62758ca79ac9d002f54dbe8f28a4fe47110e95d9f88ed88aa93e1f68006c02e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page