Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pes_to_spec
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Machine Learning projects.
pes_to_spec
Commits
4d02725c
Commit
4d02725c
authored
1 year ago
by
Danilo Ferreira de Lima
Browse files
Options
Downloads
Patches
Plain Diff
Fixes several points found by Cammille.
parent
cc84e420
No related branches found
No related tags found
1 merge request
!26
Added example for SCS.
Pipeline
#132020
passed
1 year ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pes_to_spec/config.py
+12
-12
12 additions, 12 deletions
pes_to_spec/config.py
with
12 additions
and
12 deletions
pes_to_spec/config.py
+
12
−
12
View file @
4d02725c
...
...
@@ -43,7 +43,7 @@ class VSConfig(object):
"""
Receives an extra-data run and outputs the configuration.
"""
out
=
VSConfig
()
out
=
cls
()
if
isinstance
(
runNumbers
,
int
):
runNumbers
=
[
runNumbers
]
assert
isinstance
(
runNumbers
,
list
),
"
The run numbers must be a list or an integer.
"
...
...
@@ -58,21 +58,21 @@ class VSConfig(object):
else
:
run
=
run
[
0
].
union
(
*
run
[
1
:])
# get details on the run configuration
if
VSConfig
.
pressure_source
in
run
.
all_sources
:
pressure
=
run
[
VSConfig
.
pressure_source
,
"
value
"
].
ndarray
()
if
cls
.
pressure_source
in
run
.
all_sources
:
pressure
=
run
[
cls
.
pressure_source
,
"
value
"
].
ndarray
()
out
.
pressure
=
float
(
np
.
mean
(
pressure
))
out
.
pressure_tol
=
float
(
np
.
std
(
pressure
))
else
:
raise
ValueError
(
f
"
The input data does not contain the pressure source
'
{
pressure_source
}
'
.
"
)
if
VSConfig
.
voltage_source
in
run
.
all_sources
:
for
key
in
run
[
VSConfig
.
voltage_source
].
keys
():
if
cls
.
voltage_source
in
run
.
all_sources
:
for
key
in
run
[
cls
.
voltage_source
].
keys
():
m
=
re
.
match
(
"
^(u[0-9]+).value$
"
,
key
)
if
m
is
not
None
and
len
(
m
.
groups
())
>=
1
:
name
=
m
.
groups
()[
0
]
out
.
voltage
[
name
]
=
run
[
VSConfig
.
voltage_source
,
f
"
{
name
}
.value
"
].
ndarray
().
mean
()
out
.
voltage_tol
[
name
]
=
run
[
VSConfig
.
voltage_source
,
f
"
{
name
}
.value
"
].
ndarray
().
std
()
out
.
voltage
[
name
]
=
run
[
cls
.
voltage_source
,
f
"
{
name
}
.value
"
].
ndarray
().
mean
()
out
.
voltage_tol
[
name
]
=
run
[
cls
.
voltage_source
,
f
"
{
name
}
.value
"
].
ndarray
().
std
()
for
gas
in
VSConfig
.
gas_sources
:
for
gas
in
cls
.
gas_sources
:
# check if this gas source is interlocked
if
gas
in
run
.
all_sources
and
run
[
gas
,
"
interlock.AActionState.value
"
].
ndarray
().
sum
()
==
0
:
# it is not, so this gas was used
...
...
@@ -105,7 +105,7 @@ class VSConfig(object):
for
k
,
v
in
self
.
voltage
.
items
()}
diff
.
pressure
=
self
.
pressure
-
other
.
pressure
diff
.
voltage_tol
=
{
k
:
np
.
sqrt
(
v
**
2
+
other
.
voltage_tol
[
k
]
**
2
)
for
k
in
self
.
voltage_tol
.
items
()}
for
k
,
v
in
self
.
voltage_tol
.
items
()}
diff
.
pressure_tol
=
np
.
sqrt
(
self
.
pressure_tol
**
2
+
other
.
pressure_tol
**
2
)
diff
.
gas
=
set
(
self
.
gas
).
difference
(
set
(
other
.
gas
))
return
diff
...
...
@@ -114,7 +114,7 @@ class VSConfig(object):
"""
Check if two configurations match.
"""
if
not
isinstance
(
other
,
VSConfig
):
if
not
isinstance
(
other
,
self
.
__class__
):
raise
ValueError
(
"
I can only check equality with another VSConfig object.
"
)
diff
=
self
-
other
for
v
in
diff
.
voltage
.
values
():
...
...
@@ -161,13 +161,13 @@ class VSConfig(object):
"""
Build from dictionary.
"""
out
=
VSConfig
()
out
=
cls
()
out
.
gas
=
{
data
[
'
gas
'
]}
out
.
pressure
=
data
[
'
pressure
'
]
out
.
voltage
=
{
k
:
v
for
k
,
v
in
data
.
items
()
if
k
not
in
(
'
gas
'
,
'
pressure
'
)}
if
tolerance
is
None
:
tolerance
=
{
k
:
0.0
for
k
,
v
in
data
.
item
s
()
if
k
!=
'
gas
'
}
tolerance
=
{
k
:
0.0
for
k
in
data
.
key
s
()
if
k
!=
'
gas
'
}
out
.
pressure_tol
=
tolerance
[
'
pressure
'
]
out
.
voltage_tol
=
{
k
:
v
for
k
,
v
in
tolerance
.
items
()
if
k
not
in
(
'
gas
'
,
'
pressure
'
)}
...
...
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