<commit_before>"""
Utility functions for pulse2percept
"""
import numpy as np


class Parameters(object):
    def __init__(self, **params):
        for k, v in params.items():
            self.__dict__[k] = v

    def __repr__(self):
        my_list = []
        for k, v in self.__dict__.items():
            my_list.append("%s : %s" % (k, v))
        my_list.sort()
        my_str = "\n".join(my_list)
        return my_str

    def __setattr(self, name, value):
        self.__dict__[name] = values

def sparseconv(v,a):
    """Returns the discrete, linear convolution of two one-dimensional sequences.
       output is of length v
       
       Runs faster than numpy.convolve if:
       (1) a is longer than v (v is typically the kernel, a is the input to the system)
       (2) a is sparse (has lots of zeros)
    """       
    na = len(a)
    nv = len(v)
    
    # find the indices into a (a should be sparse)
    pos = np.where(a != 0)[0]
    
    # zero the output - same length as a
    out = np.zeros(na)<commit_msg>modified sparseconv to return padded output (length na+nv-1)<commit_after>"""
Utility functions for pulse2percept
"""
import numpy as np


class Parameters(object):
    def __init__(self, **params):
        for k, v in params.items():
            self.__dict__[k] = v

    def __repr__(self):
        my_list = []
        for k, v in self.__dict__.items():
            my_list.append("%s : %s" % (k, v))
        my_list.sort()
        my_str = "\n".join(my_list)
        return my_str

    def __setattr(self, name, value):
        self.__dict__[name] = values

def sparseconv(v,a):
    """Returns the discrete, linear convolution of two one-dimensional sequences.
       output is of length len(v) + len(a) -1 (same as the default for numpy.convolve)
       
       Runs faster than numpy.convolve if:
       (1) a is longer than v (v is typically the kernel, a is the input to the system)
       (2) a is sparse (has lots of zeros)
    """       
    na = len(a)
    nv = len(v)
    
    # find the indices into a (a should be sparse)
    pos = np.where(a != 0)[0]
    
    # zero the output - same length as a
    out = np.zeros(na+nv-1)
{'fraction_non_alphanumeric': 0.11474654377880185, 'fraction_numerical': 0.005990783410138249, 'mean_word_length': 2.1973490427098676, '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': '6461993', 'n_tokens_mistral': 713, 'n_tokens_neox': 690, 'n_words': 246}