diff --git a/bin/test_2d_plot.py b/bin/test_2d_plot.py index b178319bdd7dd9de0f0c794110675c9f758741f6..82d95e7feb27e6a882a0c15e5b568eeff554c2d8 100644 --- a/bin/test_2d_plot.py +++ b/bin/test_2d_plot.py @@ -33,14 +33,14 @@ out = kat.run(printout=0,printerr=0) fig = pl.figure() ax = fig.add_subplot(1, 1, 1, projection='3d') x, y = np.meshgrid(out.x, out.y) -p = ax.plot_wireframe(x, y, out.z[1]) +p = ax.plot_wireframe(x, y, out["b1"]) pl.xlabel(out.xlabel) pl.ylabel(out.ylabel) pl.show() pl.figure() extent = [np.min(out.x),np.max(out.x),np.min(out.y),np.max(out.y)] -imgplot = pl.imshow(out.z[1], extent=extent) +imgplot = pl.imshow(out["b1"], extent=extent) #imgplot.set_interpolation('bicubic') imgplot.set_interpolation('nearest') pl.colorbar() diff --git a/pykat/components.py b/pykat/components.py index 87df724edc04092b694f4be388650bafbe1fb23d..25ab3134b9efce4b94a42a395c8b102bee55ed30 100644 --- a/pykat/components.py +++ b/pykat/components.py @@ -143,6 +143,8 @@ class Component(object): @property def id(self): return self.__id + def __str__(self): return self.name + class Param(float): def __new__(self,name,value): return float.__new__(self,SIfloat(value)) diff --git a/pykat/detectors.py b/pykat/detectors.py index f66dc9510e92ec0df335d3e4c51488c78b01ccfb..1f0384c2f343eb7b0700405494a61e4950ba9079 100644 --- a/pykat/detectors.py +++ b/pykat/detectors.py @@ -43,12 +43,12 @@ class Detector(object) : @property def node(self): return self.__node - - def __getname(self): - return self.__name - - name = property(__getname) + + @property + def name(self): return self.__name + def __str__(self): return self.name + class photodiode(Detector): class __F(list): diff --git a/pykat/finesse.py b/pykat/finesse.py index 6e5b336051c395c0e62ccfa8a473d7a146787e90..1a2d53dbd40365fb4547c3ff3390990cf173f709 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -103,12 +103,12 @@ class katRun2D(object): def get(self, value): return self[value] def __getitem__(self, value): - idx = [i for i in range(len(self.zlabels)) if self.zlabels[i].split(" ")[0] == value] + idx = [i for i in range(len(self.zlabels)) if self.zlabels[i].split(" ")[0] == str(value)] if len(idx) > 0: - return self.z[:, idx].squeeze() + return self.z[idx].squeeze() else: - raise pkex.BasePyKatException("No output by the name {0} found".format(value)) + raise pkex.BasePyKatException("No output by the name {0} found".format(str(value))) class Block: def __init__(self, name):