File: spikemonitor.py_

package info (click to toggle)
brian 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,872 kB
  • sloc: python: 51,820; cpp: 2,033; makefile: 108; sh: 72
file content (32 lines) | stat: -rw-r--r-- 1,170 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{# USES_VARIABLES {N, count, _clock_t, _source_start, _source_stop, _source_N} #}
{% extends 'common_group.py_' %}

{% block maincode %}

{#  Get the name of the array that stores these events (e.g. the spikespace array) #}
{% set _eventspace = get_array_name(eventspace_variable) %}

_n_events = {{_eventspace}}[-1]
if _n_events > 0:
    _events = {{_eventspace}}[:_n_events]
    # Take subgroups into account
    if _source_start != 0 or _source_stop != _source_N:
        _events = _events[(_events >= _source_start) & (_events < _source_stop)]
        _n_events = len(_events)

    if _n_events > 0:
        _vectorisation_idx = 1
        {{scalar_code|autoindent}}
        _curlen = {{N}}
        _newlen = _curlen + _n_events
        _owner.resize(_newlen)
        {{N}} = _newlen
        _vectorisation_idx = _events
        _idx = _events
        {{vector_code|autoindent}}
        {% for varname, var in record_variables.items() %}
        {% set dynamic_varname = get_array_name(var, access_data=False) %}
        {{dynamic_varname}}[_curlen:_newlen] = _to_record_{{varname}}
        {% endfor %}
        {{count}}[_events - _source_start] += 1
{% endblock %}