<commit_before>from brian import *
from brian.tools.datamanager import *
import sys
import neurotools as nt


def load_data(dirname):
    dataman = DataManager(dirname)
    voltage = []
    output_spikes = []
    input_rate = []
    jitter = []
    sync = []
    num_inputs = []
    weight = []
    for data in dataman.itervalues():
        if not len(data):
            continue
        voltage.append(data['mem'])
        output_spikes.append(data['output_spikes'])
        input_rate.append(data['f_in'])
        jitter.append(data['jitter'])
        sync.append(data['sync'])
        num_inputs.append(data['N_in'])
        weight.append(data['w_in'])
    flatdata = {
            'mem': voltage,
            'output_spikes': output_spikes,
            'input_rate': input_rate,
            'jitter': jitter,
            'sync': sync,
            'num_inputs': num_inputs,
            'input_weight': weight,
            }
    return flatdata

def calculate_slopes(data):
    npss = []
    mems = data['mem']
    output_spikes = data['output_spikes']
    for v, spikes in zip(mems, output_spikes):
        npss.append(nt.norm_firing_slope(v[0], spikes[0],
            th=15*mV, tau=10*ms, dt=0.1*ms, w=2*ms)[0])
    return npss

def aggregate_slopes(data):
    npss = data['slopes']
    sync = data['sync']
    jitter = data['jitter']
    sync_range = sorted(unique(sync))<commit_msg>Calculate multivariate spike distance (Kreuz) too<commit_after>from brian import *
from brian.tools.datamanager import *
import sys
import spike_distance_kreuz as sd
import neurotools as nt


def load_data(dirname):
    dataman = DataManager(dirname)
    voltage = []
    output_spikes = []
    input_rate = []
    input_spikes = []
    jitter = []
    sync = []
    num_inputs = []
    weight = []
    for data in dataman.itervalues():
        if not len(data):
            continue
        voltage.append(data['mem'])
        output_spikes.append(data['output_spikes'])
        input_rate.append(data['f_in'])
        jitter.append(data['jitter'])
        sync.append(data['sync'])
        num_inputs.append(data['N_in'])
        weight.append(data['w_in'])
        input_spikes.append(data['input_spikes'])
    flatdata = {
            'mem': voltage,
            'output_spikes': output_spikes,
            'input_rate': input_rate,
            'jitter': jitter,
            'sync': sync,
            'num_inputs': num_inputs,
            'input_weight': weight,
            'input_spikes': input_spikes,
            }
    return flatdata

def calculate_slopes(data):
    npss = []
    mems = data['mem']
    output_spikes = data['output_spikes']
    for v, spikes in zip(mems, output_spikes):
        npss.append(nt.norm_firing_slope(v[0], spikes[0],
            th=15*mV, tau=10*ms, dt=0.1*ms, w=2*ms)[0])
    return npss

def calculate_dist(data):
    '''
    Calculate spike train distance using Kreuz spike distance
    '''
    input_spikes = data['input_spikes']
    t, Sb = sd.multivariate_spike_distance(input_spikes, 0, 2.0, 1000)
    return t, Sb

def aggregate_slopes(data):
    npss = data['slopes']
    sync = data['sync']
    jitter = data['jitter']
    sync_range = sorted(unique(sync))
{'fraction_non_alphanumeric': 0.13216410898841216, 'fraction_numerical': 0.00845599749451926, 'mean_word_length': 2.560758082497213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6706720', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1052, 'n_words': 205}