Commit c3591cb4 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Working example with peak search

parent 1932e760
adu_per_eV = 1.0 ; no idea
clen = 0.13
res = 4545
photon_energy = 4972
;photon_energy = 2
dim0 = ss
dim1 = fs
data = /data/%/data
;panel 0
panel0/min_fs = 0
panel0/max_fs = 999
panel0/min_ss = 0
panel0/max_ss = 999
panel0/corner_y = -500
panel0/fs = 1.0x
panel0/ss = 1.0y
panel0/clen = 1.3000000e-01
panel0/res = 4.5454545e+03
panel0/coffset = 0.0000000e+00
panel0/adu_per_eV = 1.0000000e+00
panel0/max_adu = 1.0000000e+06
panel0/px = 1000
panel0/py = 1000
panel0/pix_width = 2.2000000e-04
panel0/d = 1.3000000e-01
panel0/corner_x = -500
import h5py
import os.path
from pycrystfel.bindings import find_peaks_single_panel
THIS_DIR = os.path.dirname(__file__)
f = h5py.File(os.path.join(THIS_DIR, 'monolithic_img_1.h5'), 'r')
arr = f['data/data'][()]
print("Image shape:", arr.shape)
find_peaks_single_panel(arr, os.path.join(THIS_DIR, '1panel.geom'))
import os
from libc.stdint cimport uintptr_t
from libc.stdlib cimport malloc, free
cimport numpy as cnp
......@@ -21,12 +22,16 @@ def find_peaks_single_panel(cnp.ndarray[cnp.npy_float, ndim=2] data, str geom_fi
cdef:
crystfel.beam_params beam
crystfel.image image
void* bad_px_mask
image.dp[0] = <float*>data.data
image.bad[0] = <int*>malloc(data.size * sizeof(int))
bad_px_mask = malloc(data.size * sizeof(int))
image.bad = <int**>&bad_px_mask
image.det = crystfel.get_detector_geometry(os.fsencode(geom_file), &beam)
print(f"Loaded geometry with {image.det.n_panels} panels")
image.features = NULL
crystfel.search_peaks_peakfinder8(
&image, max_n_peaks=200, threshold=20, min_snr=3, min_pix_count=2,
max_pix_count=200, local_bg_radius=3, min_res=0, max_res=1200,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment