Skip to main content

Bayesian MEF

PyPI Python 3.9+ License

Bayesian multi-exposure image fusion (MEF) is a general purpose MEF algorithm suitable for any imaging scheme requiring high dynamic range (HDR) treatment. Implementation of the algorithm in the context of ptychography has been published as "Bayesian multi-exposure image fusion for robust high dynamic range preprocessing in ptychography".

demo_mef

To install the package and its dependencies,

pip install bayes_mef

Usage

A minimal example demonstrating the usage of BayesianMEF by simulating some data.

Open In Colab

from bayes_mef import BayesianMEF
from skimage.data import camera
import numpy as np

# simulation params
truth = camera()
background = 60  # some background
times = np.array([0.1, 1, 10])  # exposure times or equivalently flux factors
threshold = 1500 # detector limit

# poisson data based on image formation model that is overexposed
data = [np.random.poisson(time * truth + background) for time in times]
data_saturated = np.clip(data, None, threshold, dtype="float")

# Bayesian MEF with optional field `update_fluxes`. Set it to `True` when
# flux factors (exposure times) are not accurately known.
mef_em = BayesianMEF(data_saturated, threshold, times, background, update_fluxes=False)
mef_em.run(n_iter=100)
fused_im = mef_em.fused_image.copy()

Under scripts/ directory, MEF with ptychographic data and subsequent reconstructions used in the publication can be tested. These are based on the package ptylab that can be installed additionally.

pip install git+https://github.com/PtyLab/PtyLab.py.git@main

For faster reconstructions using GPU, please install cupy as given under its installation guide.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bayes_mef-0.1.3.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

bayes_mef-0.1.3-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file bayes_mef-0.1.3.tar.gz.

File metadata

  • Download URL: bayes_mef-0.1.3.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.5 Linux/6.5.0-25-generic

File hashes

Hashes for bayes_mef-0.1.3.tar.gz
Algorithm Hash digest
SHA256 09f9689b0ed20d15e8d87bf811bc93d70f9641afa5e12acfce303c88dd601116
MD5 05737f1b687f4b82a24b4274c0667cb4
BLAKE2b-256 b7757b5e6027fec40e5b6d8481172ba779633d6c608357e873c2ba11e6b2cae6

See more details on using hashes here.

File details

Details for the file bayes_mef-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: bayes_mef-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.5 Linux/6.5.0-25-generic

File hashes

Hashes for bayes_mef-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7ce9e0d2add2853d0bca5c1dc2977556769c23561190e09f32875652befa6acb
MD5 c9a20230bdc47059b12b3dfc2f0e2999
BLAKE2b-256 8bb4ff6463d4ee834e951b18274f517020539df53ecc369b25a5f7a28b74fe57

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page