Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
pycalibration
Commits
624b8c9d
Commit
624b8c9d
authored
1 year ago
by
Egor Sobolev
Browse files
Options
Downloads
Patches
Plain Diff
Add total intensity computation, fix names
parent
9c79f65a
No related branches found
No related tags found
1 merge request
!986
[AGIPD] Feat: lit-pixel counter
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/litpx_counter.py
+12
-5
12 additions, 5 deletions
src/cal_tools/litpx_counter.py
with
12 additions
and
5 deletions
src/cal_tools/litpx_counter.py
+
12
−
5
View file @
624b8c9d
...
@@ -113,9 +113,12 @@ class LitPixelCounter(AnalysisAddon):
...
@@ -113,9 +113,12 @@ class LitPixelCounter(AnalysisAddon):
channel
=
"
litpx
"
channel
=
"
litpx
"
output_fields
=
[
output_fields
=
[
"
cellId
"
,
"
pulseId
"
,
"
trainId
"
,
"
litPixels
"
,
"
goodPixels
"
]
"
cellId
"
,
"
pulseId
"
,
"
trainId
"
,
"
litPixels
"
,
"
unmaskedPixels
"
,
"
totalIntensity
"
]
required_data
=
[
required_data
=
[
"
data
"
,
"
mask
"
,
"
cellId
"
,
"
pulseId
"
,
"
trainId
"
]
"
data
"
,
"
mask
"
,
"
cellId
"
,
"
pulseId
"
,
"
trainId
"
]
def
__init__
(
self
,
data
,
threshold
=
0.8
):
def
__init__
(
self
,
data
,
threshold
=
0.8
):
"""
Initialize the instance of lit-pixel analysis addon.
"""
Initialize the instance of lit-pixel analysis addon.
...
@@ -135,19 +138,23 @@ class LitPixelCounter(AnalysisAddon):
...
@@ -135,19 +138,23 @@ class LitPixelCounter(AnalysisAddon):
self
.
mask
=
data
[
"
mask
"
]
self
.
mask
=
data
[
"
mask
"
]
self
.
threshold
=
threshold
self
.
threshold
=
threshold
self
.
num_
goo
d_px
=
sharedmem
.
full
(
self
.
max_images
,
0
,
int
)
self
.
num_
unmaske
d_px
=
sharedmem
.
full
(
self
.
max_images
,
0
,
int
)
self
.
num_lit_px
=
sharedmem
.
full
(
self
.
max_images
,
0
,
int
)
self
.
num_lit_px
=
sharedmem
.
full
(
self
.
max_images
,
0
,
int
)
self
.
total_intensity
=
sharedmem
.
full
(
self
.
max_images
,
0
,
int
)
self
.
data
[
"
litPixels
"
]
=
self
.
num_lit_px
self
.
data
[
"
litPixels
"
]
=
self
.
num_lit_px
self
.
data
[
"
goodPixels
"
]
=
self
.
num_good_px
self
.
data
[
"
unmaskedPixels
"
]
=
self
.
num_unmasked_px
self
.
data
[
"
totalIntensity
"
]
=
self
.
total_intensity
def
process
(
self
,
chunk
):
def
process
(
self
,
chunk
):
ix
=
range
(
*
chunk
.
indices
(
self
.
num_images
))
ix
=
range
(
*
chunk
.
indices
(
self
.
num_images
))
for
i
in
ix
:
for
i
in
ix
:
mask
=
self
.
mask
[
i
]
==
0
mask
=
self
.
mask
[
i
]
==
0
self
.
total_intensity
[
i
]
=
np
.
sum
(
self
.
image
[
i
],
initial
=
0
,
where
=
mask
)
self
.
num_lit_px
[
i
]
=
np
.
sum
(
self
.
num_lit_px
[
i
]
=
np
.
sum
(
self
.
image
[
i
]
>
self
.
threshold
,
initial
=
0
,
where
=
mask
)
self
.
image
[
i
]
>
self
.
threshold
,
initial
=
0
,
where
=
mask
)
self
.
num_
goo
d_px
[
i
]
=
np
.
sum
(
mask
)
self
.
num_
unmaske
d_px
[
i
]
=
np
.
sum
(
mask
)
def
source_name
(
self
,
karabo_id
,
channel
):
def
source_name
(
self
,
karabo_id
,
channel
):
return
f
"
{
karabo_id
}
/LITPX/
{
channel
}
"
return
f
"
{
karabo_id
}
/LITPX/
{
channel
}
"
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