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
0ba33d45
Commit
0ba33d45
authored
3 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Query for constants using all possible conditions, not just one
parent
84fe0e9f
No related branches found
No related tags found
1 merge request
!12
Snapshot: field test deployed version as of end of run 202201
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/calng/calcat_utils.py
+19
-19
19 additions, 19 deletions
src/calng/calcat_utils.py
with
19 additions
and
19 deletions
src/calng/calcat_utils.py
+
19
−
19
View file @
0ba33d45
...
@@ -22,6 +22,7 @@ from karabo.bound import (
...
@@ -22,6 +22,7 @@ from karabo.bound import (
SLOT_ELEMENT
,
SLOT_ELEMENT
,
STRING_ELEMENT
,
STRING_ELEMENT
,
UINT32_ELEMENT
,
UINT32_ELEMENT
,
VECTOR_UINT32_ELEMENT
,
)
)
from
karabo
import
version
as
karaboVersion
from
karabo
import
version
as
karaboVersion
from
pkg_resources
import
parse_version
from
pkg_resources
import
parse_version
...
@@ -73,16 +74,16 @@ def add_status_schema_from_enum(schema, prefix, enum_class):
...
@@ -73,16 +74,16 @@ def add_status_schema_from_enum(schema, prefix, enum_class):
.
initialValue
(
""
)
.
initialValue
(
""
)
.
commit
(),
.
commit
(),
STRING
_ELEMENT
(
schema
)
VECTOR_UINT32
_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.conditionId
"
)
.
key
(
f
"
{
constant_node
}
.conditionId
s
"
)
.
readOnly
()
.
readOnly
()
.
initialValue
(
""
)
.
initialValue
(
[]
)
.
commit
(),
.
commit
(),
STRING
_ELEMENT
(
schema
)
VECTOR_UINT32
_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.constantId
"
)
.
key
(
f
"
{
constant_node
}
.constantId
s
"
)
.
readOnly
()
.
readOnly
()
.
initialValue
(
""
)
.
initialValue
(
[]
)
.
commit
(),
.
commit
(),
STRING_ELEMENT
(
schema
)
STRING_ELEMENT
(
schema
)
...
@@ -402,7 +403,7 @@ class BaseCalcatFriend:
...
@@ -402,7 +403,7 @@ class BaseCalcatFriend:
return
resp
[
"
data
"
][
"
id
"
]
return
resp
[
"
data
"
][
"
id
"
]
@utils.threadsafe_cache
@utils.threadsafe_cache
def
condition_id
(
self
,
pdu
,
condition
):
def
condition_id
s
(
self
,
pdu
,
condition
):
# modifying condition parameter messes with cache
# modifying condition parameter messes with cache
condition_with_detector
=
copy
.
copy
(
condition
)
condition_with_detector
=
copy
.
copy
(
condition
)
condition_with_detector
[
"
Detector UUID
"
]
=
pdu
condition_with_detector
[
"
Detector UUID
"
]
=
pdu
...
@@ -415,18 +416,17 @@ class BaseCalcatFriend:
...
@@ -415,18 +416,17 @@ class BaseCalcatFriend:
ConditionNotFound
,
ConditionNotFound
,
f
"
Failed to find condition
{
condition
}
for pdu
{
pdu
}
"
,
f
"
Failed to find condition
{
condition
}
for pdu
{
pdu
}
"
,
)
)
return
resp
[
"
data
"
]
[
0
][
"
id
"
]
return
[
d
[
"
id
"
]
for
d
in
resp
[
"
data
"
]]
@utils.threadsafe_cache
def
constant_ids
(
self
,
calibration_id
,
condition_ids
):
def
constant_id
(
self
,
calibration_id
,
condition_id
):
resp
=
CalibrationConstant
.
get_all_by_conditions
(
resp
=
CalibrationConstant
.
get_by_uk
(
self
.
client
,
self
.
client
,
calibration_id
=
calibration_id
,
calibration_id
=
calibration_id
,
detector_type_id
=
self
.
detector_type_id
,
detector_type_id
=
self
.
detector_type_id
,
condition_id
=
condition_id
,
condition_id
s
=
condition_id
s
,
)
)
self
.
_check_resp
(
resp
,
warning
=
"
Failed to retrieve constant ID
"
)
self
.
_check_resp
(
resp
,
warning
=
"
Failed to retrieve constant ID
"
)
return
resp
[
"
data
"
]
[
"
id
"
]
return
[
d
[
"
id
"
]
for
d
in
resp
[
"
data
"
]]
def
get_constant_version
(
self
,
constant
):
def
get_constant_version
(
self
,
constant
):
# TODO: catch exceptions, give warnings appropriately
# TODO: catch exceptions, give warnings appropriately
...
@@ -447,19 +447,19 @@ class BaseCalcatFriend:
...
@@ -447,19 +447,19 @@ class BaseCalcatFriend:
self
.
_set_status
(
constant
,
"
calibrationId
"
,
calibration_id
)
self
.
_set_status
(
constant
,
"
calibrationId
"
,
calibration_id
)
condition
=
self
.
_constants_need_conditions
[
constant
]()
condition
=
self
.
_constants_need_conditions
[
constant
]()
condition_id
=
self
.
condition_id
(
condition_id
s
=
self
.
condition_id
s
(
self
.
_karabo_da_to_float_uuid
[
karabo_da
],
condition
self
.
_karabo_da_to_float_uuid
[
karabo_da
],
condition
)
)
self
.
_set_status
(
constant
,
"
conditionId
"
,
condition_id
)
self
.
_set_status
(
constant
,
"
conditionId
s
"
,
condition_id
s
)
constant_id
=
self
.
constant_id
(
constant_id
s
=
self
.
constant_id
s
(
calibration_id
=
calibration_id
,
condition_id
=
condition_id
calibration_id
=
calibration_id
,
condition_id
s
=
condition_id
s
)
)
self
.
_set_status
(
constant
,
"
constantId
"
,
constant_id
)
self
.
_set_status
(
constant
,
"
constantId
s
"
,
constant_id
s
)
resp
=
CalibrationConstantVersion
.
get_closest_by_time
(
resp
=
CalibrationConstantVersion
.
get_closest_by_time
(
self
.
client
,
self
.
client
,
calibration_constant_ids
=
[
constant_id
]
,
calibration_constant_ids
=
constant_id
s
,
physical_detector_unit_id
=
self
.
_karabo_da_to_id
[
karabo_da
],
physical_detector_unit_id
=
self
.
_karabo_da_to_id
[
karabo_da
],
event_at
=
self
.
_get_param
(
"
constantVersionEventAt
"
),
event_at
=
self
.
_get_param
(
"
constantVersionEventAt
"
),
snapshot_at
=
None
,
snapshot_at
=
None
,
...
...
This diff is collapsed.
Click to expand it.
David Hammer
@hammerd
mentioned in commit
3566342d
·
2 years ago
mentioned in commit
3566342d
mentioned in commit 3566342d031db1bb435b6430f100afdbaaa6c4bf
Toggle commit list
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