Skip to main content

Lates Release Tests Documentation Documentation License

static-interpolation

Fast interpolation of paneled detector data, optimized for static sampling positions.

Main features

  • Plan first -> execute fast approach.
  • Mask aware interpolation.
  • Native support for paneled data
  • EXtra-geom integration.

Installation

It is available on pipy so you can simply pip install the package

pip install static-interpolation

Usage

AGIPD_1M Detector & polar grid on Ewald's sphere

simple_interpolation

import static_interpolation as si
from extra_geom import AGIPD_1MGeometry,agipd_asic_seams
from matplotlib import pyplot as plt

geom = AGIPD_1MGeometry.from_quad_positions(quad_pos=[
    (-525, 625), # in mm
    (-550, -10),
    (520, -160),
    (542.5, 475),
])

# Things that are not in geom but needed
nr,nphi = (512,2048) # polar coord shape
detector_origin = (0,0,0.2) # in meters
xray_energy = 7000 # in eV


# Instanciate the interpolator
agipd_interp = si.AGIPD_1MInterpolator.from_polar_ewald(geom,
                                         nr,
                                         nphi,
                                         xray_energy,
                                         detector_origin
										 )

# make test data
data,masks = si.utils._generate_test_data(geom,n_images=150)

# Interpolate 150 agipd patterns in one go
out,out_masks = agipd_interp(data,masks)


# Plotting
fig = si.utils._plot_detector_test(data[0],masks[0],out[0],out_masks[0],geom,figsize=(32,12))
plt.show()

General example

simple_interpolation

import numpy as np
import static_interpolation as si
from matplotlib import pyplot as plt

# simple cubic interpolation using 1 panel

# generate test data
rng = np.random.RandomState(12345)
nx,ny = 5,5
n_samples = 100
n_images = 20
data = rng.random((n_images,nx,ny))


# define image layout
layout = si.data_structures.ImageLayout.from_shape((nx,ny))

# define sampling points
sampling_points = np.stack(np.meshgrid(np.arange(n_samples)*(nx-1)/n_samples,np.arange(n_samples)*(ny-1)/n_samples,indexing='ij'),axis=-1)
samples = si.data_structures.SamplingGrid(points = sampling_points[None,...],n_panels=1)

# options
options = si.config.InterpolationPolicy()
options.method = options.Method.linear

# Instanciate interpolatiors
interp_cubic = si.interpolators.StaticInterpolator(samples,layout=layout)
interp_linear = si.interpolators.StaticInterpolator(samples,layout=layout,policy=options)

# Execute interpolations for all 20 images
out = interp_cubic(data)
out_linear = interp_linear(data)

# Plot Result
fig,axs = plt.subplots(1,3,figsize=(10,5))
axs[0].imshow(data[0])
axs[0].set_title("Data")
axs[1].imshow(out[0])
axs[1].set_title("Cubic interpolation")
axs[2].imshow(out_linear[0])
axs[2].set_title("Linear interpolation")
plt.show()

Metadata

Release files for static-interpolation 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for static-interpolation 0.6.1
File Size Uploaded
static_interpolation-0.6.1.tar.gz 37.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for static-interpolation 0.6.1
File Interpreter ABI Platform
static_interpolation-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 69.5 kB

Release files / static_interpolation-0.6.1.tar.gz

Download URL static_interpolation-0.6.1.tar.gz
Size 37.0 kB
Tags Source
SHA-256 checksum
How to use checksums
79e149ea40d38c96e90d13a9f94d236864bcd655d506d9db7547bd0fe4cafd67
BLAKE2b-256 checksum
How to use checksums
791950d1beba792d1cd36492dc9be45a10775804006f45753803866e2d03a492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release files / static_interpolation-0.6.1-py3-none-any.whl

Download URL static_interpolation-0.6.1-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77bd560831b9d56e9fa3211367fca536d253fdd4bd9f71c4711daf4d9b8fbc44
BLAKE2b-256 checksum
How to use checksums
f7ead2a73129b8fd268c51febbfd918aa1090dce6ea3f35d0272dbc27c64d877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release history Release notifications | RSS feed

0.6.2

2 release files

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release 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