Skip to content
Snippets Groups Projects
Commit d736c381 authored by Anna Green's avatar Anna Green
Browse files

Merge branch 'master' of git.ligo.org:IFOsim/aundhaisc

parents 20a2fb5f 53dcf01d
No related branches found
No related tags found
No related merge requests found
# Created by https://www.gitignore.io/api/latex,python,matlab,emacs,jupyternotebooks,macos
# Edit at https://www.gitignore.io/?templates=latex,python,matlab,emacs,jupyternotebooks,macos
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# network security
/network-security.data
### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/
.ipynb_checkpoints
*/.ipynb_checkpoints/*
# IPython
profile_default/
ipython_config.py
# Remove previous ipynb_checkpoints
# git rm -r .ipynb_checkpoints/
### LaTeX ###
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Comment the next line if you want to keep your tikz graphics files
*.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices
*.xyc
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# KBibTeX
*~[0-9]*
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
### LaTeX Patch ###
# glossaries
*.glstex
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### MATLAB ###
# Windows default autosave extension
*.asv
# OSX / *nix default autosave extension
*.m~
# Compiled MEX binaries (all platforms)
*.mex*
# Packaged app and toolbox files
*.mlappinstall
*.mltbx
# Generated helpsearch folders
helpsearch*/
# Simulink code generation folders
slprj/
sccprj/
# Matlab code generation folders
codegen/
# Simulink autosave extension
*.autosave
# Octave session info
octave-workspace
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# End of https://www.gitignore.io/api/latex,python,matlab,emacs,jupyternotebooks,macos
*.pdf
*.zip
%% 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 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
```
%% 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': 'sans-serif',
'font.sans-serif': 'Verdana',
'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 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 = 'Spectral')
```
%% Cell type:markdown id: tags:
## Get the AC Sensing Matrix:
### Drive the DoFs, get the complex demod outputs
#### make some Bode plots
%% Cell type:code id: tags:
``` python
kat = aLIGO.deepcopy()
peedees = []
for n in detectors:
peedees.append(n[:-3])
kat.parse("""
const f1 9099471.0
const f2 5 * $f1
%%% FTblock errsigs
pd0 AS_DC nAS
pd1 REFL_f1_I $f1 96.27427245747704 nREFL
pd1 REFL_f1_Q $f1 6.27427245747704 nREFL
pd1 REFL_f2_I $f2 96.27427245747704 nREFL
pd1 REFL_f2_Q $f2 6.27427245747704 nREFL
pd1 POP_f1_I $f1 -57.86313647329267 nPOP
pd1 POP_f1_Q $f1 211.11868103763894 nPOP
pd1 POP_f2_I $f2 -57.86313647329267 nPOP
pd1 POP_f2_Q $f2 211.11868103763894 nPOP
pd1 AS_f1_I $f1 -57.86313647329267 nAS
pd1 AS_f1_Q $f1 211.11868103763894 nAS
pd1 AS_f2_I $f2 -57.86313647329267 nAS
pd1 AS_f2_Q $f2 211.11868103763894 nAS
fsig sig1 LX 1 0 1
fsig sig1 LY 1 180 1
xaxis sig1 f log 1 100k 1000
scale meter
""")
out = kat.run()
# make Bode plots of the LSC Sensing Matrix
fig, ax = plt.subplots(2, 1, sharex=True, figsize=(10, 9))
for d in range(len(peedees)):
v = peedees[d]
ax[0].loglog(out.x, np.abs(out[v]), label=v)
ax[1].semilogx(out.x, np.angle(out[v], deg=True), label=v)
#ax[0].loglog(f_a, np.abs(Em), color='xkcd:Purple Blue', label='Lower Sideband', ls='--')
#ax[0].set_xlabel(r'Frequency [Hz]')
ax[0].set_ylabel(r'Response [W/m ?]')
ax[0].legend(ncol=3)
#ax[0].grid(True, which='Both')
ax[0].set_title('Bode Plot: Transfer function for modulation of the end mirror')
#ax[1].semilogx(f_a, np.angle(Em, deg=True), color='xkcd:Purple Blue', ls='--')
ax[1].set_xlabel(r'Frequency [Hz]')
ax[1].set_ylabel(r'Phase [deg]')
ax[1].set_yticks(np.arange(-180, 181, 60))
#ax[1].grid()
plt.show()
```
%% Cell type:code id: tags:
``` python
print(aLIGO)
```
%% Cell type:code id: tags:
``` python
peedees
```
%% Cell type:code id: tags:
``` python
```
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