Commit baa8373f authored by Andreas Freise's avatar Andreas Freise
Browse files

adding utility functions to aLIGO

parent 94b579d9
Pipeline #1721 passed with stage
in 20 seconds
......@@ -3,19 +3,49 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
#import pykat.exceptions as pkex
import numpy as np
import math
import copy
import warnings
import cmath
import pykat.components
import pykat.exceptions as pkex
#class aLIGO():
class aLIGO(object):
def __init__(self, _name="default"):
names = ['default', 'LLO', 'LHO']
if _name not in names:
printf("aLIGO name `{}' not recognised, must be 'default', 'LLO' or 'LHO'",_name)
def BSpath(thickness, n=nsilica, angle=45.0):
def make_transparent(kat, _components):
Function to make certain mirror or beamsplitter objects transparent
make_transparent(kat, "PRM")
make_transparent(kat, ["PRM", "SRM"])
The function modifies the kat object. Use something like
kat = copy.deepcopy(basekat)
before if you want to preseve the original kat object
for o in kat.components.values():
if in components:
if isinstance(o, pykat.components.AbstractMirrorComponent):
components = [c for c in components if c !=]
raise pkex.BasePyKatException("{} is not a mirror or beamsplitter".format(o))
print(' Made {} transparent,'.format(o))
if len(components) != 0:
raise pkex.BasePyKatException("Cannot find component {}".format(components))
return kat
def BS_optical_path(thickness, n=nsilica, angle=45.0):
Compute optical path length in BS substrate, default
parameters assume angle of incidence of 45 deg and fused
......@@ -29,3 +59,14 @@ def BSpath(thickness, n=nsilica, angle=45.0):
L = thickness / math.cos(angle_subst)
return math.degrees(angle_subst), L
def make_list_copy(_l):
Utility function, takes a list of strings or single string
and returns a copy of a list, e.g.
"string" copy to ["string"]
["string1", "string2"] copy to ["string1", "string2"]
if not isinstance(_l, list):
_l = [_l]
return _l[:] # copy the list, just to be save
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment