Skip to content
Snippets Groups Projects
Commit f25ea454 authored by Daniel Brown's avatar Daniel Brown
Browse files

udpdating setup files and requirements. Fixing and simplifying the output...

udpdating setup files and requirements. Fixing and simplifying the output select from a kat_run object. Internally it always stores output data as a 2d array, even if noxaxis is used. This simplifies the selection of output data greatly
parent d782c295
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,8 @@ as shown next::
m m2 0.5 0.5 0 n4 n5
s s3 10 1 n5 n6
pd pd_cav n4
xaxis m1 phi lin 0 360 360
yaxis abs:deg
"""
......
__version__ = "0.3.1"
__version__ = "0.4.3"
#__all__ = ['finesse', 'components', 'detectors', 'commands']
import finesse
import components
import detectors
......
......@@ -104,24 +104,14 @@ 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 and self.y.shape == ():
# In the case we have a noxaxis and just one output...
return float(self.y)
elif len(idx) == 1 and len(self.y.shape) == 1:
# only selecting a single output from a 1D array
if self.y.size == 1:
return self.y
else:
return self.y[idx[0]]
if len(idx) > 0:
out = self.y[:, idx]
elif len(idx) > 0 and len(self.y.shape) == 1:
return self.y[idx]
elif len(idx) > 0:
return self.y[:,idx].squeeze()
elif len(idx) >= 1:
return self.y[:,idx].squeeze()
if out.size == 1:
return float(out)
else:
return out.squeeze()
else:
raise pkex.BasePyKatException("No output by the name '{0}' found in the output".format(str(value)))
......@@ -899,6 +889,10 @@ class kat(object):
data = np.loadtxt(filename, comments='%',skiprows=4)
# convert 1D arrays into 2D ones for simpler selection
if len(data.shape) == 1:
data = np.array([data])
if hasattr(self, "x2axis"):
# need to parse 2D outputs slightly different as they are effectively 2D matrices
# written in linear form
......@@ -913,16 +907,10 @@ class kat(object):
else:
shape_len = len(data.shape)
if shape_len > 1:
rows,cols = data.shape
x = data[:,0]
y = data[:,1:cols].squeeze()
else:
rows = 1
cols = data.shape[0]
x = data[0]
y = data[1:cols].squeeze()
x = data[:,0]
y = data[:,1:cols]
return [x, y, hdr]
......
PyQt >= 4.8.0
numpy >= 1.6.2
flask >= 0.10.1
\ No newline at end of file
......@@ -14,7 +14,7 @@ setup(
version=pykat.__version__,
author='Daniel Brown',
author_email='ddb@star.sr.bham.ac.uk',
packages=['pykat','pykat.gui','pykat.gui.resources','pykat.testing','pykat.testing.web'],
packages=['pykat','pykat.gui','pykat.gui.resources','pykat.testing','pykat.testing.web','pykat.utilities','pykat.utilities.optics'],
url='http://pypi.python.org/pypi/PyKat/',
license='GPL v2',
description='Python interface and tools for FINESSE',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment