<commit_before>#!/usr/bin/env python

"""
Real time sensor interface. Initializes N number of ports for use by a data field that maps to an array. 
"""

import warnings
warnings.filterwarnings("ignore")
import numpy as np

from neurokernel.base import PORT_DATA, PORT_CTRL
from neurokernel.core import Module

from neurokernel.plsel import SelectorMethods
from neurokernel.tools.comm import get_random_port

class io_interface(Module):
    
    def __init__(self, num_ports, id, device, port_data, port_ctrl, port_time):

        self.num_ports = num_ports
        self._cached_data = np.zeros(num_ports)
        '''
        FOR TESTING
        '''
        self._cached_data.fill(60)
        self.selector_array = []

        #generate output ports
        for i in xrange(0, num_ports):
            selector_name = '/' + id + '/out/gpot/' + str(i)
            self.selector_array.append(selector_name)

        selector_in_string = ','.join(self.selector_array)

        #generate input ports
        selector_out_string = '/' + id+'/in/gpot/0'
        self.selector_array.append(selector_out_string)

        selector_total_string = ','.join(self.selector_array)

        count = len(self.selector_array)

        super(io_interface, self).__init__(selector_total_string, selector_in_string, selector_out_string, sel_gpot = selector_total_string, sel_spike='', data_gpot=np.zeros(count, np.float64), data_spike = [], columns=['interface', 'io', 'type'], port_data=port_data, port_ctrl=port_ctrl, port_time=port_time, id=id, device=device)

        for selector_name in self.selector_array:
            self.interface[selector_name, 'io', 'type'] = ['out', 'gpot']
        
        self.interface[selector_out_string, 'io', 'type'] = ['in', 'gpot']<commit_msg>Attempted to fix neurokernel LPU_1 processing - didn't work'<commit_after>#!/usr/bin/env python

"""
Real time sensor interface. Initializes N number of ports for use by a data field that maps to an array. 
"""

import warnings
warnings.filterwarnings("ignore")
import numpy as np

from neurokernel.base import PORT_DATA, PORT_CTRL
from neurokernel.core import Module

from neurokernel.plsel import SelectorMethods
from neurokernel.tools.comm import get_random_port

class io_interface(Module):
    
    def __init__(self, num_ports, id, device, port_data, port_ctrl, port_time):

        self.num_ports = num_ports
        self._cached_data = np.zeros(num_ports)
        '''
        FOR TESTING
        '''
        #self._cached_data.fill(60)
        self.selector_array = []

        #generate output ports
        for i in xrange(0, num_ports):
            selector_name = '/' + id + '/out/gpot/' + str(i)
            self.selector_array.append(selector_name)

        selector_in_string = ','.join(self.selector_array)

        #generate input ports
        selector_out_string = '/' + id+'/in/gpot/0'
        self.selector_array.append(selector_out_string)

        selector_total_string = ','.join(self.selector_array)

        count = len(self.selector_array)

        super(io_interface, self).__init__(selector_total_string, selector_in_string, selector_out_string, sel_gpot = selector_total_string, sel_spike='', data_gpot=np.zeros(count, np.float64), data_spike = [], columns=['interface', 'io', 'type'], port_data=port_data, port_ctrl=port_ctrl, port_time=port_time, id=id, device=device)

        for selector_name in self.selector_array:
            self.interface[selector_name, 'io', 'type'] = ['out', 'gpot']
        
        self.interface[selector_out_string, 'io', 'type'] = ['in', 'gpot']
{'fraction_non_alphanumeric': 0.11428571428571428, 'fraction_numerical': 0.0036414565826330533, 'mean_word_length': 3.4526184538653366, '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': '1665877', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1098, 'n_words': 248}