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
142ca1a7
Commit
142ca1a7
authored
4 years ago
by
Andrey Samartsev
Browse files
Options
Downloads
Patches
Plain Diff
fix for old format tested
parent
3d096a1c
No related branches found
No related tags found
1 merge request
!432
Fix/da qoldformat corr
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cal_tools/cal_tools/dssclib.py
+32
-18
32 additions, 18 deletions
cal_tools/cal_tools/dssclib.py
with
32 additions
and
18 deletions
cal_tools/cal_tools/dssclib.py
+
32
−
18
View file @
142ca1a7
...
...
@@ -71,19 +71,28 @@ def get_dssc_ctrl_data(in_folder, slow_data_pattern,
if
len
(
ctrlDataFiles
)
==
0
:
print
(
"
No Control Slow Data found!
"
)
return
targetGainAll
,
encodedGainAll
,
operatingFreqAll
print
(
ctrlDataFiles
)
daq_format
=
''
ctrlloc
=
None
ctlrh5file
=
h5py
.
File
(
next
(
iter
(
ctrlDataFiles
.
values
())),
'
r
'
)
filename
=
next
(
iter
(
ctrlDataFiles
.
values
()))
print
(
"
filename:
"
,
filename
)
ctlrh5file
=
h5py
.
File
(
filename
,
'
r
'
)
if
'
/METADATA/dataSources/deviceId
'
in
ctlrh5file
:
ctrlloc
=
ctlrh5file
[
'
/METADATA/dataSources/deviceId
'
][
0
]
daq_format
=
ctlrh5file
[
'
/METADATA/dataFormatVersion
'
][
0
].
decode
(
"
utf-8
"
)
elif
'
/METADATA/deviceId
'
in
ctlrh5file
:
ctrlloc
=
ctlrh5file
[
'
/METADATA/deviceId
'
][
0
]
else
:
print
(
"
Control Slow Data not correct
!
"
)
print
(
"
No Slow Control Data found in files
!
"
)
return
targetGainAll
,
encodedGainAll
,
operatingFreqAll
ctrlloc
=
ctrlloc
.
decode
(
"
utf-8
"
)
ctrlloc
=
ctrlloc
[:
ctrlloc
.
find
(
'
/
'
)]
print
(
"
ctrlloc:
"
,
ctrlloc
)
tGain
=
{}
encodedGain
=
{}
...
...
@@ -91,30 +100,35 @@ def get_dssc_ctrl_data(in_folder, slow_data_pattern,
for
quadrant
,
file
in
ctrlDataFiles
.
items
():
if
len
(
file
):
h5file
=
h5py
.
File
(
file
)
if
not
f
'
/RUN/
{
ctrlloc
}
/FPGA/PPT_Q
{
quadrant
}
/epcRegisterFilePath/value
'
in
h5file
:
print
(
f
"
Slow control data file
{
file
}
is not usable
"
)
continue
epcConfig
=
h5file
[
f
'
/RUN/
{
ctrlloc
}
/FPGA/PPT_Q
{
quadrant
}
/epcRegisterFilePath/value
'
][
0
]
\
.
decode
(
"
utf-8
"
)
epcConfig
=
epcConfig
[
epcConfig
.
rfind
(
'
/
'
)
+
1
:]
print
(
f
"
EPC configuration:
{
epcConfig
}
"
)
targGain
=
_extr_gainparam_conffilename
(
epcConfig
)
tGain
[
quadrant
]
=
float
(
targGain
)
if
targGain
is
not
None
else
0.0
# 0.0 is default value for TG
if
daq_format
!=
''
:
epcConfig
=
h5file
[
f
'
/RUN/
{
ctrlloc
}
/FPGA/PPT_Q
{
quadrant
}
/epcRegisterFilePath/value
'
][
0
]
\
.
decode
(
"
utf-8
"
)
epcConfig
=
epcConfig
[
epcConfig
.
rfind
(
'
/
'
)
+
1
:]
print
(
f
"
EPC configuration:
{
epcConfig
}
"
)
targGain
=
_extr_gainparam_conffilename
(
epcConfig
)
tGain
[
quadrant
]
=
float
(
targGain
)
if
targGain
is
not
None
else
0.0
# 0.0 is default value for TG
else
:
tGain
[
quadrant
]
=
0.0
gainSettingsMap
=
{}
for
coarseParam
in
[
'
fcfEnCap
'
,
'
csaFbCap
'
,
'
csaResistor
'
]:
gainSettingsMap
[
coarseParam
]
=
int
(
h5file
[
f
'
/RUN/
{
ctrlloc
}
/FPGA/PPT_Q
{
quadrant
}
/gain/
{
coarseParam
}
/value
'
][
0
])
irampSettings
=
h5file
[
f
'
/RUN/
{
ctrlloc
}
/FPGA/PPT_Q
{
quadrant
}
/gain/irampFineTrm/value
'
][
0
]
\
.
decode
(
"
utf-8
"
)
iramp_path
=
f
'
/RUN/
{
ctrlloc
}
/FPGA/PPT_Q
{
quadrant
}
/gain/irampFineTrm/value
'
if
daq_format
!=
''
:
irampSettings
=
h5file
[
iramp_path
][
0
].
decode
(
"
utf-8
"
)
elif
iramp_path
in
h5file
:
irampSettings
=
h5file
[
iramp_path
][
0
]
else
:
irampSettings
=
"
Various
"
gainSettingsMap
[
'
trimmed
'
]
=
np
.
int64
(
1
)
if
irampSettings
==
"
Various
"
else
np
.
int64
(
0
)
print
(
'
trimmed:
'
,
gainSettingsMap
[
'
trimmed
'
])
encodedGain
[
quadrant
]
=
_get_gain_encoded_val
(
gainSettingsMap
)
...
...
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