From f21f1be64252daf196787b9462273819c1794ba1 Mon Sep 17 00:00:00 2001 From: Yngve Inntjore Levinsen <Yngve.Levinsen@esss.se> Date: Mon, 20 Oct 2014 11:37:23 +0200 Subject: [PATCH] documentation moved fix for python 2.6 (SLC6) --- ess/TraceWin.py | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/ess/TraceWin.py b/ess/TraceWin.py index 0dced8a..c198930 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] -- GitLab