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

Try to use image with peak finding

parent 5710b0f5
import os import os
cimport numpy as cnp
from . cimport crystfel from . cimport crystfel
def progress_bar(val, total, text): def progress_bar(val, total, text):
...@@ -13,3 +15,21 @@ def inspect_geom_file(path): ...@@ -13,3 +15,21 @@ def inspect_geom_file(path):
print("panel names:", [det.panels[i].name for i in range(det.n_panels)]) print("panel names:", [det.panels[i].name for i in range(det.n_panels)])
print("photon energy:", beam.photon_energy) print("photon energy:", beam.photon_energy)
crystfel.free_detector_geometry(det) crystfel.free_detector_geometry(det)
def find_peaks_single_panel(cnp.ndarray[cnp.npy_float, ndim=2] data, str geom_file):
cdef:
crystfel.beam_params beam
crystfel.image image
image.dp[0] = data.data
image.det = crystfel.get_detector_geometry(os.fsencode(geom_file), &beam)
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,
use_saturated=True,
)
print("Done peak search")
npeaks = crystfel.image_feature_count(image.features)
print(f"Found {npeaks} peaks")
...@@ -103,8 +103,8 @@ cdef extern from "crystfel/image.h": ...@@ -103,8 +103,8 @@ cdef extern from "crystfel/image.h":
ImageFeatureList *features ImageFeatureList *features
char* filename char* filename
cdef extern from "crystfel/peakfinder8.h": cdef extern from "crystfel/peaks.h":
int peakfinder8( int search_peaks_peakfinder8(
image *img, int max_n_peaks, float threshold, float min_snr, image *img, int max_n_peaks, float threshold, float min_snr,
int min_pix_count, int max_pix_count, int local_bg_radius, int min_res, int min_pix_count, int max_pix_count, int local_bg_radius, int min_res,
int max_res, int use_saturated int max_res, int use_saturated
......
Supports Markdown
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