Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calng
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
calibration
calng
Commits
e316f589
Commit
e316f589
authored
1 year ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Update LUT, update test
parent
0b32e7fd
Branches
rotate-strixel_rows_a1256
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!88
Update strixel "rows A1256" implementation to accomodate rotation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/calng/kernels/strixel_rows_A1256-lut_mask.npz
+0
-0
0 additions, 0 deletions
src/calng/kernels/strixel_rows_A1256-lut_mask.npz
tests/test_strixel.py
+21
-21
21 additions, 21 deletions
tests/test_strixel.py
with
21 additions
and
21 deletions
src/calng/kernels/strixel_rows_A1256-lut_mask.npz
+
0
−
0
View file @
e316f589
No preview for this file type
This diff is collapsed.
Click to expand it.
tests/test_strixel.py
+
21
−
21
View file @
e316f589
...
...
@@ -7,10 +7,10 @@ pixel_data = np.arange(512 * 1024).reshape(512, 1024).astype(np.float32)
def
test_cols_A0123
():
def
convert_cols_A0123
(
data
,
out
=
None
):
def
convert_cols_A0123
(
data
):
# https://redmine.xfel.eu/issues/126444
if
out
is
None
:
out
=
np
.
zeros
((
86
,
(
1024
*
3
+
18
)),
dtype
=
np
.
float32
)
out
=
np
.
empty
((
86
,
(
1024
*
3
+
18
)),
dtype
=
np
.
float32
)
out
.
fill
(
np
.
nan
)
# 256 not divisible by 3, so we round up
# 18 since we have 6 more pixels in H per gap
# first we fill the normal pixels, the gap ones will be overwritten later
...
...
@@ -51,38 +51,38 @@ def test_cols_A0123():
lut
=
lut_package
[
"
lut
"
],
mask
=
lut_package
[
"
mask
"
],
out
=
strixel_lut
,
missing
=
0
,
missing
=
np
.
nan
,
)
assert
np
.
array_equal
(
strixel_naive
,
strixel_lut
)
assert
np
.
array_equal
(
strixel_naive
,
strixel_lut
,
equal_nan
=
True
)
def
test_rows_A1256
():
def
convert_rows_A1256
(
data
,
out
=
None
):
def
convert_rows_A1256
(
data
):
# https://redmine.xfel.eu/issues/161148
if
out
is
None
:
out
=
np
.
zeros
([
*
data
.
shape
[:
-
2
],
1488
,
165
],
dtype
=
np
.
float32
)
out
=
np
.
empty
([
*
data
.
shape
[:
-
2
],
1488
,
164
],
dtype
=
np
.
float32
)
out
.
fill
(
np
.
nan
)
# Select only 4 center ASICS
data
=
np
.
rot90
(
data
,
k
=
2
,
axes
=
(
-
2
,
-
1
))
data
=
data
[...,
256
:
768
]
# Offset due to guard ring pixels
offset_y
=
9
offset_x
=
11
offset_x_l
=
11
offset_x_r
=
12
for
xin
in
range
(
offset_x
,
512
-
9
):
# on the right side, there are 9 guard ring pixels
# Bottom ASICs
for
xin
in
range
(
offset_x_l
,
512
-
offset_x_r
):
for
yin
in
range
(
offset_y
,
255
):
yout
=
(
xin
-
offset_x
)
%
3
+
(
yin
-
offset_y
)
*
3
xout
=
(
xin
-
offset_x
)
//
3
+
(
xin
)
//
257
yout
=
(
xin
-
offset_x
_l
)
%
3
+
(
yin
-
offset_y
)
*
3
xout
=
(
xin
-
offset_x
_l
)
//
3
+
xin
//
257
out
[...,
yout
,
xout
]
=
data
[...,
yin
,
xin
]
#
Top ASICs (
mirrored on the horizontal axis
)
# mirrored on the horizontal axis
for
yin
in
range
(
257
,
512
-
offset_y
):
yout
=
2
-
(
xin
-
offset_x
)
%
3
+
(
yin
-
offset_y
)
*
3
+
6
xout
=
(
xin
-
offset_x
)
//
3
+
(
xin
)
//
257
yout
=
2
-
(
xin
-
offset_x
_l
)
%
3
+
(
yin
-
offset_y
)
*
3
+
6
xout
=
(
xin
-
offset_x
_l
)
//
3
+
xin
//
257
out
[...,
yout
,
xout
]
=
data
[...,
yin
,
xin
]
out
[:]
=
np
.
rot90
(
out
,
k
=
2
,
axes
=
(
-
2
,
-
1
))
return
out
...
...
@@ -91,12 +91,12 @@ def test_rows_A1256():
base_kernel_runner
.
kernel_dir
/
"
strixel_rows_A1256-lut_mask.npz
"
)
assert
tuple
(
lut_package
[
"
frame_shape
"
])
==
strixel_naive
.
shape
strixel_lut
=
np
.
zeros
_like
(
strixel_naive
)
strixel_lut
=
np
.
empty
_like
(
strixel_naive
)
utils
.
apply_partial_lut
(
data
=
pixel_data
,
lut
=
lut_package
[
"
lut
"
],
mask
=
lut_package
[
"
mask
"
],
out
=
strixel_lut
,
missing
=
0
,
missing
=
np
.
nan
,
)
assert
np
.
array_equal
(
strixel_naive
,
strixel_lut
)
assert
np
.
array_equal
(
strixel_naive
,
strixel_lut
,
equal_nan
=
True
)
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