def configurar(canales, tipo_canal, frecuencia, repeticiones): ch_types = [] ch_names = [] sfreq = frecuencia rand = randint(3, 5) contador = repeticiones * (8 + rand) #plt.ion( ) #fig, fig_axes = plt.subplots(nrows=canales, ncols=1, constrained_layout=True, sharex=True) fig_axes = 0 global amp available_amps = libmushu.get_available_amps() print available_amps ampname = available_amps[0] amp = libmushu.get_amp(GUSBamp) #amp = AmpDecorator(GUSBamp) #amp.configure(fs=frecuencia, channels=canales) nombre = time.asctime() nombre = nombre.replace(':',' ') tipo_canal = tipo_canal.lower() for i in range(0, canales + 2): if i < canales: ch_types.append(str(tipo_canal)) if i >= canales: ch_types.append('stim') tipo_canal = tipo_canal.upper() for i in range(0, canales + 2): if i < canales: ch_names.append(str(tipo_canal) + ' 00' + str(i + 1)) if i > canales: ch_names.append('STI 014') if i == canales + 1: ch_names.append('MK 000') info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types) return info, nombre, fig_axes, contador
def __init__(self, master): self.amp_started = False ttk.Frame.__init__(self, master) self.master.title('Mushu') self.pack() self.available_amps = libmushu.get_available_amps() frame = tk.Frame(self) frame.pack(fill=tk.BOTH, expand=1) self.label1 = ttk.Label(frame, text='Select Amplifier') self.label1.grid(column=0, row=0, sticky='we') self.amp_combobox = ttk.Combobox( frame, values=[str(i) for i in self.available_amps]) self.amp_combobox.grid(column=0, row=1, sticky='we') self.amp_combobox.bind("<<ComboboxSelected>>", self.on_amplifier_selected) self.label2 = ttk.Label(frame, text='Select Configuration Preset') self.label2.grid(column=1, row=0, sticky='we') self.config_combobox = ttk.Combobox(frame) self.config_combobox.grid(column=1, row=1, sticky='we') self.config_combobox.bind("<<ComboboxSelected>>", self.onComboboxSelected) self.label3 = ttk.Label(frame, text='Start/Stop Amplifier') self.label3.grid(column=2, row=0, sticky='we') self.start_stop_button = ttk.Button( frame, text='Start', command=self.onStartStopButtonClicked) self.start_stop_button.grid(column=2, row=1, sticky='we') # set up the figure fig = Figure() self.canvas = FigureCanvas(fig, master=self.master) self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1) self.canvas.show() self.axis = fig.add_subplot(111) # self.PAST_POINTS = 256 self.PAST_POINTS = 5000 * 3 self.SCALE = 30000 self.channels = [] self.n_channels = 0 self.init_plot() self.master.after_idle(self.visualizer)
def __init__(self, master): self.amp_started = False ttk.Frame.__init__(self, master) self.master.title('Mushu') self.pack() self.available_amps = libmushu.get_available_amps() frame = tk.Frame(self) frame.pack(fill=tk.BOTH, expand=1) self.label1 = ttk.Label(frame, text='Select Amplifier') self.label1.grid(column=0, row=0, sticky='we') self.amp_combobox = ttk.Combobox(frame, values=[str(i) for i in self.available_amps]) self.amp_combobox.grid(column=0, row=1, sticky='we') self.amp_combobox.bind("<<ComboboxSelected>>", self.on_amplifier_selected) self.label2 = ttk.Label(frame, text='Select Configuration Preset') self.label2.grid(column=1, row=0, sticky='we') self.config_combobox = ttk.Combobox(frame) self.config_combobox.grid(column=1, row=1, sticky='we') self.config_combobox.bind("<<ComboboxSelected>>", self.onComboboxSelected) self.label3 = ttk.Label(frame, text='Start/Stop Amplifier') self.label3.grid(column=2, row=0, sticky='we') self.start_stop_button = ttk.Button(frame, text='Start', command=self.onStartStopButtonClicked) self.start_stop_button.grid(column=2, row=1, sticky='we') # set up the figure fig = Figure() self.canvas = FigureCanvas(fig, master=self.master) self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1) self.canvas.show() self.axis = fig.add_subplot(111) self.PAST_POINTS = 256 self.SCALE = 30000 self.channels = [] self.n_channels = 0 self.init_plot() self.master.after_idle(self.visualizer)
import libmushu # look for amplifiers connected to the system, and return a list of the # respective classes available_amps = libmushu.get_available_amps() # select the first available amp and decorate it with tcp-marker- and # save-to-file-functionality ampname = available_amps[0] amp = libmushu.get_amp(ampname) # configure the amplifier # amp.configure(cfg) # start it and collect data until finished amp.start() while 1: data, trigger = amp.get_data() # stop the amplifier amp.stop()
import libmushu # look for amplifiers connected to the system, and return a list of the # respective classes available_amps = libmushu.get_available_amps() # select the first available amp and decorate it with tcp-marker- and # save-to-file-functionality ampname = available_amps[0] amp = libmushu.get_amp(ampname) # configure the amplifier amp.configure(cfg) # start it and collect data until finished amp.start() while 1: data, trigger = amp.get_data() # stop the amplifier amp.stop()