Commit 6716c81d authored by Daniel Brown's avatar Daniel Brown

Merge branch 'master' of git.ligo.org:finesse/pykat

parents b9899826 337cc1fb
......@@ -50,17 +50,19 @@ from pykat.style import use as set_plot_style
from .SIfloat import SIfloat
msg = "Could not find the finesse executable 'kat'" \
"or you do not have the permissions to run it."
class nokat(object):
def __getattribute__(self, attr):
warn(msg)
try:
kat = finesse.kat()
v = kat.finesse_version()
except pkex.MissingFinesse:
from warnings import warn
msg = "Could not find the finesse executable 'kat'" \
"or you do not have the permissions to run it."
warn(msg)
class nokat(object):
def __getattribute__(self, attr):
warn(msg)
kat = nokat()
v = str(__min_req_finesse__)
if float(v.split('-')[0]) < __min_req_finesse__:
......@@ -68,6 +70,16 @@ if float(v.split('-')[0]) < __min_req_finesse__:
str(__min_req_finesse__),
v))
def info():
print("Pykat version: " + __version__)
print("Pykat loaded from: " + __file__)
if kat != nokat():
print("Finesse version: " + str(v))
print("Finesse loaded from: " + str(kat._finesse_exec()))
else:
print("Finesse could not be initialised")
SI = {'yocto': 1E-24, # yocto
'zepto': 1E-21, # zepto
'atto': 1E-18, # atto
......
......@@ -1281,7 +1281,7 @@ class IFO(object):
import pykat
from pykat.ifo import aligo
base = aligo.make_kat("design_with_IMC_HAM2_FI_OMC")
base = aligo.make_kat("design")
base.maxtem = 2
base = aligo.setup(base)
......
......@@ -749,22 +749,11 @@ def make_kat(name="design", katfile=None, verbose = False, debug=False, use_RF_D
The `name` argument selects from default aLIGO files included in Pykat:
- design: A file based on the design parameters for the final aLIGO setup.
125W input, T_SRM = 20%.
- design_low_power: A file based on the design parameters for the final aLIGO setup.
20W input, T_SRM = 35%. The higher SRM transmission mirror is used for low power
operation. 20W input power from O1 observation.
- design_with_IMC_HAM2: A file based on `design` but has the IMC and HAM2 blocks
which contain design parameter input optics
- design_with_IMC_HAM2_FI_OMC: A file with the OMC and IMC, most complete file
keepComments: If true it will keep the original comments from the file
preserveComments: If true it will keep the const commands in the kat
"""
names = ['design', 'design_low_power', 'design_with_IMC_HAM2', 'design_with_IMC_HAM2_FI_OMC']
names = ['design']
if debug:
kat = finesse.kat(tempdir=".",tempname="test")
......@@ -998,7 +987,8 @@ def pretune(_kat, pretune_precision=1.0e-4, verbose=False, debug={}):
vprint(verbose, " scanning SRCL (maximising carrier power, then adding 90 deg)")
kat = _kat.deepcopy()
kat.removeBlock("locks", False)
# adf: maybe add a temporal differential tuning of MICH or DARM here to increase the power at SRM
# (correct light mode > waste/dirt light)
phi, precision = scan_to_precision(kat.IFO.preSRCL, pretune_precision, phi=0, precision=90.0, debug=("SRCL" in debug))
phi=round(phi/pretune_precision)*pretune_precision
phi=round_to_n(phi, 5) - 90.0
......@@ -1128,62 +1118,6 @@ def pretune_SRCL(_kat, verbose=False, debug=False):
deg = (out.x[SRCL_metric.argmin()] % 360) - 180
IFO.preSRCL.apply_tuning(-deg)
def setup(base, old=True, DC_offset_pm=20, verbose=False):
"""
Runs a preparation routine to produce a LIGO model at a resonable operating point.
This uses the pretune2 and pretune_SRCL methods which allow you
"""
assert_aligo_ifo_kat(base)
base = base.deepcopy()
base.verbose = False
base.removeBlock('locks', False)
base.removeBlock('errsigs', False)
base.removeBlock('powers', False)
base.phase = 2
base.IFO.fix_mirrors()
kat = base.deepcopy()
kat.IFO.remove_modulators()
if old:
pretune(kat,pretune_precision=1e-3, verbose=verbose)
else:
pretune_2(kat, pretune_precision=1e-3, verbose=verbose)
# Apply the tunings to our base kat file
base.IFO.apply_tunings(kat.IFO.get_tunings())
base.IFO.adjust_PRC_length(verbose=verbose)
if verbose:
pretune_status(base)
base.IFO.lengths_status()
# Set DC offset and plot
DCoffset = DC_offset_pm*1e-12 / base.lambda0 * 180.0
base.IFO.set_DC_offset(DCoffset=DCoffset, verbose=verbose)
if not old:
pretune_SRCL(base, verbose=verbose)
errsigs_cmds = base.IFO.add_errsigs_block()
# Generates a dictionary of the lock values to use
locks = generate_locks(base, verbose=verbose)
# Takes these values and then generates the commands and adds them to
# the lock block of the kat
lock_cmds = base.IFO.add_locks_block(locks, verbose=verbose)
base.SRCL_lock.accuracy /= 10
return base
......@@ -1206,7 +1140,7 @@ def pretune_status(_kat):
tunings = kat.IFO.get_tunings()
if tunings['keys']["maxtem"] == -1:
if tunings['keys']["maxtem"] is None or tunings['keys']["maxtem"] == -1:
_maxtemStr="off"
else:
_maxtemStr = "{:3}".format(tunings['keys']["maxtem"])
......@@ -1360,7 +1294,7 @@ def generate_locks(kat, gainsAdjustment = [0.5, 0.005, 1.0, 0.5, 0.025],
return data
def setup(base, DC_offset_pm=20, verbose=False, debug=False):
def setup(_base, DC_offset_pm=20, verbose=False, debug=False):
"""
Runs a preparation routine to produce a LIGO model at a resonable operating point.
......@@ -1373,9 +1307,9 @@ def setup(base, DC_offset_pm=20, verbose=False, debug=False):
# Will change later when this works with the
old = True
assert_aligo_ifo_kat(base)
assert_aligo_ifo_kat(_base)
base = base.deepcopy()
base = _base.deepcopy()
base.verbose = False
base.removeBlock('locks', False)
......@@ -1401,6 +1335,7 @@ def setup(base, DC_offset_pm=20, verbose=False, debug=False):
if not old:
_pretune_PRCL(base, verbose=verbose, debug=debug)
# Set DC offset
DCoffset = DC_offset_pm*1e-12 / base.lambda0 * 180.0
base.IFO.set_DC_offset(DCoffset=DCoffset, verbose=verbose)
......@@ -1420,4 +1355,4 @@ def setup(base, DC_offset_pm=20, verbose=False, debug=False):
#the lock block of the kat
lock_cmds = base.IFO.add_locks_block(locks, verbose=verbose)
return base
\ No newline at end of file
return base
......@@ -29,7 +29,20 @@
#
# Changes since 12/2016:
#
# - 09.05.2017, Daniel Brown, adding input isolator component
# - 09.05.2017, Daniel Brown
# Based on design file at the time. Adding in IMC and HAM2 from old aligo kat files.
# Simplified the IMC/HAM2 parameters.
#
# Documents used:
# * D0902838-v5 - Design values and layout for IMC/HAM2
# * T1000247-v3 - Values for IM mirror distances
# Notes:
# * Input FI is just placed inbetween IM2 and IM3 halfway. From D0902838
# this then separates the beam that is then reflected from IM2 again
# and off another mirror? This extra path isn't included nREFL is just
# at the FI output
# * As no design lengths are specfied for HAM2 distances I used LHO values
# from T1000247.
#
# - 06.12.2016, initial corrections compared to previous files, Anna and Andreas
#
......@@ -63,6 +76,19 @@
# - changed PR2 node4 name from dump11 to nAPOP (auxilliary POP)
#
#
# - 01.07.2017, Daniel Toyra
#
# Adding in OMC and OMCpath from old aligo kat files. Simplified the OMC
# to single surface mirrors. Replaced the path between the SRM and the
# OMCpath with equivalent pure vacuum propagation. Added an ideal Faraday
# isolator (dbs-component).
#
# Documents used:
# *
# Notes:
# *
# TODO:
# * Correct detector nodes. Check parameters for OMC and OMCpath.
#--------------------------------------------------------------------------
%%% FTend header
......@@ -72,26 +98,76 @@
# Laser and input optics
l L0 125 0.0 0.0 ni
bs jitter 1 0 0 0 ni n0 dump dump
s lmod1 1 n0 n1
# modulators for core interferometer sensing - Advanced LIGO, CQG, 2015
# http://iopscience.iop.org/article/10.1088/0264-9381/32/7/074001/meta#cqg507871s4-8
# 9MHz (CARM, PRC, SRC loops)
const f1 9099471
const f2 45497355
mod mod1 $f1 0.18 1 pm n1 n2
s lmod2 1 n2 n3
# 45MHz (MICH, SRC loops)
mod mod2 $f2 0.18 1 pm n3 nLaserOut
###########################################################################
%%% FTend laser
%%% FTblock PRC
###########################################################################
s sLaser_PRC 0 nLaserOut nFI1
%%% FTblock IMC
#####################################################################################
s sIMCin 0 nLaserOut nMC1in
bs1 MC1 6000u 0 0 44.59 nMC1in nMC1refl nMC1trans nMC1fromMC3
s sMC1_MC2 16.24057 nMC1trans nMC2in
bs1 MC2 0 0u 0 0.82 nMC2in nMC2refl nMC2trans dump
s sMC2_MC3 16.24057 nMC2refl nMC3in
attr MC2 Rc 27.24
bs1 MC3 6000u 0 0 44.59 nMC3in nMC3refl nMC3trans nMCreturn_refl
s sMC3substrate 0.0845 $nsilica nMC3trans nMC3ARin
bs2 MC3AR 0 0 0 28.9661 nMC3ARin dump nIMCout dump
# Isolator component
s sMC3_MC1 0.465 nMC3refl nMC1fromMC3
#####################################################################################
%%% FTend IMC
%%% FTblock HAM2
#####################################################################################
s sHAM2in 0.4282 nIMCout nIM11
# IM1 a.k.a. SM1
bs1 IM1 0 0 0 53 nIM11 nIM12 dump dump
s sIM1_IM2 1.2938 nIM12 nIM21
# IM2 a.k.a. PMMT1
bs1 IM2 0 0 0 7 nIM21 nIM22 dump dump
attr IM2 Rc 12.8
s sIM2_FI 0.260 nIM22 nFI1
# Input faraday isolator
dbs FI nFI1 nFI2 nFI3 nREFL
s sFI_PRM 0 nFI3 nPRM1
s sFI_IM3 0.910 nFI3 nIM31
# IM3 a.k.a PMMT2
bs1 IM3 0 0 0 7.1 nIM31 nIM32 dump dump
attr IM3 Rc -6.24
s sIM3_IM4 1.210 nIM32 nIM41
# a.k.a SM2
bs1 IM4 0 0 0 45 nIM41 nHAM2out dump dump
#####################################################################################
%%% FTend HAM2
%%% FTblock PRC
###########################################################################
s sPRCin 0.4135 nHAM2out nPRM1
# PRM
# AR surface
......@@ -105,11 +181,11 @@ attr PRM Rc 11.009
s lp1 16.6107 nPRM2 nPR2a
# PR2
bs1 PR2 250u $Mloss 0 -0.79 nPR2a nPR2b nPOP nAPOP
attr PR2 Rc -4.545
attr PR2 Rc -4.545
# Distance from PR2 to PR3
s lp2 16.1647 nPR2b nPR3a
# PR3
bs1 PR3 0 $Mloss 0 0.615 nPR3a nPR3b dump12 dump13
bs1 PR3 0 $Mloss 0 0.615 nPR3a nPR3b dump dump
attr PR3 Rc 36.027
# Distance from PR3
s lp3 19.5381 nPR3b nPRBS
......@@ -154,11 +230,8 @@ bs2 BSAR2 50u 0 0 29.195 nBSi4 dump15 nSRBS dump16
# Distance from beam splitter to Y arm input mirror
s ly1 5.0126 nYBS nITMY1a
# Thermal lens correction
lens ITMY_therm $th_f nITMY1a nITM_th1
s ITMY_th1 0 nITM_th1 nITM_th2
lens ITMY_lens inf nITM_th2 nITM_th3
s ITMY_th2 0 nITM_th3 nITMY1
lens ITMY_lens $TLY_f nITMY1a nITMY1b
s sITMY_th2 0 nITMY1b nITMY1
# Y arm input mirror
m2 ITMYAR 0 20u 0 nITMY1 nITMYs1
......@@ -186,11 +259,8 @@ attr ITMY mass 40
# Distance from beam splitter to X arm input mirror
s lx1 4.993 nXBS nITMX1a
# Thermal lens correction
lens ITMX_therm $th_f nITMX1a nITMX_th1
s ITMX_th1 0 nITMX_th1 nITMX_th2
lens ITMX_lens inf nITMX_th2 nITMX_th3
s ITMX_th2 0 nITMX_th3 nITMX1
lens ITMX_lens $TLX_f nITMX1a nITMX1b
s sITMX_th2 0 nITMX1b nITMX1
# X arm input mirror
m2 ITMXAR 0 20u 0 nITMX1 nITMXs1
......@@ -217,12 +287,12 @@ attr ITMX mass 40
# Distance to SR3
s ls3 19.3661 nSRBS nSR3b
# SR3
bs1 SR3 0 $Mloss 0 0.785 nSR3b nSR3a dump17 dump18
bs1 SR3 0 $Mloss 0 0.785 nSR3b nSR3a dump dump
attr SR3 Rc 35.972841
# Distance from SR3 to SR2
s ls2 15.4435 nSR3a nSR2b
# SR2
bs1 SR2 0 $Mloss 0 -0.87 nSR2b nSR2a dump19 dump20
bs1 SR2 0 $Mloss 0 -0.87 nSR2b nSR2a dump dump
attr SR2 Rc -6.406
# Distance from SR2 to SRM
s ls1 15.7586 nSR2a nSRM1
......@@ -230,23 +300,103 @@ s ls1 15.7586 nSR2a nSRM1
m1 SRM 0.20 8.7u $phi_SRM nSRM1 nSRMs1
s SRMsub 0.0749 $nsilica nSRMs1 nSRMs2
m2 SRMAR 0 50n 0 nSRMs2 nSRM2
s sAS 0 nSRM2 nAS
#bs2 SRMAR 50n 0 0 0 nSRMs2 nSRMAR1 nSRM2 nSRMAR2
attr SRM Rc -5.6938
s sSRM_FI 0.7278 nSRM2 nFI2a
###########################################################################
%%% FTend SRC
%%% FTblock FI
###########################################################################
# (Loctions and angles based on the solid work file D1000342-v14 give ~5%
# mismatch. Thus lom1, lom3omc have been adjusted to get ~99.7% overlap at the OMC)
# Distance SRM --> Faraday Isolator (FI)
# Directional beam splitter (ideal Faraday Isolator with 4 ports)
# ----------------------------------------------------------------
# Description of node connections, inputNode --> outputNode
# --
# nFI2a (SRM) --> nFI2c (OMC)
# nFI2b (SQZ) --> nFI2a (SRM)
# nFI2c (OMC) --> nFI2d (Unused)
# nFI2d (Unused) --> nFI2b (SQZ)
dbs FI2 nFI2a nFI2b nFI2c nFI2d
# Distance FI2 --> OM1
s sFI_OM1 2.9339 nFI2c nOM1a
# OM1
bs1 OM1 800u $Mloss 0 2.251 nOM1a nOM1b nOM1c dump22 # T is set for high power; Loss is a guess
attr OM1 Rc 4.6
# Distance OM1 --> OM2
s sOM1_OM2 1.395 nOM1b nOM2a
# OM2
bs1 OM2 10u $Mloss 0 4.399 nOM2a nOM2b nOM2c nOM2d # T is a guess
attr OM2 Rc 1.7058
# Distance OM2 --> OM3
s sOM2_OM3 0.631 nOM2b nOM3a
bs1 OM3 10u $Mloss 0 30.037 nOM3a nOM3b nOM3c nOM3d # T is a guess
# Distance OM3 --> OMC input coupler IC
s sOM3_OMC 0.2034 nOM3b nOMC_ICa # By design should be ~0.31
###########################################################################
%%% FTend FI
%%% FTblock OMC
###########################################################################
# OMC (as built parameters: D1300507-v1)
# Input Coupler IC (flat mirror)
bs1 OMC_IC 0.0076 10u 0 2.7609 nOMC_ICa nOMC_ICb nOMC_ICc nOMC_ICd
# Distance from IC to OC
s lIC_OC 0.2815 1 nOMC_ICc nOMC_OCa
# Output Coupler OC (flat mirror)
bs1 OMC_OC 0.0075 10u 0 4.004 nOMC_OCa nOMC_OCb nAS nOMC_OCd
# Distance from OC to CM1
s lOC_CM1 0.2842 1 nOMC_OCb nOMC_CM1a
# Curved Mirror CM1
bs1 OMC_CM1 36u 10u 0 4.004 nOMC_CM1a nOMC_CM1b nOMC_CM1c nOMC_CM1d
attr OMC_CM1 Rc 2.57321
# Distance from CM1 to CM2
s lCM1_CM2 0.2815 1 nOMC_CM1b nOMC_CM2a
# Curved Mirror CM2
bs1 OMC_CM2 35.9u 10u 0 4.004 nOMC_CM2a nOMC_CM2b nOMC_CM2c nOMC_CM2d
attr OMC_CM2 Rc 2.57369
# Distance from CM2 to IC
s lCM2_IC 0.2842 1 nOMC_CM2b nOMC_ICd
###########################################################################
%%% FTend OMC
%%% FTblock cavities
###########################################################################
#cav cavIMC MC2 nMC2in MC2 nMC2refl
cav cavIMC MC2 nMC2in MC2 nMC2refl
cav cavXARM ITMX nITMX2 ETMX nETMX1
cav cavYARM ITMY nITMY2 ETMY nETMY1
cav cavPRX PRM nPRM2 ITMX nITMXs2
cav cavPRY PRM nPRM2 ITMY nITMYs2
cav cavSRX SRM nSRM1 ITMX nITMXs2
cav cavSRY SRM nSRM1 ITMY nITMYs2
# removed OMC
cav cavPRX PRM nPRM2 ITMX nITMXs2
cav cavPRY PRM nPRM2 ITMY nITMYs2
cav cavOMC OMC_IC nOMC_ICc OMC_IC nOMC_ICd
###########################################################################
%%% FTend cavities
......@@ -260,7 +410,8 @@ const Mloss 37.5u
const Larm 3994.4692
const fM 36.397884M
const fP 54.596826M
const th_f 34.5k
const TLY_f 34.5k # Thermal lens ITMY
const TLX_f 34.5k # Thermal lens ITMX
###########################################################################
%%% FTend constants
......@@ -274,95 +425,4 @@ const phi_ETMX 0.0
const phi_ETMY 0.0
const phi_BS 0
###########################################################################
%%% FTend tunings
%%% FTblock powers
###########################################################################
pd P_DC_AS nAS
pd PIMCtrans nREFL*
pd Px nITMX2
pd Py nITMY2
pd Pprc nPRM2
pd Psrc nSRM1*
ad prc0 0 nPRM2
ad prcf1 $f1 nPRM2
ad prcf2 $f2 nPRM2
ad asc0 0 nSRM2
ad asf1 $f1 nSRM2
ad asf2 $f2 nSRM2
ad src0 0 nSRM1*
ad srcf1 $f1 nSRM1*
ad srcf2 $f2 nSRM1*
###########################################################################
%%% FTend powers
%%% FTblock errsigs
###########################################################################
# N.B. the I signal refers to most symmetric signal, not greatest slope.
pd1 REFL_f1_I $f1 101 nREFL
pd1 REFL_f1_Q $f1 191 nREFL
pd1 REFL_f2_I $f2 14 nREFL
pd1 REFL_f2_Q $f2 104 nREFL
pd1 POP_f1_I $f1 101 nPOP
pd1 POP_f1_Q $f1 191 nPOP
pd1 POP_f2_I $f2 13 nPOP
pd1 POP_f2_Q $f2 103 nPOP
pd1 AS_f1_I $f1 0 nSRM2
pd1 AS_f1_Q $f1 90 nSRM2
pd1 AS_f2_I $f2 13 nSRM2
pd1 AS_f2_Q $f2 103 nSRM2
#pd1 OMClockpd $fdither -1.22 nAS
###########################################################################
%%% FTend errsigs
%%% FTblock locks
###########################################################################
set PRCL_err POP_f1_I re
set MICH_err POP_f2_Q re
set CARM_err REFL_f1_I re
set SRCL_err REFL_f2_I re
set DARM_err AS_f2_I re
lock PRCL_lock $PRCL_err -2.769589345492097 10u
lock MICH_lock $MICH_err 12.029218280984777 10u
lock CARM_lock $CARM_err 0.0001193478133584417 10u
lock DARM_lock $DARM_err -0.002325573315055089 10u -0.728491141201167
lock SRCL_lock $SRCL_err -4.886172716885925 10u
func mMICH_lock = 0 - $MICH_lock
func ETMX_lock = $CARM_lock + $MICH_lock + $DARM_lock
func ETMY_lock = $CARM_lock - $MICH_lock - $DARM_lock
put* PRM phi $PRCL_lock
put* PRMAR phi $PRCL_lock
put* ITMX phi $MICH_lock
put* ITMXAR phi $MICH_lock
put* ITMY phi $mMICH_lock
put* ITMYAR phi $mMICH_lock
put* ETMX phi $ETMX_lock
put* ETMXAR phi $ETMX_lock
put* ETMY phi $ETMY_lock
put* ETMYAR phi $ETMY_lock
put* SRM phi $SRCL_lock
noplot PRCL_lock
noplot SRCL_lock
noplot MICH_lock
noplot DARM_lock
noplot CARM_lock
noplot mMICH_lock
noplot ETMX_lock
noplot ETMY_lock
###########################################################################
%%% FTend locks
%%% FTend tunings
\ No newline at end of file
At the time of writing:
design_with_IMC_HAM2_FI_OMC.kat
and
design.kat
are identical. We keep the former for
backwards compatibility with some
examples. Please change/use only
design.kat in the future.
Andreas Freise, 21/11/2018
%%% FTblock header
#--------------------------------------------------------------------------
# An aLIGO design file base on older aLIGO_IFO_AWC_tuning_DCoff_maxtem4.kat
# (details in the original file header)
#
# updated to re-include locks
# (errsig, powers and locks blocks, plus EOMs 1 and 2 (9 and 45kHz))
#
# - R. Abbott. Advanced LIGO length sensing and control final design. LIGO Document T1000298, 2010.
# - Advanced LIGO, CQG, 2015
# http://iopscience.iop.org/article/10.1088/0264-9381/32/7/074001/meta#cqg507871s4-8
# - G. Billingsley. LIGO core optics reference page. https://galaxy.ligo. caltech.edu/optics/
#
# Anna Green, Andreas Freise, 28th November 2016
#--------------------------------------------------------------------------
#
# References used for aLIGO parameters
# [1] R. Abbott. Advanced LIGO length sensing and control final design. LIGO Document T1000298, 2010.
# [2] Advanced LIGO, CQG, 2015
# http://iopscience.iop.org/article/10.1088/0264-9381/32/7/074001/meta#cqg507871s4-8
# [3] G. Billingsley. LIGO core optics reference page. https://galaxy.ligo.caltech.edu/optics/
# [4] D. Martynov, `Lock Acquisition and Sensitivity Analysis of Advanced
# LIGO Interferometers', PhD thesis, Caltech, 2015
# http://thesis.library.caltech.edu/8899/1/DenisMartynovThesis.pdf
# [4] A. Staley, `Locking the Advanced LIGO Gravitational Wave Detector:
# with a focus on the Arm Length Stabilization Technique', PhD thesis,
# Columbia University, 2015
# https://academiccommons.columbia.edu/catalog/ac:189457
#
# Changes since 12/2016:
#
# - 09.05.2017, Daniel Brown, adding input isolator component
#
# - 06.12.2016, initial corrections compared to previous files, Anna and Andreas
#
# Bug fixes
# - AR coatings of ETMs and ITMs were using mirror components with non-zero
# reflectivity. This is wrng as it causes residual resoances with the HR
# surfaces and ignores the wedge in the substrate. Instead the mirror component
# should have losses but no reflectivity. Alternatively beamsplitter components