Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
ToolBox
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
SCS
ToolBox
Commits
e8c6a69b
"README.md" did not exist on "6a7d1c774d08c00c39e552e0f8a7bca4e3db2c17"
Commit
e8c6a69b
authored
1 year ago
by
Laurent Mercadier
Browse files
Options
Downloads
Patches
Plain Diff
rename mnemonics to fields
parent
184bee16
No related branches found
No related tags found
1 merge request
!263
Adds warning if data rate < 95% in load()
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/toolbox_scs/load.py
+14
-14
14 additions, 14 deletions
src/toolbox_scs/load.py
with
14 additions
and
14 deletions
src/toolbox_scs/load.py
+
14
−
14
View file @
e8c6a69b
...
@@ -498,7 +498,7 @@ def concatenateRuns(runs):
...
@@ -498,7 +498,7 @@ def concatenateRuns(runs):
return
result
return
result
def
check_data_rate
(
run
,
mnemonic
s
=
None
):
def
check_data_rate
(
run
,
field
s
=
None
):
"""
"""
Calculates the fraction of train ids that contain data in a run.
Calculates the fraction of train ids that contain data in a run.
...
@@ -506,7 +506,7 @@ def check_data_rate(run, mnemonics=None):
...
@@ -506,7 +506,7 @@ def check_data_rate(run, mnemonics=None):
----------
----------
run: extra_data DataCollection
run: extra_data DataCollection
the DataCollection associated to the data.
the DataCollection associated to the data.
mnemonic
s: str, list of str or dict
field
s: str, list of str or dict
mnemonics to check. If None, all mnemonics in the run are checked.
mnemonics to check. If None, all mnemonics in the run are checked.
A custom mnemonic can be defined with a dictionnary: {
'
extra
'
:
A custom mnemonic can be defined with a dictionnary: {
'
extra
'
:
{
'
source
'
:
'
SCS_CDIFFT_MAG/SUPPLY/CURRENT
'
,
'
key
'
:
{
'
source
'
:
'
SCS_CDIFFT_MAG/SUPPLY/CURRENT
'
,
'
key
'
:
...
@@ -518,20 +518,20 @@ def check_data_rate(run, mnemonics=None):
...
@@ -518,20 +518,20 @@ def check_data_rate(run, mnemonics=None):
that contain data as values.
that contain data as values.
"""
"""
run_mnemonics
=
mnemonics_for_run
(
run
)
run_mnemonics
=
mnemonics_for_run
(
run
)
if
mnemonic
s
is
None
:
if
field
s
is
None
:
mnemonic
s
=
run_mnemonics
field
s
=
run_mnemonics
mnemonics
=
[
mnemonic
s
]
if
isinstance
(
mnemonic
s
,
str
)
else
mnemonic
s
fields
=
[
field
s
]
if
isinstance
(
field
s
,
str
)
else
field
s
ret
=
{}
ret
=
{}
for
m
in
mnemonic
s
:
for
f
in
field
s
:
if
isinstance
(
m
,
dict
):
if
isinstance
(
f
,
dict
):
name
=
list
(
m
.
keys
())[
0
]
name
=
list
(
f
.
keys
())[
0
]
val
=
m
[
name
]
val
=
f
[
name
]
m
=
name
f
=
name
elif
m
not
in
run_mnemonics
:
elif
f
not
in
run_mnemonics
:
log
.
warning
(
f
'
mnemonic
{
m
}
not found. Skipping!
'
)
log
.
warning
(
f
'
mnemonic
{
f
}
not found. Skipping!
'
)
continue
continue
else
:
else
:
val
=
run_mnemonics
[
m
]
val
=
run_mnemonics
[
f
]
counts
=
run
[
val
[
'
source
'
]][
val
[
'
key
'
]].
data_counts
(
False
)
counts
=
run
[
val
[
'
source
'
]][
val
[
'
key
'
]].
data_counts
(
False
)
npulses
=
counts
.
max
()
npulses
=
counts
.
max
()
if
npulses
==
0
:
# (only missing data)
if
npulses
==
0
:
# (only missing data)
...
@@ -539,5 +539,5 @@ def check_data_rate(run, mnemonics=None):
...
@@ -539,5 +539,5 @@ def check_data_rate(run, mnemonics=None):
else
:
else
:
counts
=
counts
/
npulses
# to only count trains and not pulses
counts
=
counts
/
npulses
# to only count trains and not pulses
rate
=
counts
.
sum
()
/
len
(
run
.
train_ids
)
rate
=
counts
.
sum
()
/
len
(
run
.
train_ids
)
ret
[
m
]
=
rate
ret
[
f
]
=
rate
return
ret
return
ret
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