Skip to content
Snippets Groups Projects
Commit abaa3bd3 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

rename precomp module and cleanup

clarify PRFixed to be bool and True by default
parent d6bb4c2a
No related branches found
No related tags found
No related merge requests found
from .ifo import load_ifo from .ifo import load_ifo
from .util import precompIFO from .precomp import precompIFO
from .gwinc import noise_calc from .gwinc import noise_calc
from .gwinc import gwinc from .gwinc import gwinc
from .plot import plot_noise from .plot import plot_noise
...@@ -8,6 +8,7 @@ import logging ...@@ -8,6 +8,7 @@ import logging
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
from .ifo import available_ifos, load_ifo from .ifo import available_ifos, load_ifo
from .precomp import precompIFO
from . import plot_noise from . import plot_noise
################################################## ##################################################
......
...@@ -3,7 +3,7 @@ import numpy as np ...@@ -3,7 +3,7 @@ import numpy as np
from numpy import log10, pi, sqrt from numpy import log10, pi, sqrt
import copy import copy
from .util import precompIFO from .precomp import precompIFO
from . import noise from . import noise
from . import plot from . import plot
...@@ -115,8 +115,8 @@ def gwinc(freq, ifoin, source=None, fig=False): ...@@ -115,8 +115,8 @@ def gwinc(freq, ifoin, source=None, fig=False):
ifo = copy.deepcopy(ifoin) ifo = copy.deepcopy(ifoin)
modeSR = 0 modeSR = False
PRfixed = 0 PRfixed = True
# stick it into the IFO so that it gets passed around # stick it into the IFO so that it gets passed around
ifo.modeSR = modeSR ifo.modeSR = modeSR
......
from __future__ import division, print_function from __future__ import division
from numpy import pi, sqrt from numpy import pi, sqrt
from scipy.io.matlab.mio5_params import mat_struct
from scipy.io import loadmat from scipy.io import loadmat
import scipy.special import scipy.special
import logging
from .struct import Struct from .struct import Struct
from .noise.coatingthermal import getCoatDopt from .noise.coatingthermal import getCoatDopt
def precompIFO(ifo, PRfixed=0): def precompIFO(ifo, PRfixed=True):
"""Add precomputed data to the IFO model. """Add precomputed data to the IFO model.
To prevent recomputation of these precomputed data, if the To prevent recomputation of these precomputed data, if the
ifo argument contains ifo.gwinc.PRfixed, and this matches ifo argument contains ifo.gwinc.PRfixed, and this matches
the argument PRfixed, no changes are made. the argument PRfixed, no changes are made.
""" """
# check PRfixed if 'gwinc' not in ifo:
#if 'gwinc' in ifo.__dict__: ifo.gwinc = Struct()
# && isfield(ifo.gwinc, 'PRfixed') && ifo.gwinc.PRfixed == PRfixed
#return
ifo.gwinc = mat_struct()
ifo.gwinc.PRfixed = PRfixed ifo.gwinc.PRfixed = PRfixed
################################# DERIVED TEMP ################################# DERIVED TEMP
...@@ -47,7 +44,7 @@ def precompIFO(ifo, PRfixed=0): ...@@ -47,7 +44,7 @@ def precompIFO(ifo, PRfixed=0):
dL = ifo.Optics.ETM.CoatingThicknessLown dL = ifo.Optics.ETM.CoatingThicknessLown
dCap = ifo.Optics.ETM.CoatingThicknessCap dCap = ifo.Optics.ETM.CoatingThicknessCap
ifo.Optics.ETM.CoatLayerOpticalThickness = getCoatDopt(ifo, T, dL, dCap=dCap) ifo.Optics.ETM.CoatLayerOpticalThickness = getCoatDopt(ifo, T, dL, dCap=dCap)
# compute power on BS # compute power on BS
pbs, parm, finesse, prfactor, Tpr = precompPower(ifo, PRfixed) pbs, parm, finesse, prfactor, Tpr = precompPower(ifo, PRfixed)
ifo.gwinc.pbs = pbs ifo.gwinc.pbs = pbs
...@@ -82,7 +79,7 @@ def precompIFO(ifo, PRfixed=0): ...@@ -82,7 +79,7 @@ def precompIFO(ifo, PRfixed=0):
return ifo return ifo
def precompPower(ifo, PRfixed): def precompPower(ifo, PRfixed=True):
"""Compute power on beamsplitter and finesse and power recycling factor. """Compute power on beamsplitter and finesse and power recycling factor.
""" """
...@@ -114,7 +111,7 @@ def precompPower(ifo, PRfixed): ...@@ -114,7 +111,7 @@ def precompPower(ifo, PRfixed):
garm = t1 / (1 - r1*r2*sqrt(1-2*loss)) # amplitude gain wrt input field garm = t1 / (1 - r1*r2*sqrt(1-2*loss)) # amplitude gain wrt input field
rarm = r1 - t1 * r2 * sqrt(1-2*loss) * garm rarm = r1 - t1 * r2 * sqrt(1-2*loss) * garm
if (PRfixed == 1): if PRfixed:
Tpr = ifo.Optics.PRM.Transmittance # use given value Tpr = ifo.Optics.PRM.Transmittance # use given value
else: else:
#prfactor = 1/(2*loss * neff + bsloss); % power recycling factor #prfactor = 1/(2*loss * neff + bsloss); % power recycling factor
......
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