diff --git a/ess/TraceWin.py b/ess/TraceWin.py index 0dced8a34d3c7feb8c2dc282b627962fec8f5e9b..c198930a68b6e7470c8c00141dec7855a43c4f98 100644 --- a/ess/TraceWin.py +++ b/ess/TraceWin.py @@ -1,19 +1,19 @@ class dst: + ''' + Simple class to read in a + TraceWin distribution file + + Class afterwards hold the following + dictionary items: + - x [cm] + - xp [rad] + - y [cm] + - yp [rad] + - phi [rad] + - E [MeV] + ''' def __init__(self, filename): - ''' - Simple class to read in a - TraceWin distribution file - - Class afterwards hold the following - dictionary items: - - x [cm] - - xp [rad] - - y [cm] - - yp [rad] - - phi [rad] - - E [MeV] - ''' # easy storage.. self.filename=filename # used to create dict behaviour.. @@ -22,9 +22,7 @@ class dst: self._readBinaryFile() def _readBinaryFile(self): - ''' - Thanks Emma! - ''' + # Thanks Emma! import numpy @@ -46,14 +44,12 @@ class dst: Table=numpy.fromfile(fin, dtype=numpy.float64, count=self.Np*6) self._data=Table.reshape(self.Np,6) - Footer=numpy.fromfile(fin, dtype='f64', count=1) + Footer=numpy.fromfile(fin, dtype=numpy.float64, count=1) self.mass=Footer[0] def __getitem__(self, key): - ''' - makes the class function as a dictionary - e.g. dst['x'] returns the x array.. - ''' + # makes the class function as a dictionary + # e.g. dst['x'] returns the x array.. if key in self._columns: i=self._columns.index(key) return self._data[:,i]