Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
AundhaISC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Siddhesh Pai
AundhaISC
Commits
53dcf01d
Commit
53dcf01d
authored
4 years ago
by
Rana
Browse files
Options
Downloads
Patches
Plain Diff
ignore PDF and ZIP files
parent
c46a07fd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DRMI_controls/.gitignore
+2
-0
2 additions, 0 deletions
DRMI_controls/.gitignore
DRMI_controls/OptimizeDRMI-LSC.ipynb
+4
-1
4 additions, 1 deletion
DRMI_controls/OptimizeDRMI-LSC.ipynb
with
6 additions
and
1 deletion
DRMI_controls/.gitignore
0 → 100644
+
2
−
0
View file @
53dcf01d
*.pdf
*.zip
This diff is collapsed.
Click to expand it.
DRMI_controls/OptimizeDRMI-LSC.ipynb
+
4
−
1
View file @
53dcf01d
...
...
@@ -67,6 +67,9 @@
"\n",
"def radar_plot(self, detector_I, detector_Q, DOFs=None, ax=None, title=None, leg=True, autoscale=True):\n",
" \"\"\"Generates an I-Q quadrature radar plot from this sensing matrix.\n",
" \n",
" Each radar plot shows the magnitude and phase of the response in that\n",
" sensor for each of the DOFs. e.g. Watts in POP_f1 per meter of ETMX motion\n",
" \n",
" Parameters\n",
" ----------\n",
...
...
@@ -74,7 +77,7 @@
" Detector name in the sensing matrix for I quadrature\n",
" \n",
" detector_Q : str\n",
" Detector name in the sensing matrix for
I
quadrature\n",
" Detector name in the sensing matrix for
Q
quadrature\n",
" \n",
" DOFs : collection[str], optional\n",
" DOFs in the sensing matrix to plot\n",
...
...
%% Cell type:markdown id: tags:
# DRMI ISC Designer
## Use Finesse to optimize the LSC error signals for the DRMI
%% Cell type:code id: tags:
```
python
%
matplotlib
notebook
from
pykat
import
finesse
from
pykat.commands
import
*
import
pykat.external.peakdetect
as
peak
import
pykat.ifo.aligo
as
aligo
import
pykat.ifo.aligo.plot
as
aligoplt
import
gwinc
as
gwinc
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib.cm
as
cm
import
pandas
as
pd
pykat
.
init_pykat_plotting
(
dpi
=
72
)
#for animations:
from
matplotlib
import
animation
,
rc
from
IPython.display
import
HTML
plt
.
style
.
use
(
'
dark_background
'
)
# Update the matplotlib configuration parameters:
plt
.
rcParams
.
update
({
'
text.usetex
'
:
False
,
'
lines.linewidth
'
:
4
,
'
font.family
'
:
'
serif
'
,
'
font.serif
'
:
'
Georgia
'
,
'
font.size
'
:
14
,
'
xtick.direction
'
:
'
in
'
,
'
ytick.direction
'
:
'
in
'
,
'
xtick.labelsize
'
:
'
small
'
,
'
ytick.labelsize
'
:
'
small
'
,
'
axes.labelsize
'
:
'
medium
'
,
'
axes.titlesize
'
:
'
medium
'
,
'
axes.grid.axis
'
:
'
both
'
,
'
axes.grid.which
'
:
'
both
'
,
'
axes.grid
'
:
True
,
'
grid.color
'
:
'
xkcd:Sea Green
'
,
'
grid.alpha
'
:
0.3
,
'
lines.markersize
'
:
12
,
'
legend.borderpad
'
:
0.2
,
'
legend.fancybox
'
:
True
,
'
legend.fontsize
'
:
'
small
'
,
'
legend.framealpha
'
:
0.8
,
'
legend.handletextpad
'
:
0.5
,
'
legend.labelspacing
'
:
0.33
,
'
legend.loc
'
:
'
best
'
,
'
figure.figsize
'
:
((
14
,
8
)),
'
savefig.dpi
'
:
140
,
'
savefig.bbox
'
:
'
tight
'
,
'
pdf.compression
'
:
9
})
def
radar_plot
(
self
,
detector_I
,
detector_Q
,
DOFs
=
None
,
ax
=
None
,
title
=
None
,
leg
=
True
,
autoscale
=
True
):
"""
Generates an I-Q quadrature radar plot from this sensing matrix.
Each radar plot shows the magnitude and phase of the response in that
sensor for each of the DOFs. e.g. Watts in POP_f1 per meter of ETMX motion
Parameters
----------
detector_I : str
Detector name in the sensing matrix for I quadrature
detector_Q : str
Detector name in the sensing matrix for
I
quadrature
Detector name in the sensing matrix for
Q
quadrature
DOFs : collection[str], optional
DOFs in the sensing matrix to plot
ax : axis, optional
Matplotlib axis to put plot into
title: str, optional
Title of plot
"""
I
=
self
[
detector_I
]
Q
=
self
[
detector_Q
]
A
=
I
+
1j
*
Q
# FFS, we need to standardize on the colors for the DOFs with an iron fist
# DARM = DODGER BLUE, CARM = CARNATION, PRCL=PURPLE, MICH = MIDNIGHT, SRCL = Cyan
clrs
=
[
'
xkcd:Dodger Blue
'
,
'
xkcd:Red
'
,
'
xkcd:Lavender
'
,
'
xkcd:Cyan
'
,
'
xkcd:Grey
'
]
_ax
=
ax
or
plt
.
subplot
(
111
,
projection
=
'
polar
'
)
_ax
.
set_theta_zero_location
(
'
E
'
)
r_lim
=
(
np
.
log10
(
np
.
abs
(
A
)).
min
()
-
1
,
np
.
log10
(
np
.
abs
(
A
)).
max
())
if
DOFs
and
any
((
_
not
in
A
.
keys
()
for
_
in
DOFs
)):
raise
Exception
(
"
Sensing matrix is missing one of DOFs ({0}) requested
"
.
format
(
DOFs
))
if
DOFs
:
keys
=
tuple
(
_
for
_
in
A
.
keys
()
if
_
in
DOFs
)
else
:
keys
=
A
.
keys
()
scaling
=
np
.
linspace
(
7
,
4
,
len
(
keys
))
for
_
,
s
,
cc
in
zip
(
keys
,
scaling
,
clrs
):
theta
=
np
.
angle
(
A
[
_
])
r
=
np
.
log10
(
np
.
abs
(
A
[
_
]))
_ax
.
plot
((
theta
,
theta
),
(
r_lim
[
0
],
r
),
lw
=
s
,
label
=
_
,
alpha
=
0.6
,
color
=
cc
)
ttl
=
_ax
.
set_title
(
title
,
fontsize
=
11
)
ttl
.
set_position
([.
5
,
1.12
])
if
autoscale
==
True
:
_ax
.
set_ylim
(
r_lim
[
0
],
r_lim
[
1
])
else
:
_ax
.
set_ylim
(
6
,
11
)
if
leg
==
True
:
_ax
.
legend
(
bbox_to_anchor
=
(
0.5
,
-
0.1
),
ncol
=
5
)
_ax
.
set_rticks
(
np
.
arange
(
*
np
.
round
(
r_lim
)))
_ax
.
set_yticklabels
(
tuple
(
"
$10^{%s}$
"
%
_
for
_
in
np
.
arange
(
*
np
.
round
(
r_lim
),
dtype
=
int
)))
_ax
.
grid
(
True
,
zorder
=
-
10
,
lw
=
2
)
if
ax
is
None
:
plt
.
tight_layout
()
plt
.
show
()
def
prettySensingMatrix
(
self
,
cmap
=
'
jet
'
):
# https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html
# Set colormap equal to seaborns light green color palette
cmap
=
plt
.
get_cmap
(
cmap
)
# Set CSS properties for th elements in dataframe
th_props
=
[
(
'
font-size
'
,
'
24
'
),
(
'
text-align
'
,
'
center
'
),
(
'
font-weight
'
,
'
bold
'
),
(
'
color
'
,
'
xkcd:White
'
),
(
'
background-color
'
,
'
xkcd:Black
'
)
]
# Set CSS properties for td elements in dataframe
td_props
=
[
(
'
font-size
'
,
'
24
'
)
]
# Set table styles
styles
=
[
dict
(
selector
=
"
th
"
,
props
=
th_props
),
dict
(
selector
=
"
td
"
,
props
=
td_props
)
]
self
=
(
self
.
style
.
background_gradient
(
cmap
=
cmap
,
subset
=
list
(
self
))
.
set_caption
(
'
Interferometer Sensing Matrix
'
)
.
format
(
"
{:0.3g}
"
)
.
set_table_styles
(
styles
))
return
self
```
%% Cell type:markdown id: tags:
## Outline
1.
Get IFO params, build Finesse model
1.
Get the LSC sensing matrix
1.
Make a radar plot
%% Cell type:code id: tags:
```
python
aLIGO
=
aligo
.
make_kat
()
aLIGO
.
maxtem
=
-
1
#USE PLANE WAVES MODEL FIRST (speed, complexity...)
TT
=
0.325
#better match to sites
aLIGO
.
SRM
.
setRTL
(
1
-
TT
-
aLIGO
.
SRM
.
L
,
TT
,
aLIGO
.
SRM
.
L
)
# DRMI Only
#aLIGO.ETMX.T = 1 - aLIGO.ETMX.L
#aLIGO.ETMY.T = 1 - aLIGO.ETMY.T
aLIGO
=
aligo
.
setup
(
aLIGO
)
kat
=
aLIGO
.
deepcopy
()
# Make a copy of the model
```
%% Cell type:code id: tags:
```
python
DOFs
=
[
"
DARM
"
,
"
CARM
"
,
"
PRCL
"
,
"
SRCL
"
,
"
MICH
"
]
# Add some detectors in to measure the transfer function
# from each degree of freedom specified above to each one
# of these outputs. Here we pick either the I or Q quadrature
detectors
=
[
kat
.
IFO
.
REFL_f1
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
REFL_f1
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
REFL_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
REFL_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
POP_f1
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
POP_f1
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
POP_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
POP_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
AS_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
AS_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
AS_DC
.
add_transfer
()
]
# what frequency is this measured at ???
sens
=
kat
.
IFO
.
sensing_matrix
(
DOFs
,
detectors
)
```
%% Cell type:markdown id: tags:
### Set the demod phases
#### put CARM out of the Q phase everywhere
##### this doesn't make much sense until the CARM loop is closed with high gain
%% Cell type:code id: tags:
```
python
aLIGO
.
IFO
.
REFL_f1
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
REFL_f1_Q_TF
'
][
'
CARM
'
],
sens
[
'
REFL_f1_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
REFL_f2
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
REFL_f2_Q_TF
'
][
'
CARM
'
],
sens
[
'
REFL_f2_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
POP_f1
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
POP_f1_Q_TF
'
][
'
CARM
'
],
sens
[
'
POP_f1_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
POP_f2
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
POP_f2_Q_TF
'
][
'
CARM
'
],
sens
[
'
POP_f2_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
AS_f2
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
AS_f2_Q_TF
'
][
'
CARM
'
],
sens
[
'
AS_f2_I_TF
'
][
'
CARM
'
])
aLIGO
=
aligo
.
setup
(
aLIGO
)
kat
=
aLIGO
.
deepcopy
()
# Make a copy of the model
detectors
=
[
kat
.
IFO
.
REFL_f1
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
REFL_f1
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
REFL_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
REFL_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
POP_f1
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
POP_f1
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
POP_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
POP_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
AS_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
AS_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
AS_DC
.
add_transfer
()
]
sens
=
kat
.
IFO
.
sensing_matrix
(
DOFs
,
detectors
)
prettySensingMatrix
(
sens
,
cmap
=
'
twilight
'
)
```
%% Cell type:code id: tags:
```
python
N
=
len
(
detectors
)
M
=
N
if
np
.
mod
(
N
,
2
)
>
0
:
M
=
N
-
1
ASDC
=
detectors
[
-
1
]
#fig, ax = plt.subplots(nrows=1, ncols=M // 2, projection='polar')
fig
,
ax
=
plt
.
subplots
(
nrows
=
1
,
ncols
=
M
//
2
,
subplot_kw
=
dict
(
polar
=
True
),
figsize
=
(
22
,
9
))
leg
=
False
for
b
in
range
(
M
//
2
):
if
b
==
(
M
//
2
)
-
1
:
leg
=
True
radar_plot
(
sens
,
detectors
[
2
*
b
],
detectors
[
2
*
b
+
1
],
ax
=
ax
[
b
],
leg
=
leg
,
title
=
detectors
[
2
*
b
][:
-
5
],
autoscale
=
True
)
#fig.tight_layout(pad=5.0)
plt
.
savefig
(
'
radar-ALL.pdf
'
)
```
%% Cell type:code id: tags:
```
python
aLIGO
.
IFO
.
REFL_f1
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
REFL_f1_Q_TF
'
][
'
CARM
'
],
sens
[
'
REFL_f1_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
REFL_f2
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
REFL_f2_Q_TF
'
][
'
CARM
'
],
sens
[
'
REFL_f2_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
POP_f1
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
POP_f1_Q_TF
'
][
'
CARM
'
],
sens
[
'
POP_f1_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
POP_f2
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
POP_f2_Q_TF
'
][
'
CARM
'
],
sens
[
'
POP_f2_I_TF
'
][
'
CARM
'
])
aLIGO
.
IFO
.
AS_f2
.
phase
+=
180
/
np
.
pi
*
np
.
arctan2
(
sens
[
'
AS_f2_Q_TF
'
][
'
CARM
'
],
sens
[
'
AS_f2_I_TF
'
][
'
CARM
'
])
aLIGO
=
aligo
.
setup
(
aLIGO
)
kat
=
aLIGO
.
deepcopy
()
# Make a copy of the model
detectors
=
[
kat
.
IFO
.
REFL_f1
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
REFL_f1
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
REFL_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
REFL_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
POP_f1
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
POP_f1
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
POP_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
POP_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
AS_f2
.
add_transfer
(
'
I
'
),
kat
.
IFO
.
AS_f2
.
add_transfer
(
'
Q
'
),
kat
.
IFO
.
AS_DC
.
add_transfer
()
]
sens
=
kat
.
IFO
.
sensing_matrix
(
DOFs
,
detectors
)
prettySensingMatrix
(
sens
,
cmap
=
'
Spectral
'
)
```
%% Cell type:code id: tags:
```
python
N
=
len
(
detectors
)
M
=
N
if
np
.
mod
(
N
,
2
)
>
0
:
M
=
N
-
1
ASDC
=
detectors
[
-
1
]
#fig, ax = plt.subplots(nrows=1, ncols=M // 2, projection='polar')
fig
,
ax
=
plt
.
subplots
(
nrows
=
1
,
ncols
=
M
//
2
,
subplot_kw
=
dict
(
polar
=
True
),
figsize
=
(
22
,
9
))
leg
=
False
for
b
in
range
(
M
//
2
):
if
b
==
(
M
//
2
)
-
1
:
leg
=
True
radar_plot
(
sens
,
detectors
[
2
*
b
],
detectors
[
2
*
b
+
1
],
ax
=
ax
[
b
],
leg
=
leg
,
title
=
detectors
[
2
*
b
][:
-
5
],
autoscale
=
True
)
```
%% Cell type:code id: tags:
```
python
``
`
%%
Cell
type
:
code
id
:
tags
:
```
python
```
%% Cell type:code id: tags:
```
python
```
...
...
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