setup()
function¶Author: Anna Green
This notebook was developed as part of a series of tutorial workshops at the University of Florida in 2019. It is currently in the process of being 'polished' to fit the Learn Interferometry course.
Today we will look further at the setup()
function and what it adds to a site model and review some tips for preparing your model to suit its purpose
should cover:
# all the usual stuff we've used before
from pykat import finesse # import the whole pykat.finesse package
from pykat.commands import * # import all packages in pykat.commands
import numpy as np # for basic math/sci/array functions
import matplotlib.pyplot as plt # for plotting
import inspect # for looking at source codes of functions
#ALIGO ifo pykat objects
import pykat.ifo.aligo as aligo
import pykat.ifo.aligo.plot as aligoplt
# tell the notebook to automatically show plots inline below each cell
%matplotlib inline
# use pykat's plotting style. change dpi to change plot sizes on your screen
pykat.init_pykat_plotting(dpi=90)
base = aligo.make_kat()
fig, ax = plt.subplots(1,1)
aligoplt.strain_sensitivity(base,ax=ax, plot_cmds={'label':'base, maxtem 2'})
base2 = aligo.setup(base)
aligoplt.strain_sensitivity(base2,ax=ax, plot_cmds={'label':'after setup()'})
plt.legend()
2. print and compare base and base2 kat opjects what's been added and altered?
print(base2.getBlocks() - base.getBlocks())
set(base2.generateKatScript()) - set(base.generateKatScript())
errsigs
and locks
blocksLIGO = base.deepcopy()
LIGO.maxtem=2
LIGO = aligo.setup(LIGO,verbose = True, debug = True)
Let's see what it's actually doing
print(inspect.getsource(pykat.ifo.aligo.setup))
Setup is actually a wrapper function for a lot of other functions. You can of course run inspect on each of these, but essentially the first part is to get the file to an operating point, and the second part is to keep it there.
pretune sets the kat object to an initial operating point based on the cavity resonance and dark AS port requirements.
adjust_PRC_length:
The PRC has to be resonant for the 9MHz (and by proxy the 45MHz) sidebands. This function enforces that by directly altering the macroscopic length lp1
in the PRC, such that lPRC = (N+1/2) * c/(2*f1)
.
set_DC_offset: LIGO runs with a nearly dark AS port, with small offset to allow DC locking. If there are pre-specified tunings for the DC offset, it applies these to the ETMs then computes the resulting carrier 00 mode power. That's the case here. Otherwise, it measures the total power (mostly sidebands) at the AS port, then sets the ETM tunings to that the total power there is twice this value.
add_errsigs_block removes any previous error signals block in the kat object and replaces it with one generated based on the error signals definied in the aligo IFO class object.
generate_locks:
add_locks_block reads the dictionary generated above, and information in the IFO object, to generate the code for the lock block, then parses this to the kat object. A lot of this is still hard-coded.
So now we have a base finesse model of LIGO that we know how to get to an operating point.
Now, we need to consider what we want to model, and what we need to include in our model to do this accurately and efficiently.
Key types:
Including everything that's included by default after setup() is inefficient, and can also potentially make the result more confusing to interpret.
However, being too over-efficient obviously means you might miss something or get a result that's just wrong.
Usually, it's best to start with the most minimal version on your model you can cope with, then go back and re-introduce features, complexity, or higher resolution to see what difference they make, if any.
In this sense, a very handy feature is the 'kat.removeBlock()
' function.
The basic questions are:
Then, as you go through the model, occasionally check:
Consider the following questions posed by Mr J.B. Commissioner. What do we need to keep in the model each time?