Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
ToolBox
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
Model registry
Operate
Environments
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
SCS
ToolBox
Commits
8b40f020
Commit
8b40f020
authored
3 years ago
by
Cammille Carinan
Browse files
Options
Downloads
Patches
Plain Diff
Create new class on addition by aggregating list of image views
parent
eb1841a8
No related branches found
No related tags found
1 merge request
!170
hRIXS functions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/toolbox_scs/detectors/hrixs.py
+16
-6
16 additions, 6 deletions
src/toolbox_scs/detectors/hrixs.py
with
16 additions
and
6 deletions
src/toolbox_scs/detectors/hrixs.py
+
16
−
6
View file @
8b40f020
...
...
@@ -367,11 +367,21 @@ class hRIXS:
return
(
px
+
mx
)
/
2
,
py
-
my
def
__add__
(
self
,
other
):
ix
,
iy
=
self
.
spectrum
(
normalize
=
False
)
jx
,
jy
=
other
.
spectrum
(
normalize
=
False
)
images
=
split_images
(
self
.
images
)
+
split_images
(
other
.
images
)
return
self
.
__class__
(
images
=
images
,
norm
=
self
.
norm
+
other
.
norm
)
i_n
=
self
.
norm
or
0
j_n
=
other
.
norm
or
0
norm
=
((
i_n
+
j_n
)
or
1
)
return
ix
,
(
iy
+
jy
)
/
norm
def
split_images
(
images
):
"""
Split the images by the number of trains
and return the list of their views.
"""
# Check if the images has already been splitted
if
isinstance
(
images
,
list
):
return
images
# Check if the images is a numpy of of 2d image that follows
# the shape (num, y_dim, x_dim)
assert
len
(
images
.
shape
)
==
3
return
[
np
.
squeeze
(
image
)
for
image
in
np
.
vsplit
(
images
,
images
.
shape
[
0
])]
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