Ignore:
Timestamp:
09/23/12 19:36:18 (12 years ago)
Author:
neise
Message:
added destructor to SlowData and checked if constructor file path exists
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/pyfact/pyfact.py

    r14406 r14422  
    461461import ctypes
    462462
    463 class SlowData( FactFits ):
     463class SlowData( object ):
    464464    """ -Fact SlowData File-
    465465
     
    471471        * variable table column access, thus possibly increased speed while looping
    472472    """
     473    def __del__(self):
     474        del self.f
     475   
    473476    def __init__(self, path):
    474477        """ creates meta and columns dictionaries
    475478        """
     479        import os
     480       
     481        if not os.path.exists(path):
     482            raise IOError(path+' was not found')
    476483        self.path = path
    477484        self.__module__ = 'pyfact'
    478485        try:
    479             FactFits.__init__(self,path)
     486            self.f = FactFits(path)
    480487        except IOError:
    481488            print 'problem accessing data file: ', data_file_name
     
    507514                value: tuple( numerical value, string comment)
    508515        """
     516        # abbreviation
     517        f = self.f
     518       
    509519        # intermediate variables for file metadata dict generation
    510         keys=self.GetPy_KeyKeys()
    511         values=self.GetPy_KeyValues()
    512         comments=self.GetPy_KeyComments()
    513         types=self.GetPy_KeyTypes()
     520       
     521        keys=f.GetPy_KeyKeys()
     522        values=f.GetPy_KeyValues()
     523        comments=f.GetPy_KeyComments()
     524        types=f.GetPy_KeyTypes()
    514525       
    515526        if len(keys) != len(values):
     
    555566                    unit - string like 'mV' or 'ADC count'
    556567        """
     568        # abbreviation
     569        f = self.f
     570       
    557571        # intermediate variables for file table-metadata dict generation
    558         keys=self.GetPy_ColumnKeys()
     572        keys=f.GetPy_ColumnKeys()
    559573        #offsets=self.GetPy_ColumnOffsets() #not needed on python level...
    560         nums=self.GetPy_ColumnNums()
    561         sizes=self.GetPy_ColumnSizes()
    562         types=self.GetPy_ColumnTypes()
    563         units=self.GetPy_ColumnUnits()
     574        nums=f.GetPy_ColumnNums()
     575        sizes=f.GetPy_ColumnSizes()
     576        types=f.GetPy_ColumnTypes()
     577        units=f.GetPy_ColumnUnits()
    564578   
    565579        # zip the values
     
    675689       
    676690        # Set the Pointer Address
    677         self.SetPtrAddress(colname, local)
     691        f.SetPtrAddress(colname, local)
    678692        self._table_cols[colname] = local
    679693        if number_of_elements > 1:
     
    764778            returns self
    765779        """
     780        # abbreviaition
     781        f = self.f
     782       
    766783        # Here one might check, if looping makes any sense, and if not
    767784        # one could stop looping or so...
     
    771788        #   print 'warning: looping without any registered columns'
    772789        if self._current_row < self.number_of_rows:
    773             if self.GetNextRow() == False:
     790            if f.GetNextRow() == False:
    774791                raise StopIteration
    775792            for col in self._registered_cols:
Note: See TracChangeset for help on using the changeset viewer.