Show
Ignore:
Timestamp:
02/16/10 10:59:22 (2 years ago)
Author:
apdavison
Message:

Moved Error classes out of common into an errors module (see ticket:157)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/pcsim/simulator.py

    r702 r711  
    3030import types 
    3131import numpy 
    32 from pyNN import common 
     32from pyNN import common, errors 
    3333 
    3434recorder_list = [] 
     
    156156            cellfactory = cellclass(**cellparams) 
    157157        else: 
    158             raise common.InvalidModelError("Trying to create non-existent cellclass %s" % cellclass.__name__) 
     158            raise errors.InvalidModelError("Trying to create non-existent cellclass %s" % cellclass.__name__) 
    159159    else: 
    160         raise common.InvalidModelError("Trying to create non-existent cellclass %s" % cellclass) 
     160        raise errors.InvalidModelError("Trying to create non-existent cellclass %s" % cellclass) 
    161161 
    162162    all_ids = numpy.array([i for i in net.add(cellfactory, n)], ID) 
     
    275275        if not isinstance(source, (int, long)) or source < 0: 
    276276            errmsg = "Invalid source ID: %s" % source 
    277             raise common.ConnectionError(errmsg) 
     277            raise errors.ConnectionError(errmsg) 
    278278        if not common.is_listlike(targets): 
    279279            targets = [targets] 
     
    285285        for target in targets: 
    286286            if not isinstance(target, common.IDMixin): 
    287                 raise common.ConnectionError("Invalid target ID: %s" % target) 
     287                raise errors.ConnectionError("Invalid target ID: %s" % target) 
    288288        assert len(targets) == len(weights) == len(delays), "%s %s %s" % (len(targets),len(weights),len(delays)) 
    289289        if common.is_conductance(targets[0]): 
     
    300300            syn_factory = synapse_type 
    301301        else: 
    302             raise common.ConnectionError("synapse_type must be a string or a PCSIM synapse factory. Actual type is %s" % type(synapse_type)) 
     302            raise errors.ConnectionError("synapse_type must be a string or a PCSIM synapse factory. Actual type is %s" % type(synapse_type)) 
    303303        for target, weight, delay in zip(targets, weights, delays): 
    304304            syn_factory.W = weight*weight_scale_factor 
     
    307307                c = net.connect(source, target, syn_factory) 
    308308            except RuntimeError, e: 
    309                 raise common.ConnectionError(e) 
     309                raise errors.ConnectionError(e) 
    310310            if target.local: 
    311311                self.connections.append(Connection(source, target, net.object(c), 1.0/weight_scale_factor))