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
7143789a
Commit
7143789a
authored
1 year ago
by
Philipp Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
(fixup) minor formatting fixes
parent
f76b6497
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/constants.py
+13
-6
13 additions, 6 deletions
src/cal_tools/constants.py
with
13 additions
and
6 deletions
src/cal_tools/constants.py
+
13
−
6
View file @
7143789a
...
...
@@ -137,7 +137,7 @@ def inject_ccv(const_src, ccv_root, report_to):
unique_name
=
detector_type
[:
detector_type
.
index
(
'
-Type
'
)]
+
'
Def
'
cond_hash
=
md5
(
pdu_name
.
encode
())
cond_hash
.
update
(
pdu_uuid
.
to_bytes
(
length
=
8
,
byteorder
=
'
little
'
,
signed
=
False
))
3
length
=
8
,
byteorder
=
'
little
'
,
signed
=
False
))
for
param_dict
in
cond_params
:
cond_hash
.
update
(
str
(
param_dict
[
'
parameter_name
'
]).
encode
())
...
...
@@ -194,9 +194,12 @@ def inject_ccv(const_src, ccv_root, report_to):
copyfile
(
const_src
,
const_dest
)
def
inject_ccv_legacy
(
in_folder
,
metadata_folder
,
runs
,
calibration
,
cond
,
pdu
,
const_input
,
begin_at
):
def
inject_ccv_legacy
(
in_folder
,
metadata_folder
,
runs
,
calibration
,
cond
,
pdu
,
const_input
,
begin_at
):
"""
Inject new CCV into CalCat.
LEGACY VERSION - DO NOT USE
(from before most details were saved in CCV file itself)
metadata_folder
calibration -> in file, but pass anyway as there could be multiple
...
...
@@ -209,13 +212,15 @@ def inject_ccv_legacy(in_folder, metadata_folder, runs, calibration, cond, pdu,
metadata_folder, # Same as notebook parameter
[run_high, run_mid, run_low],
'
Offset
'
,
current_pdu, # Element of calibration_client.from get_all_phy_det_units_from_detector
current_pdu, # Element of calibration_client.from
# get_all_phy_det_units_from_detector
out_folder /
'
my-constant-file.h5
'
,
get_dir_creation_date(in_folder, run_high)
)
Args:
in_folder (str or Path): Root for input data, i.e. *not* containing r{run:04d} folder
in_folder (str or Path): Root for input data, i.e. *not*
containing r{run:04d} folder
metadata_folder (str or Path): Metadata location
runs (Iterable of str or int): Run number(s) used for characterization.
calibration (str): Calibration name, e.g.
'
Offset
'
, must exist in CalCat.
...
...
@@ -246,7 +251,8 @@ def inject_ccv_legacy(in_folder, metadata_folder, runs, calibration, cond, pdu,
# Generate condition name.
unique_name
=
detector_type
[:
detector_type
.
index
(
'
-Type
'
)]
+
'
Def
'
cond_hash
=
hashlib
.
md5
(
pdu_name
.
encode
())
cond_hash
.
update
(
pdu
[
'
uuid
'
].
to_bytes
(
length
=
8
,
byteorder
=
'
little
'
,
signed
=
False
))
cond_hash
.
update
(
pdu
[
'
uuid
'
].
to_bytes
(
length
=
8
,
byteorder
=
'
little
'
,
signed
=
False
))
for
key
,
value
in
cond_dict
.
items
():
cond_hash
.
update
(
str
(
key
).
encode
())
...
...
@@ -305,7 +311,8 @@ def inject_ccv_legacy(in_folder, metadata_folder, runs, calibration, cond, pdu,
}
}
resp
=
CalibrationClient
.
inject_new_calibration_constant_version
(
calibration_client
(),
inject_h
)
resp
=
CalibrationClient
.
inject_new_calibration_constant_version
(
calibration_client
(),
inject_h
)
if
not
resp
[
'
success
'
]:
raise
RuntimeError
(
resp
)
...
...
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