def __init__(self, prb=None, fetfile=None): if prb is not None: self.prb = prb self.ngrp = prb.n_group # self.group_idx = np.array(list(self.prb.grp_dict.keys())) self.fpga = xike_config(self.prb) else: self.ngrp = 40 # by default self.fpga = xike_config() # by default print('{} groups on probe'.format(self.ngrp)) print('{} groups is configured in the FPGA: {}'.format( len(self.fpga.configured_groups), self.fpga.configured_groups)) print( '{} neurons are configured in the FPGA'.format(self.fpga.n_units + 1)) print('---1. BMI spike-model initiation succeed---\n') if fetfile is not None: self.init_bmi_packet_channel() self.fetfile = fetfile self.fd = os.open(self.fetfile, os.O_CREAT | os.O_WRONLY | os.O_NONBLOCK) print('spike-id and feature is saved to {}\n'.format(self.fetfile)) self.binner = None
def check_fpga(prbfile, var): prb = probe() prb.load(prbfile) prb.n_ch = 160 prb.fs = 25000. fpga = xike_config(prb) if var in dir(fpga): exec('print(fpga.{})'.format(var))
def fpga_detector(cmd): ''' set detector params: `spiketag fpga-detector thres==-500` `spiketag fpga-detector ch_ref==-14` ''' click.echo('set FPGA detector {} '.format(cmd)) from spiketag.fpga import xike_config fpga = xike_config() exec('fpga.{}'.format(cmd))
def fpga_check(var): ''' check fpga params: `spiketag fpga-check` ''' click.echo('check FPGA') from spiketag.fpga import xike_config fpga = xike_config() if var in dir(fpga): exec('print(fpga.{})'.format(var))
def fpga(probefile): ''' init fpga with probe file: `spiketag fpga prb.json` ''' click.echo('init FPGA with probe file {}'.format(probefile)) from spiketag.fpga import xike_config from spiketag.base import probe prb = probe() prb.load(probefile) prb.show() fpga = xike_config(prb) click.echo('init FPGA success, check fpga with "spiketag fpga-check"')
def FPGA(line): print(line) from spiketag.fpga import xike_config fpga = xike_config() return fpga # @magics_class # class SPIKETAG_MAGIC(Magics): # @line_magic # def fpga(self, line): # from spiketag.fpga import xike_config # fpga = xike_config() # return fpga # @cell_magic # def cadabra(self, line, cell): # return line, cell