Skip to content
Snippets Groups Projects
Commit b0fe8afc authored by Rana's avatar Rana
Browse files

initial PRMI notebook

parent f4b273e3
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# PRMI ISC Designer
## Use Finesse to optimize the LSC error signals for the PRMI
%% 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 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
1. Adjust the demod phases to put the error signals in the right demod quadrature (e.g. I phase for common mode signals, Q-phase for differential mode)
1. Find the sensing noise for each DoF:
1. Measure the total power at each photodetector
1. Calculate the shot noise based on this power
1. Use the sensing matrix to determine the noise in m/sqrt{Hz}
1. Get the AC Transfer Functions
1. Make swept sine of each DoF (1 at a time)
1. Measure/plot the error signal responses [W/m]
1. Design the control loops
1. The mirror actuation transfer function is that of a simple pendulum with a resonant frequency of 1 Hz, and a Q = 10.
1. Design the SISO loops for PRCL and MICH such that the loops are stable.
1. Combine the optical plant TF, the actuator TF, and the digital filter TF. Make Bode plots of these.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment