Commit 15650200 authored by Daniel Brown's avatar Daniel Brown
Browse files

romhom updates

parent ade6bd5c
......@@ -30,6 +30,7 @@ import subprocess
import tempfile
import numpy as np
import datetime
import time
import pickle
import pykat
import warnings
......@@ -153,7 +154,8 @@ def f__lkat_trace_callback(lkat, trace_info, getCavities, getNodes, getSpaces):
class katRun(object):
def __init__(self):
self.runDateTime = datetime.datetime.now()
self.runtime = None
self.StartDateTime = datetime.datetime.now()
self.x = None
self.y = None
self.xlabel = None
......@@ -162,11 +164,12 @@ class katRun(object):
self.katVersion = None
self.yaxis = None
def plot(self):
def plot(self, logy=False):
import pylab
pylab.plot(self.x, self.y)
pylab.legend(self.ylabels,0)
pylab.legend(self.ylabels, 0)
pylab.xlabel(self.xlabel)
pylab.show()
......@@ -209,7 +212,8 @@ class katRun(object):
class katRun2D(object):
def __init__(self):
self.runDateTime = datetime.datetime.now()
self.runtime
self.startDateTime = datetime.datetime.now()
self.x = None
self.y = None
self.z = None
......@@ -956,7 +960,8 @@ class kat(object):
r.yaxis = self.yaxis
r.katScript = "".join(self.generateKatScript())
r.katScript += "time\n"
if (plot==None):
# ensure we don't do any plotting. That should be handled
# by user themselves
......@@ -1022,13 +1027,18 @@ class kat(object):
if printerr == 1:
sys.stdout.write("\r{0} {1}".format(action, prc))
else:
err += line
[out,errpipe] = p.communicate()
_out = out.split("\n")
for line in _out[::-1]:
if line.lstrip().startswith('computation time:'):
r.runtime = float(line.split(":")[1].replace("s",""))
if printout == 1:
print(out)
else:
......@@ -1039,8 +1049,6 @@ class kat(object):
ix2 = out.find(')',ix)
r.katVersion = out[ix:ix2]
r.runDateTime = datetime.datetime.now()
# If Finesse returned an error, just print that and exit!
if p.returncode != 0:
print(err)
......
......@@ -311,15 +311,15 @@ def ROM_HG_knm(weights, mode_in, mode_out, q1, q2, q1y=None, q2y=None, cache=Non
elif n_mod_2 != m_mod_2:
if npr_mod_2 == mpr_mod_2:
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q1Q4) + np.einsum('ij,ij', -u_xy_nodes, w_ij_Q2Q3)
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q1Q4) - np.einsum('ij,ij', u_xy_nodes, w_ij_Q2Q3)
else:
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q2Q4) + np.einsum('ij,ij', -u_xy_nodes, w_ij_Q1Q3)
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q2Q4) - np.einsum('ij,ij', u_xy_nodes, w_ij_Q1Q3)
elif npr_mod_2 != mpr_mod_2:
if n_mod_2 == m_mod_2:
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q3Q4) + np.einsum('ij,ij', -u_xy_nodes, w_ij_Q1Q2)
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q3Q4) - np.einsum('ij,ij', u_xy_nodes, w_ij_Q1Q2)
else:
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q2Q4) + np.einsum('ij,ij', -u_xy_nodes, w_ij_Q1Q3)
k_ROQ = np.einsum('ij,ij', u_xy_nodes, w_ij_Q2Q4) - np.einsum('ij,ij', u_xy_nodes, w_ij_Q1Q3)
return k_ROQ
......
......@@ -293,7 +293,7 @@ class curvedmap(surfacemap):
class tiltmap(surfacemap):
def __init__(self, name, size, step_size, tilt):
surfacemap.__init__(self, name, "phase", size, (np.array(size)+1)/2.0, step_size, 1e-9)
surfacemap.__init__(self, name, "phase reflection", size, (np.array(size)+1)/2.0, step_size, 1e-9)
self.tilt = tilt
@property
......@@ -311,7 +311,7 @@ class tiltmap(surfacemap):
class zernikemap(surfacemap):
def __init__(self, name, size, step_size, radius, scaling=1e-9):
surfacemap.__init__(self, name, "phase", size, (np.array(size)+1)/2.0, step_size, scaling)
surfacemap.__init__(self, name, "phase reflection", size, (np.array(size)+1)/2.0, step_size, scaling)
self.__zernikes = {}
self.radius = radius
......
......@@ -2,7 +2,7 @@ import math
import os.path
import pykat
import collections
from pykat.external.progressbar import ProgressBar, ETA, Percentage, Bar
from itertools import combinations_with_replacement as combinations
from pykat.optics.gaussian_beams import beam_param, HG_beam
......
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