Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Kluyver
Pycrystfel
Commits
c3591cb4
Commit
c3591cb4
authored
Jan 08, 2021
by
Thomas Kluyver
Browse files
Working example with peak search
parent
1932e760
Changes
3
Hide whitespace changes
Inline
Side-by-side
examples/1panel.geom
0 → 100644
View file @
c3591cb4
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
.
0
x
panel0
/
ss
=
1
.
0
y
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
examples/find_peaks.py
0 → 100644
View file @
c3591cb4
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'
))
pycrystfel/bindings.pyx
View file @
c3591cb4
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment