Changeset 400 for trunk

Show
Ignore:
Timestamp:
06/15/09 23:30:10 (3 years ago)
Author:
pierre
Message:

Add dependencies, but mainly optionnal. A particular package, TableIO, speeds up the loading time of big text data files. Could be useful. For the moment, it's only added in io.py as an option, and not even suggested in the dependency, but why not. The other stuffs is the creation of a tisean wrapper. TISEAN is a well-known and famoust toolbox for non linear analysis. Maybe a lot of those functions could be used for SpikeList analysis, and it should be considered, at least for testing purpose, and even better for a real use. TISEAN must be installed, nothing is really done yet for integration, this is just a proposal

Location:
trunk
Files:
3 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/setup.py

    r375 r400  
    99    packages = ['NeuroTools', 
    1010                'NeuroTools.utilities', 
     11                'NeuroTools.tisean', 
    1112                'NeuroTools.spike2', 
    1213                'NeuroTools.signals', 
  • trunk/src/__init__.py

    r394 r400  
    3535""" 
    3636 
    37 __all__ = ['analysis', 'parameters', 'plotting', 'signals', 'stgen', 'io', 'datastore', 'utilities', 'spike2', 'random', 'optimize'] 
     37__all__ = ['analysis', 'parameters', 'plotting', 'signals', 'stgen', 'io', 'datastore', 'utilities', 'spike2', 'random', 'optimize', 'tisean'] 
    3838__version__ = "0.1.0 (Asynchronous Astrocyte)" 
    3939 
  • trunk/src/io.py

    r397 r400  
    158158        Load data from a text file and returns an array of the data 
    159159        """ 
    160         myfile = open(self.filename, "r", DEFAULT_BUFFER_SIZE) 
    161         contents = myfile.readlines() 
    162         myfile.close() 
    163         data = [] 
    164         for line in contents: 
    165             if (line[0] != skipchar): 
    166                 line = line.strip().split(sepchar) 
    167                 id   = [int(float(line[-1]))] 
    168                 id.extend(map(float, line[0:-1])) 
    169                 data.append(id) 
    170         logging.debug("Loaded %d lines of data from %s" % (len(data), self)) 
    171         return numpy.array(data, numpy.float32) 
    172      
     160        try: 
     161            import TableIO 
     162            data = TableIO.readTableAsArray(self.filename, skipchar) 
     163        except ImportError: 
     164            myfile = open(self.filename, "r", DEFAULT_BUFFER_SIZE) 
     165            contents = myfile.readlines() 
     166            myfile.close() 
     167            data = [] 
     168            for line in contents: 
     169                if (line[0] != skipchar): 
     170                    line = line.strip().split(sepchar) 
     171                    id   = [int(float(line[-1]))] 
     172                    id.extend(map(float, line[0:-1])) 
     173                    data.append(id) 
     174            logging.debug("Loaded %d lines of data from %s" % (len(data), self)) 
     175            data = numpy.array(data, numpy.float32) 
     176        return data 
     177 
    173178    #def get_data(self, sepchar = "\t", skipchar = "#"): 
    174179        #return numpy.loadtxt(self.filename, dtype=numpy.float32)