Skip to content

Commit

Permalink
Remove templates that have become unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Stimberg committed Oct 8, 2013
1 parent 45411be commit 6d43777
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 95 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions brian2/codegen/runtime/weave_rt/templates/synaptic_stateupdate.cpp

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion brian2/core/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def calc_indices(self, item):
variable = self.variable
if variable.scalar:
if not (item == slice(None) or item == 0 or (hasattr(item, '__len__')
and len(i) == 0)):
and len(item) == 0)):
raise IndexError('Variable is a scalar variable.')
indices = np.array([0])
else:
Expand Down
8 changes: 1 addition & 7 deletions brian2/groups/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ class Group(BrianObject):
def _enable_group_attributes(self):
if not hasattr(self, 'variables'):
raise ValueError('Classes derived from Group need variables attribute.')
if not hasattr(self, 'indices'):
self.indices = {}
if not hasattr(self, 'variable_indices'):
self.variable_indices = defaultdict(lambda: '_idx')
if not hasattr(self, 'codeobj_class'):
self.codeobj_class = None
if not hasattr(self, 'templates'):
self.templates = {}
self._group_attribute_access_active = True

def _create_variables(self):
Expand Down Expand Up @@ -183,11 +179,9 @@ def _get_with_code(self, variable_name, variable, code, level=0):
abstract_code += '_cond = ' + code
check_code_units(abstract_code, self,
additional_namespace=additional_namespace)
template = self.templates.get('index_with_code',
'state_variable_indexing')
codeobj = create_runner_codeobj(self,
abstract_code,
template,
'state_variable_indexing',
additional_variables=variables,
additional_namespace=additional_namespace,
)
Expand Down
11 changes: 1 addition & 10 deletions brian2/synapses/synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class StateUpdater(GroupCodeRunner):
def __init__(self, group, method):
self.method_choice = method
GroupCodeRunner.__init__(self, group,
'synaptic_stateupdate',
'stateupdate',
when=(group.clock, 'groups'),
name=group.name + '_stateupdater',
check_units=False)
Expand Down Expand Up @@ -160,8 +160,6 @@ def __init__(self, synapses, code, prepost, objname=None):
#: The simulation dt (necessary for the delays)
self.dt = self.synapses.clock.dt_

self.indices = self.synapses.indices

# Enable access to the delay attribute via the specifier
self._enable_group_attributes()

Expand Down Expand Up @@ -423,11 +421,6 @@ def __init__(self, source, target=None, model=None, pre=None, post=None,
self._queues = {}
self._delays = {}

# Make use of a special template when setting/indexing variables with
# code in order to allow references to pre- and postsynaptic variables
self.templates = {'set_with_code': 'synaptic_variable_set',
'index_with_code': 'state_variable_indexing'}

# Setup variables
self.variables = self._create_variables()

Expand All @@ -441,8 +434,6 @@ def __init__(self, source, target=None, model=None, pre=None, post=None,
# it gets automatically resized
self.register_variable(var)

self.indices = {}

#: List of names of all updaters, e.g. ['pre', 'post']
self._synaptic_updaters = []
for prepost, argument in zip(('pre', 'post'), (pre, post)):
Expand Down

0 comments on commit 6d43777

Please sign in to comment.