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

adding more selection options for when 1d and 2d data is available for multiple outputs

parent 6235dc9d
...@@ -24,9 +24,10 @@ kat.parseCommands(code) ...@@ -24,9 +24,10 @@ kat.parseCommands(code)
kat.add(cavity('cav1', 'm1', 'n3', 'm2', 'n4')) kat.add(cavity('cav1', 'm1', 'n3', 'm2', 'n4'))
kat.add(photodiode('pd_cav','n4',num_demods=1, demods=[1]))
kat.add(photodiode('pd_ref','n2')) kat.add(photodiode('pd_ref','n2'))
kat.add(photodiode('pd_trs','n5')) kat.add(photodiode('pd_trs','n5'))
kat.add(photodiode('pd_cav','n4', num_demods=1, demods=[1]))
kat.add(xaxis("lin", [0, 360], kat.m2, kat.m2.phi, 100)) kat.add(xaxis("lin", [0, 360], kat.m2, kat.m2.phi, 100))
...@@ -41,7 +42,6 @@ out = kat.run(printout=0,printerr=0) ...@@ -41,7 +42,6 @@ out = kat.run(printout=0,printerr=0)
pl.figure() pl.figure()
pl.plot(out.x, out["pd_cav"]) pl.plot(out.x, out["pd_cav"])
pl.plot(out.x, out["pd_ref"])
pl.xlabel(out.xlabel) pl.xlabel(out.xlabel)
pl.ylabel("Intensity [W]") pl.ylabel("Intensity [W]")
pl.legend(out.ylabels) pl.legend(out.ylabels)
......
...@@ -73,11 +73,13 @@ class katRun(object): ...@@ -73,11 +73,13 @@ class katRun(object):
idx = [i for i in range(len(self.ylabels)) if self.ylabels[i].split(" ")[0] == str(value)] idx = [i for i in range(len(self.ylabels)) if self.ylabels[i].split(" ")[0] == str(value)]
if len(idx) == 1 and len(self.y.shape) == 1: if len(idx) == 1 and len(self.y.shape) == 1:
return self.y.squeeze() return self.y
elif len(idx) > 0 and len(self.y.shape) == 1:
return self.y[idx]
elif len(idx) > 0: elif len(idx) > 0:
return self.y[:,idx].squeeze() return self.y[:,idx].squeeze()
elif len(idx) == 1: elif len(idx) == 1:
return self.y[idx].squeeze() return self.y[:,idx].squeeze()
else: else:
raise pkex.BasePyKatException("No output by the name {0} found".format(str(value))) raise pkex.BasePyKatException("No output by the name {0} found".format(str(value)))
......
Supports Markdown
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