diff --git a/examples/optivis_aligo_ex.py b/examples/optivis_aligo_ex.py index 0e4970442b55e8019cebdc6e0b128bfd5bf8b313..95764e2ccffb945978a6bb05990cec090fb86c6c 100644 --- a/examples/optivis_aligo_ex.py +++ b/examples/optivis_aligo_ex.py @@ -2,6 +2,5 @@ import pykat kat = pykat.finesse.kat(kat_file="LLO_matched.kat") - kat.optivis().show() diff --git a/pykat/finesse.py b/pykat/finesse.py index 1ee87ec02c49ddfe3aa42f2ea65de11bcf5b6945..3ac28586f9c8c6892c2cae87b67baebcf52efdc3 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -34,8 +34,7 @@ import time import pickle import pykat import warnings -import re -import math +import re import itertools import ctypes import ctypes.util @@ -43,8 +42,9 @@ import collections import re import copy -from collections import namedtuple, OrderedDict +from math import erfc, pi +from collections import namedtuple, OrderedDict from pykat.node_network import NodeNetwork from pykat.detectors import BaseDetector as Detector from pykat.components import Component @@ -151,7 +151,13 @@ def f__lkat_trace_callback(lkat, trace_info, getCavities, getNodes, getSpaces): trace_info[space.name] = space_trace(gouyx = space.gouy_x, gouyy = space.gouy_y) - + +def GUILength(L): + """ + Should scale the lengths in some way to handle km and mm + """ + return 10 * erfc(L/1e3) + 0.01 + class katRun(object): def __init__(self): self.runtime = None @@ -196,7 +202,7 @@ class katRun(object): out = self.y[:, idx[0]] else: if self.yaxis == "abs:deg": - out = self.y[:, idx[0]] * np.exp(1j*math.pi*self.y[:, idx[1]]/180.0) + out = self.y[:, idx[0]] * np.exp(1j*pi*self.y[:, idx[1]]/180.0) elif self.yaxis == "re:im": out = self.y[:, idx[0]] + 1j*self.y[:, idx[1]] @@ -1467,7 +1473,7 @@ class kat(object): # Run through once to add components, ignoring spaces for c in self.getComponents(): if isinstance(c, pykat.components.space): continue - print("Adding %s" % c.name) + optivis_op = getattr(c, "getOptivisComponent", None) # Run through again to add links @@ -1491,8 +1497,7 @@ class kat(object): if no is None or ni is None: raise pkex.BasePyKatException("Optivis node is None") - print("Link %s (%s) -> %s (%s)" %(a[0].name, no.name, a[1].name, ni.name)) - scene.addLink(links.Link(no, ni, c.L.value)) + scene.addLink(links.Link(no, ni, GUILength(c.L.value) )) gui = canvas.Simple(scene=scene) diff --git a/pykat/math/__init__.py b/pykat/maths/__init__.py similarity index 100% rename from pykat/math/__init__.py rename to pykat/maths/__init__.py diff --git a/pykat/math/hermite.py b/pykat/maths/hermite.py similarity index 100% rename from pykat/math/hermite.py rename to pykat/maths/hermite.py diff --git a/pykat/math/zernike.py b/pykat/maths/zernike.py similarity index 100% rename from pykat/math/zernike.py rename to pykat/maths/zernike.py diff --git a/pykat/optics/maps.py b/pykat/optics/maps.py index 4ca3b17285517b0e47e30219b2401cf9860b801f..bee94b8f72b42419307b90c876db87ab1f45685f 100644 --- a/pykat/optics/maps.py +++ b/pykat/optics/maps.py @@ -17,7 +17,7 @@ from pykat.optics.romhom import makeReducedBasis, makeEmpiricalInterpolant, make from scipy.interpolate import interp2d import numpy as np import math -from pykat.math.zernike import * +from pykat.maths.zernike import * class surfacemap(object): def __init__(self, name, maptype, size, center, step_size, scaling, data=None): diff --git a/pykat/optics/romhom.py b/pykat/optics/romhom.py index 958e3e76086dcf81efd7bd0c494604a1cdfea0be..b0b75f18f156300ae55aa661aa734bedf83000e7 100644 --- a/pykat/optics/romhom.py +++ b/pykat/optics/romhom.py @@ -8,7 +8,7 @@ from itertools import combinations_with_replacement as combinations from pykat.optics.gaussian_beams import beam_param, HG_beam from scipy.linalg import inv from math import factorial -from pykat.math.hermite import * +from pykat.maths.hermite import * import numpy as np diff --git a/pykat/utilities/__init__.py b/pykat/tools/plotting/__init__.py similarity index 100% rename from pykat/utilities/__init__.py rename to pykat/tools/plotting/__init__.py diff --git a/pykat/utilities/plotting/beamtrace.py b/pykat/tools/plotting/beamtrace.py similarity index 100% rename from pykat/utilities/plotting/beamtrace.py rename to pykat/tools/plotting/beamtrace.py diff --git a/pykat/utilities/plotting/colormap.py b/pykat/tools/plotting/colormap.py similarity index 100% rename from pykat/utilities/plotting/colormap.py rename to pykat/tools/plotting/colormap.py diff --git a/pykat/utilities/plotting/tools.py b/pykat/tools/plotting/tools.py similarity index 100% rename from pykat/utilities/plotting/tools.py rename to pykat/tools/plotting/tools.py diff --git a/pykat/utilities/plotting/__init__.py b/pykat/utilities/plotting/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000