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
02a09112
Commit
02a09112
authored
6 months ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Use geometryState to indicate geometry state
parent
6a73ea3c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!120
DetectorAssembler: go to ERROR if trying to match without geometry
,
!118
Draft: MID: put arbiter on manager scene
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/calng/DetectorAssembler.py
+21
-20
21 additions, 20 deletions
src/calng/DetectorAssembler.py
with
21 additions
and
20 deletions
src/calng/DetectorAssembler.py
+
21
−
20
View file @
02a09112
...
...
@@ -20,7 +20,6 @@ from karabo.bound import (
ImageData
,
MetricPrefix
,
Schema
,
State
,
Timestamp
,
Trainstamp
,
Unit
,
...
...
@@ -150,6 +149,19 @@ class DetectorAssembler(TrainMatcher.TrainMatcher):
.
assignmentMandatory
()
.
commit
(),
STRING_ELEMENT
(
expected
)
.
key
(
"
geometryState
"
)
.
displayedName
(
"
Geometry state
"
)
.
description
(
"
The assembler needs a detector geometry to function. This is gotten
"
"
from a geometry device (see the geometryDevice parameter). If this
"
"
state is ERROR, no assembly will take place - check the geometry
"
"
device!
"
)
.
readOnly
()
.
initialValue
(
"
INIT
"
)
.
commit
(),
STRING_ELEMENT
(
expected
)
.
key
(
"
sourceIndexPattern
"
)
.
displayedName
(
"
Source index regex
"
)
...
...
@@ -209,16 +221,16 @@ class DetectorAssembler(TrainMatcher.TrainMatcher):
self
.
_geometry
=
None
def
_on_geometry
(
geometry
):
if
self
.
_geometry
is
None
:
# TODO: review with new warning system
if
hasattr
(
self
,
"
_state_before_geometry_missing_error
"
):
self
.
set
(
"
status
"
,
"
Received geometry!
"
)
self
.
updateState
(
self
.
_state_before_geometry_missing_error
)
del
self
.
_state_before_geometry_missing_error
self
.
set
(
"
geometryState
"
,
"
ACTIVE
"
)
self
.
_geometry
=
geometry
self
.
log
.
INFO
(
"
Received new geometry
"
)
geom_utils
.
subscribe_to_geometry_bound
(
self
,
self
.
get
(
"
geometryDevice
"
),
_on_geometry
,
warn_fun
=
self
.
log
.
WARN
self
,
self
.
get
(
"
geometryDevice
"
),
_on_geometry
)
print
(
"
done setting up thing
"
,
self
.
_geometry
)
if
self
.
_geometry
is
None
:
# initial get failed
self
.
set
(
"
geometryState
"
,
"
ERROR
"
)
self
.
assembled_output
=
self
.
signalSlotable
.
getOutputChannel
(
"
assembledOutput
"
)
self
.
start
()
...
...
@@ -362,6 +374,7 @@ class DetectorAssembler(TrainMatcher.TrainMatcher):
payload
[
"
data
"
]
=
scenes
.
detector_assembler_overview
(
device_id
=
self
.
getInstanceId
(),
schema
=
self
.
getFullSchema
(),
geometry_device_id
=
self
.
get
(
"
geometryDevice
"
),
)
self
.
reply
(
Hash
(
...
...
@@ -376,21 +389,9 @@ class DetectorAssembler(TrainMatcher.TrainMatcher):
def
on_matched_data
(
self
,
train_id
,
sources
):
ts_start
=
default_timer
()
state
=
self
.
get
(
"
state
"
)
if
self
.
_geometry
is
None
:
if
not
hasattr
(
self
,
"
_state_before_geometry_missing_error
"
):
self
.
log
.
WARN
(
"
Have not received a geometry yet, will not send anything
"
)
self
.
set
(
"
status
"
,
"
Missing geometry, cannot assemble;
"
f
"
check
{
self
.
get
(
'
geometryDevice
'
)
}
"
)
if
state
is
not
State
.
ERROR
:
self
.
updateState
(
State
.
ERROR
)
# set or update
self
.
_state_before_geometry_missing_error
=
state
# should have already set up warning
return
my_timestamp
=
Timestamp
(
Epochstamp
(),
Trainstamp
(
train_id
))
...
...
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