Commit 12b5e783 authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing squeezing of output arrays

parent 903088e1
......@@ -182,21 +182,24 @@ class katRun(object):
def __getitem__(self, value):
idx = [i for i in range(len(self.ylabels)) if self.ylabels[i].split()[0] == str(value)]
if len(idx) > 0:
out = self.y[:, idx]
if self.yaxis == "abs:deg":
out = self.y[:, idx[0]] * np.exp(1j*math.pi*self.y[:, idx[1]]/180.0)
elif self.yaxis == "re:im":
out = self.y[:, idx[0]] + 1j*self.y[:, idx[1]]
out.squeeze()
if len(idx) == 1:
if self.yaxis == "abs:deg":
out = self.y[:, idx[0]]
elif self.yaxis == "re:im":
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)
elif self.yaxis == "re:im":
out = self.y[:, idx[0]] + 1j*self.y[:, idx[1]]
if out.size == 1:
return out[0]
return out[0].squeeze()
else:
return out
return out.squeeze()
else:
raise pkex.BasePyKatException("No output by the name '{0}' found in the output".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