Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyDARM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
LIGO Calibration
pyDARM
Commits
9e038029
Commit
9e038029
authored
2 years ago
by
Evan Goetz
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-epics-push' into 'master'
EPICS records push fix Closes
#124
See merge request
!142
parents
7ab650e5
2cf980fc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!142
EPICS records push fix
Pipeline
#462401
passed
2 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
conda/environment.yaml
+1
-1
1 addition, 1 deletion
conda/environment.yaml
pydarm/darm.py
+28
-20
28 additions, 20 deletions
pydarm/darm.py
setup.cfg
+1
-1
1 addition, 1 deletion
setup.cfg
with
30 additions
and
22 deletions
conda/environment.yaml
+
1
−
1
View file @
9e038029
...
...
@@ -16,4 +16,4 @@ dependencies:
-
python-nds2-client
-
declarative
-
dttxml
-
ezca
-
pyepics
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pydarm/darm.py
+
28
−
20
View file @
9e038029
...
...
@@ -17,7 +17,7 @@
import
numpy
as
np
from
scipy
import
signal
from
gwpy.time
import
tconvert
,
from_gps
import
time
from
epics
import
caget
,
caput
from
.model
import
Model
from
.sensing
import
SensingModel
...
...
@@ -395,7 +395,8 @@ class DARMModel(Model):
Parameters
----------
IFO : str
'
LHO
'
or
'
LLO
'
'
H1
'
,
'
L1
'
, or similar. This will be prepended to all channel names
as per CDS convention.
epics_output : `float`, dict
the output from compute_epics_records
filename : str
...
...
@@ -405,40 +406,47 @@ class DARMModel(Model):
"""
with
open
(
filename
,
'
w
'
)
as
f
:
for
chan
in
sorted
(
epics_output
.
keys
()):
chan_val
=
epics_output
[
chan
]
for
chname
in
sorted
(
epics_output
.
keys
()):
chan_val
=
epics_output
[
chname
]
# if value is complex then split operation into its
# corresponding channels ending in "_REAL" and
# "_IMAG"
if
np
.
iscomplex
(
chan_val
):
chan
=
[
f
"
{
IFO
}
:
{
ch
a
n
}
_REAL
"
,
f
"
{
IFO
}
:
{
ch
a
n
}
_IMAG
"
]
chan
=
[
f
"
{
IFO
}
:
{
chn
ame
}
_REAL
"
,
f
"
{
IFO
}
:
{
chn
ame
}
_IMAG
"
]
chan_val
=
[
np
.
real
(
chan_val
),
np
.
imag
(
chan_val
)]
else
:
chan
=
[
chan
]
chan
=
[
f
"
{
IFO
}
:
{
chname
}
"
]
chan_val
=
[
chan_val
]
for
idx
,
ch
in
enumerate
(
chan
):
f
.
write
(
f
"
{
ch
}
{
chan_val
[
idx
]
:
0.16
e
}
\n
"
)
if
push_to_epics
:
from
ezca
import
ezca
ezca
=
ezca
.
Ezca
()
ezca
[
ch
]
=
'
{:0.16e}
'
.
format
(
chan_val
[
idx
])
f
.
close
()
# using caput_many() would probably be better here
caput
(
ch
,
f
'
{
chan_val
[
idx
]
:
0.16
e
}
'
,
wait
=
True
,
timeout
=
1
)
# Ensure there is a moment for the EPICS records to get written
time
.
sleep
(
1
)
# check if values written to EPICS channels were transferred properly
# Note: This assumes there is no race condition to write to any of the
# relevant channels.
if
push_to_epics
:
with
open
(
filename
,
'
r
'
)
as
f
:
for
chan
in
sorted
(
epics_output
.
keys
()):
chan_val
=
epics_output
[
chan
]
for
chname
in
sorted
(
epics_output
.
keys
()):
chan_val
=
epics_output
[
chname
]
# split channels if dealing with complex values, same as
# above.
if
np
.
iscomplex
(
chan_val
):
chan
=
[
f
"
{
IFO
}
:
{
ch
a
n
}
_REAL
"
,
f
"
{
IFO
}
:
{
ch
a
n
}
_IMAG
"
]
chan
=
[
f
"
{
IFO
}
:
{
chn
ame
}
_REAL
"
,
f
"
{
IFO
}
:
{
chn
ame
}
_IMAG
"
]
chan_val
=
[
np
.
real
(
chan_val
),
np
.
imag
(
chan_val
)]
else
:
chan
=
[
chan
]
chan
=
[
f
"
{
IFO
}
:
{
chname
}
"
]
chan_val
=
[
chan_val
]
for
idx
,
ch
in
enumerate
(
chan
):
readVal
=
ezca
[
ch
]
ratio
=
readVal
/
chan_val
[
idx
]
if
abs
(
ratio
[
0
]
-
1
)
>
0.000001
:
print
(
'
Eeeeek! We had an EPICS connection error on
'
+
chan
+
'
. Check it!!
'
)
try
:
readVal
=
caget
(
ch
)
ratio
=
readVal
/
chan_val
[
idx
]
if
abs
(
ratio
-
1
)
>
0.000001
:
print
(
f
"
Eeeeek! We had an EPICS error on
{
ch
}
. Check it!!
"
)
except
TypeError
:
print
(
f
"
Error: unable to validate record in channel
{
ch
}
.
"
)
def
compute_etas
(
self
,
frequencies
,
sensing_syserr
=
None
,
actuation_syserr_dict
=
None
):
...
...
This diff is collapsed.
Click to expand it.
setup.cfg
+
1
−
1
View file @
9e038029
...
...
@@ -36,7 +36,7 @@ install_requires =
requests
scikit-learn
>=
1.1.0
scipy
ezca
pyepics
include_package_data
=
true
[options.packages.find]
...
...
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