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
41f0d28a
Commit
41f0d28a
authored
3 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Improve CalCat / debugging parts of schema
parent
6ff23bde
No related branches found
No related tags found
1 merge request
!12
Snapshot: field test deployed version as of end of run 202201
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/calng/base_calcat.py
+91
-5
91 additions, 5 deletions
src/calng/base_calcat.py
src/calng/scenes.py
+32
-25
32 additions, 25 deletions
src/calng/scenes.py
with
123 additions
and
30 deletions
src/calng/base_calcat.py
+
91
−
5
View file @
41f0d28a
...
@@ -56,41 +56,96 @@ def add_status_schema_from_enum(schema, prefix, enum_class):
...
@@ -56,41 +56,96 @@ def add_status_schema_from_enum(schema, prefix, enum_class):
BOOL_ELEMENT
(
schema
)
BOOL_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.found
"
)
.
key
(
f
"
{
constant_node
}
.found
"
)
.
displayedName
(
"
Found and loaded
"
)
.
readOnly
()
.
readOnly
()
.
initialValue
(
False
)
.
initialValue
(
False
)
.
commit
(),
.
commit
(),
STRING_ELEMENT
(
schema
)
STRING_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.validFrom
"
)
.
key
(
f
"
{
constant_node
}
.beginValidityAt
"
)
.
displayedName
(
"
Constant timestamp
"
)
.
description
(
"
This field displays the field
'
begin_validity_at
'
from CalCat of the
"
"
most recently found + loaded constant. This field is tied to when the
"
"
constant was created and is useful to notice if some constants are
"
"
out of date.
"
)
.
readOnly
()
.
readOnly
()
.
initialValue
(
""
)
.
initialValue
(
""
)
.
commit
(),
.
commit
(),
STRING_ELEMENT
(
schema
)
STRING_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.calibrationId
"
)
.
key
(
f
"
{
constant_node
}
.calibrationId
"
)
.
displayedName
(
"
[CalCat] Calibration ID
"
)
.
description
(
"
In CalCat, each constant type is associated with a calibration ID
"
"
(for example,
'
Offset
'
has ID 1). If calibration ID is not found,
"
"
something is quite wrong: missing in CalCat or issue with correction
"
"
device.
"
)
.
readOnly
()
.
readOnly
()
.
initialValue
(
""
)
.
initialValue
(
""
)
.
commit
(),
.
commit
(),
VECTOR_UINT32_ELEMENT
(
schema
)
VECTOR_UINT32_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.conditionIds
"
)
.
key
(
f
"
{
constant_node
}
.conditionIds
"
)
.
displayedName
(
"
[CalCat] Condition IDs found
"
)
.
description
(
"
In CalCat, constants are found based on Physical Detector Unit and
"
"
the operating condition of the detector. A condition ID represents a
"
"
match on these. As operating conditions can overlap, a query may
"
"
involve multiple valid condition IDs; the retrieval strategy later
"
"
(
'
closest in time
'
) will determine which candidate constant is loaded.
"
)
.
readOnly
()
.
readOnly
()
.
initialValue
([])
.
initialValue
([])
.
commit
(),
.
commit
(),
STRING_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.usedConditionId
"
)
.
displayedName
(
"
[CalCat] Condition ID used
"
)
.
description
(
"
Of the condition IDs found, this one applies to the constant that was
"
"
retrieved in the end.
"
)
.
readOnly
()
.
initialValue
(
""
)
.
commit
(),
VECTOR_UINT32_ELEMENT
(
schema
)
VECTOR_UINT32_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.constantIds
"
)
.
key
(
f
"
{
constant_node
}
.constantIds
"
)
.
displayedName
(
"
[CalCat] Constant IDs found
"
)
.
description
(
"
In CalCat, a
'
constant
'
represents matching
'
calibration ID
'
,
"
"'
detector type ID
'
, and
'
condition ID
'
. Similar to condition IDs, a
"
"
query may yield multiple candidate constant IDs.
"
)
.
readOnly
()
.
readOnly
()
.
initialValue
([])
.
initialValue
([])
.
commit
(),
.
commit
(),
STRING_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.usedConstantId
"
)
.
displayedName
(
"
[CalCat] Constant ID used
"
)
.
description
(
"
Of the candidate constant IDs, this one applies to the constant which
"
"
was retrieved in the end.
"
)
.
readOnly
()
.
initialValue
(
""
)
.
commit
(),
STRING_ELEMENT
(
schema
)
STRING_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.constantVersionId
"
)
.
key
(
f
"
{
constant_node
}
.constantVersionId
"
)
.
displayedName
(
"
[CalCat] Constant version ID
"
)
.
description
(
.
description
(
"
Finally, a constant version represents a concrete constant that can
"
"
be loaded (see descriptions of preceding fields for details on other
"
"
steps).
"
"
This field is editable - if for any reason a specific constant
"
"
This field is editable - if for any reason a specific constant
"
"
version is desired, the constant version ID (as used in CalCat) can
"
"
version is desired, the constant version ID (as used in CalCat) can
"
"
be set here and the slot below can be called to load this particular
"
"
be set here and the slot below can be called to load this particular
"
"
version
, overriding the automatic loading of latest constant
s.
"
"
version
. Only relevant in very unusual situation
s.
"
)
)
.
assignmentOptional
()
.
assignmentOptional
()
.
defaultValue
(
""
)
.
defaultValue
(
""
)
...
@@ -100,6 +155,27 @@ def add_status_schema_from_enum(schema, prefix, enum_class):
...
@@ -100,6 +155,27 @@ def add_status_schema_from_enum(schema, prefix, enum_class):
SLOT_ELEMENT
(
schema
)
SLOT_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.overrideConstantVersion
"
)
.
key
(
f
"
{
constant_node
}
.overrideConstantVersion
"
)
.
displayedName
(
"
Override constant version
"
)
.
displayedName
(
"
Override constant version
"
)
.
description
(
"
See description of constant version id.
"
)
.
commit
(),
STRING_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.dataFilePath
"
)
.
displayedName
(
"
[Debug] Data file path
"
)
.
description
(
"
Where is the actual file for the currently loaded constant located?
"
)
.
readOnly
()
.
initialValue
(
""
)
.
commit
(),
STRING_ELEMENT
(
schema
)
.
key
(
f
"
{
constant_node
}
.dataSetName
"
)
.
displayedName
(
"
[Debug] Data set name
"
)
.
description
(
"
Within the actual data file, where is the constant data located?
"
)
.
readOnly
()
.
initialValue
(
""
)
.
commit
(),
.
commit
(),
)
)
...
@@ -457,12 +533,22 @@ class BaseCalcatFriend:
...
@@ -457,12 +533,22 @@ class BaseCalcatFriend:
self
.
_check_resp
(
resp
,
warning
=
"
Failed to find calibration constant version
"
)
self
.
_check_resp
(
resp
,
warning
=
"
Failed to find calibration constant version
"
)
# TODO: replace with start date and end date
# TODO: replace with start date and end date
timestamp
=
resp
[
"
data
"
][
"
begin_validity_at
"
]
timestamp
=
resp
[
"
data
"
][
"
begin_validity_at
"
]
self
.
_set_status
(
constant
,
"
validFrom
"
,
timestamp
)
self
.
_set_status
(
constant
,
"
beginValidityAt
"
,
timestamp
)
self
.
_set_status
(
constant
,
"
constantVersionId
"
,
resp
[
"
data
"
][
"
id
"
])
self
.
_set_status
(
constant
,
"
constantVersionId
"
,
resp
[
"
data
"
][
"
id
"
])
self
.
_set_status
(
constant
,
"
usedConditionId
"
,
resp
[
"
data
"
][
"
calibration_constant
"
][
"
condition_id
"
],
)
self
.
_set_status
(
constant
,
"
usedConstantId
"
,
resp
[
"
data
"
][
"
calibration_constant
"
][
"
id
"
]
)
file_path
=
(
file_path
=
(
self
.
caldb_store
/
resp
[
"
data
"
][
"
path_to_file
"
]
/
resp
[
"
data
"
][
"
file_name
"
]
self
.
caldb_store
/
resp
[
"
data
"
][
"
path_to_file
"
]
/
resp
[
"
data
"
][
"
file_name
"
]
)
)
self
.
_set_status
(
constant
,
"
dataFilePath
"
,
str
(
file_path
))
self
.
_set_status
(
constant
,
"
dataSetName
"
,
resp
[
"
data
"
][
"
data_set_name
"
])
# TODO: handle FileNotFoundError if we are led astray
# TODO: handle FileNotFoundError if we are led astray
with
h5py
.
File
(
file_path
,
"
r
"
)
as
fd
:
with
h5py
.
File
(
file_path
,
"
r
"
)
as
fd
:
constant_data
=
np
.
array
(
fd
[
resp
[
"
data
"
][
"
data_set_name
"
]][
"
data
"
])
constant_data
=
np
.
array
(
fd
[
resp
[
"
data
"
][
"
data_set_name
"
]][
"
data
"
])
...
@@ -489,7 +575,7 @@ class BaseCalcatFriend:
...
@@ -489,7 +575,7 @@ class BaseCalcatFriend:
constant_data
=
np
.
array
(
fd
[
resp
[
"
data
"
][
"
data_set_name
"
]][
"
data
"
])
constant_data
=
np
.
array
(
fd
[
resp
[
"
data
"
][
"
data_set_name
"
]][
"
data
"
])
with
self
.
cached_constants_lock
:
with
self
.
cached_constants_lock
:
self
.
cached_constants
[
constant
]
=
constant_data
self
.
cached_constants
[
constant
]
=
constant_data
self
.
_set_status
(
constant
,
"
validFrom
"
,
resp
[
"
data
"
][
"
begin_at
"
])
self
.
_set_status
(
constant
,
"
beginValidityAt
"
,
resp
[
"
data
"
][
"
begin_at
"
])
self
.
_set_status
(
constant
,
"
calibrationId
"
,
"
manual override
"
)
self
.
_set_status
(
constant
,
"
calibrationId
"
,
"
manual override
"
)
self
.
_set_status
(
constant
,
"
conditionId
"
,
"
manual override
"
)
self
.
_set_status
(
constant
,
"
conditionId
"
,
"
manual override
"
)
self
.
_set_status
(
constant
,
"
constantId
"
,
"
manual override
"
)
self
.
_set_status
(
constant
,
"
constantId
"
,
"
manual override
"
)
...
@@ -526,7 +612,7 @@ class BaseCalcatFriend:
...
@@ -526,7 +612,7 @@ class BaseCalcatFriend:
def
flush_constants
(
self
):
def
flush_constants
(
self
):
for
constant
in
self
.
_constant_enum_class
:
for
constant
in
self
.
_constant_enum_class
:
self
.
_set_status
(
constant
,
"
validFrom
"
,
""
)
self
.
_set_status
(
constant
,
"
beginValidityAt
"
,
""
)
self
.
_set_status
(
constant
,
"
found
"
,
False
)
self
.
_set_status
(
constant
,
"
found
"
,
False
)
def
_check_resp
(
self
,
resp
,
exception
=
Exception
,
warning
=
None
):
def
_check_resp
(
self
,
resp
,
exception
=
Exception
,
warning
=
None
):
...
...
This diff is collapsed.
Click to expand it.
src/calng/scenes.py
+
32
−
25
View file @
41f0d28a
...
@@ -297,31 +297,38 @@ class MaybeEditableRow(HorizontalLayout):
...
@@ -297,31 +297,38 @@ class MaybeEditableRow(HorizontalLayout):
@titled
(
"
Found constants
"
,
width
=
6
*
NARROW_INC
)
@titled
(
"
Found constants
"
,
width
=
6
*
NARROW_INC
)
@boxed
@boxed
class
FoundConstantsColumn
(
VerticalLayout
):
class
FoundConstantsColumn
(
VerticalLayout
):
def
__init__
(
self
,
device_id
,
schema_hash
,
prefix
=
"
foundConstants
"
):
def
__init__
(
self
,
device_id
,
schema_hash
,
prefix
=
"
foundConstants
"
,
):
super
().
__init__
(
padding
=
0
)
super
().
__init__
(
padding
=
0
)
self
.
children
.
extend
(
for
constant_name
in
schema_hash
.
get
(
prefix
).
getKeys
():
[
constant_row
=
HorizontalLayout
(
HorizontalLayout
(
LabelModel
(
LabelModel
(
text
=
constant_name
,
text
=
constant_name
,
width
=
6
*
NARROW_INC
,
width
=
6
*
NARROW_INC
,
height
=
NARROW_INC
,
height
=
NARROW_INC
,
),
),
ColorBoolModel
(
ColorBoolModel
(
width
=
NARROW_INC
,
width
=
NARROW_INC
,
height
=
NARROW_INC
,
height
=
NARROW_INC
,
keys
=
[
f
"
{
device_id
}
.
{
prefix
}
.
{
constant_name
}
.found
"
],
keys
=
[
f
"
{
device_id
}
.
{
prefix
}
.
{
constant_name
}
.found
"
],
),
),
DisplayLabelModel
(
DisplayLabelModel
(
keys
=
[
f
"
{
device_id
}
.
{
prefix
}
.
{
constant_name
}
.beginValidityAt
"
],
keys
=
[
f
"
{
device_id
}
.
{
prefix
}
.
{
constant_name
}
.validFrom
"
],
width
=
8
*
BASE_INC
,
width
=
8
*
BASE_INC
,
height
=
BASE_INC
,
height
=
BASE_INC
,
),
),
DisplayLabelModel
(
padding
=
0
,
keys
=
[
f
"
{
device_id
}
.
{
prefix
}
.
{
constant_name
}
.constantVersionId
"
],
)
width
=
3
*
BASE_INC
,
for
constant_name
in
schema_hash
.
get
(
prefix
).
getKeys
()
height
=
BASE_INC
,
]
),
)
padding
=
0
,
)
self
.
children
.
append
(
constant_row
)
class
ConstantLoadedAmpeln
(
HorizontalLayout
):
class
ConstantLoadedAmpeln
(
HorizontalLayout
):
...
@@ -780,7 +787,7 @@ def correction_constant_dashboard(
...
@@ -780,7 +787,7 @@ def correction_constant_dashboard(
),
),
*
(
*
(
DisplayLabelModel
(
DisplayLabelModel
(
keys
=
[
f
"
{
device_id
}
.
{
prefix
}
.
{
constant
}
.
validFrom
"
],
keys
=
[
f
"
{
device_id
}
.
{
prefix
}
.
{
constant
}
.
beginValidityAt
"
],
width
=
7
*
BASE_INC
,
width
=
7
*
BASE_INC
,
height
=
BASE_INC
,
height
=
BASE_INC
,
font_size
=
9
,
font_size
=
9
,
...
...
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