Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cfel_fmt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dataAnalysis
cfel_fmt
Commits
c6b9f65b
Commit
c6b9f65b
authored
5 years ago
by
Valerio Mariani
Browse files
Options
Downloads
Patches
Plain Diff
Added a function to directly apply crystfel geometry to data
parent
ce68a50b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cfelpyutils/geometry_utils.py
+33
-0
33 additions, 0 deletions
cfelpyutils/geometry_utils.py
with
33 additions
and
0 deletions
cfelpyutils/geometry_utils.py
+
33
−
0
View file @
c6b9f65b
...
@@ -225,3 +225,36 @@ def compute_visualization_pix_maps(geometry):
...
@@ -225,3 +225,36 @@ def compute_visualization_pix_maps(geometry):
)
+
min_shape
[
0
]
//
2
-
1
)
+
min_shape
[
0
]
//
2
-
1
return
PixelMaps
(
new_x_map
,
new_y_map
,
None
,
None
,
None
)
return
PixelMaps
(
new_x_map
,
new_y_map
,
None
,
None
,
None
)
def
apply_geometry_to_data
(
data
,
geometry
):
"""
Apply geometry to data.
Returns a new numpy array containing the input data with the geometry applied.
The array is ready to be displayed using a library like matplotlib or pyqtgraph.
Args:
data (ndarray): a numpy array storing the data to which geometry should be
applied.
geometry (Dict): A CrystFEL geometry object (A dictionary
returned by the
:obj:`cfelpyutils.crystfel_utils.load_crystfel_geometry`
function).
Returns:
ndarray: a new array containing the input data to which the geometry has been
applied. The returned array shape is big enough to display all the input data
in the reference system of the physical detector. The array is also supposed to
be centered at the center of the reference system of the detector (i.e: the
beam interaction point).
"""
pixel_maps
=
compute_pix_maps
(
geometry
)
min_array_shape
=
compute_min_array_size
(
pixel_maps
)
visualization_array
=
numpy
.
zeros
(
min_array_shape
,
dtype
=
float
)
visual_pixel_maps
=
compute_visualization_pix_maps
(
geometry
)
visualization_array
[
visual_pixel_maps
.
y
.
flatten
(),
visual_pixel_maps
.
x
.
flatten
()]
=
data
.
ravel
().
astype
(
visualization_array
.
dtype
)
return
visualization_array
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment