Commit 06aebbea authored by Daniel Toyra's avatar Daniel Toyra

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

parents 87ba9bab 09bccb79
......@@ -20,13 +20,24 @@ Please cite pykat when used with::
Url = {http://www.gwoptics.org/pykat}
}
Examples and tutorials can be found at http://www.gwoptics.org/learn/
Please email finesse@star.sr.bham.ac.uk if you have any issues.
Installation
-------------
The easiest way to install PyKat is through PyPi::
The easiest way to install PyKat is through PyPi or Conda (Recommended)::
pip install pykat
conda install -c gwoptics pykat
The Conda installation has the advantage that it will also install the Finesse binaries too.
If you are a Windows user you also have the option to download the installer at https://pypi.python.org/pypi/PyKat.
You should now be able to open up a new Python terminal and type `import pykat`, the output should be::
......
......@@ -1527,13 +1527,14 @@ class laser(Component):
self._requested_node_names.append(node)
self.__power = Param("P", self, SIfloat(P), canFsig=True, fsig_name="amp")
self.__f_offset = Param("f", self, f, canFsig=True, fsig_name="freq")
self.__f_offset = Param("f", self, None, canFsig=True, fsig_name="freq")
self.__phase = Param("phase", self, SIfloat(phase), canFsig=True, fsig_name="phase")
self.__w0 = Param("phase", self, None, canFsig=True, fsig_name="w0", isPutable=False, isPutter=False, isTunable=False)
self.__z = Param("phase", self, None, canFsig=True, fsig_name="z", isPutable=False, isPutter=False, isTunable=False)
self.__noise = AttrParam("noise", self, None)
self._svgItem = None
self.f = f
self._default_fsig_param = self.__f_offset
self._freeze()
......
......@@ -99,7 +99,7 @@ if USE_GUI:
from multiprocessing import Process, Manager
PYKAT_DATA = "PYKAT_DATA="
PYKAT_DATA = "#PYKAT_DATA="
NO_BLOCK = "NO_BLOCK"
pykat_web = "www.gwoptics.org/pykat"
......@@ -1212,9 +1212,10 @@ class kat(object):
katScript = "".join(self.generateKatScript())
katfile.writelines(katScript)
katfile.write("")
katfile.write(PYKAT_DATA + self._data2str())
katfile.flush()
if len(self.data) > 0:
katfile.write("")
katfile.write(PYKAT_DATA + self._data2str())
katfile.flush()
def saveScript(self, filename=None):
"""
......
......@@ -236,7 +236,7 @@ def scan_optics_string(_optics, _factors, _varName='scan', target="phi", linlog=
#print()
return _tuneStr
def scan_f_cmds(DOF, linlog="lin", lower=10, upper=5000, steps=100):
def scan_f_cmds(DOF, linlog="log", lower=10, upper=5000, steps=100):
name = "_%s" % DOF.name
cmds = DOF.fsig(name, 1)
......
......@@ -202,20 +202,20 @@ class ALIGO_IFO(IFO):
code = """
tf2 QUAD 2.38663 0.0 {-0.0050+86.8639i,-0.0050+61.0536i,-0.0050+32.0042i,-0.0050+21.3735i,-0.0050+20.6567i,-0.0050+19.0823i,-0.0050+22.3646i,-0.0050+17.2518i,-0.0050+16.5670i,-0.0050+15.0288i,-0.0050+12.4591i,-0.0050+13.1589i,-0.0050+10.0625i,-0.0050+8.4105i,-0.0050+8.4829i,-0.0050+6.2308i,-0.0050+6.5431i,-0.0050+5.5092i,-0.0050+2.7083i,-0.0050+3.2843i,-0.0050+2.8957i,-0.0050+3.7645i,-0.0050+14.0137i,-0.0050+3.4691i} {-0.0050+86.8639i,-0.0050+61.0536i,-0.0050+32.0042i,-0.0050+21.3735i,-0.0050+20.6566i,-0.0050+19.0823i,-0.0050+17.2493i,-0.0050+16.5665i,-0.0050+22.3646i,-0.0050+15.0288i,-0.0050+12.4591i,-0.0050+13.1589i,-0.0050+9.4995i,-0.0050+8.4829i,-0.0050+5.5072i,-0.0050+6.2177i,-0.0050+6.7464i,-0.0050+6.5428i,-0.0050+2.7591i,-0.0050+2.8957i,-0.0050+3.7645i,-0.0050+14.0137i,-0.0050+3.4691i}
attr ETMY iy 1 rymech
attr ETMX iy 1 rymech
attr ITMY iy 1 rymech
attr ITMX iy 1 rymech
attr PRM iy 1 rymech
attr PR2 iy 1 rymech
attr PR3 iy 1 rymech
attr SRM iy 1 rymech
attr SR2 iy 1 rymech
attr SR3 iy 1 rymech
attr BS iy 1 rymech
attr ETMY iy 1 rymech QUAD
attr ETMX iy 1 rymech QUAD
attr ITMY iy 1 rymech QUAD
attr ITMX iy 1 rymech QUAD
attr PRM iy 1 rymech QUAD
attr PR2 iy 1 rymech QUAD
attr PR3 iy 1 rymech QUAD
attr SRM iy 1 rymech QUAD
attr SR2 iy 1 rymech QUAD
attr SR3 iy 1 rymech QUAD
attr BS iy 1 rymech QUAD
"""
self.kat.parse(code)
......@@ -882,6 +882,8 @@ def make_kat(name="design", katfile=None, verbose = False, debug=False, keepComm
kat.IFO.DARM = DOF(kat.IFO, "DARM", kat.IFO.AS_DC, "", ["ETMX", "ETMY"], [-1,1], 1.0, sigtype="z")
kat.IFO.SRCL = DOF(kat.IFO, "SRCL", kat.IFO.REFL_f2, "I", "SRM", -1, 1e2, sigtype="z")
kat.IFO.DARM_h = DOF(kat.IFO, "DARM_h", None, "", ["LY", "LX"], [-1,1], 1.0, sigtype="phase")
kat.IFO.LSC_DOFs = (kat.IFO.PRCL, kat.IFO.MICH, kat.IFO.CARM, kat.IFO.DARM, kat.IFO.SRCL)
kat.IFO.CAV_POWs = (kat.IFO.POW_X, kat.IFO.POW_Y, kat.IFO.POW_BS)
......
......@@ -139,6 +139,10 @@ class BeamParam(object):
return np.arctan2(q.real, q.imag)
@property
def divergence(self):
return self.wavelength/ (self.w0 * np.pi)
@property
def w0(self):
return np.sqrt(self.__q.imag * self.__lambda / (self.__nr * math.pi))
......
......@@ -21,15 +21,18 @@ def in_ipython():
return False
def init_pykat_plotting(mode="display", dpi=100):
def init_pykat_plotting(mode="display", dpi=100, fmts=None):
import matplotlib as mpl
__DPI__ = int(dpi)
if fmts is None:
fmts=['svg', 'pdf']
if in_ipython():
try:
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('pdf', 'svg')
set_matplotlib_formats(*fmts)
ipy = get_ipython()
ipy.magic("matplotlib inline")
except:
......
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