Skip to content
Snippets Groups Projects
Commit a1d2e368 authored by Egor Sobolev's avatar Egor Sobolev
Browse files

Add function which returns detector shape

parent bed8ad41
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ from .draw import (plot_cell_parameters, plot_center_shift, ...@@ -6,7 +6,7 @@ from .draw import (plot_cell_parameters, plot_center_shift,
from .lattice import (cell_volume, get_min_bragg_dist, get_q_from_xyz, from .lattice import (cell_volume, get_min_bragg_dist, get_q_from_xyz,
ph_en_to_lambda, read_crystfel_cell, spacing) ph_en_to_lambda, read_crystfel_cell, spacing)
from .misc import (avg_pixel_displacement, badpixels_mask, ellipse, from .misc import (avg_pixel_displacement, badpixels_mask, ellipse,
gauss2d_fit, get_peak_position, pixels_to_image, gauss2d_fit, get_detector_shape, get_peak_position,
rmsd_per_group) pixels_to_image, rmsd_per_group)
from .refine import refine_geometry from .refine import refine_geometry
from .xwizio import parse_xwiz_summary from .xwizio import parse_xwiz_summary
...@@ -118,6 +118,19 @@ def badpixels_mask(pe, panels, snr=6, min_peak_count=4): ...@@ -118,6 +118,19 @@ def badpixels_mask(pe, panels, snr=6, min_peak_count=4):
return px return px
def get_detector_shape(panels):
"""Returns the shape of detector image array."""
ixmax = (
panels[['modno', 'orig_max_ss', 'orig_max_fs']].max()
.rename({'orig_max_fs': 'fs', 'orig_max_ss': 'ss'})
)
ixmin = (
panels[['modno', 'orig_min_ss', 'orig_min_fs']].min()
.rename({'orig_min_fs': 'fs', 'orig_min_ss': 'ss'})
)
return tuple((ixmax - ixmin + 1).tolist())
def pixels_to_image(shape, px, attr='msk'): def pixels_to_image(shape, px, attr='msk'):
"""Transforms dataset of pixels to the image array.""" """Transforms dataset of pixels to the image array."""
img = np.zeros(shape, px[attr].dtype) img = np.zeros(shape, px[attr].dtype)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment