def _run(params): # pragma: no cover controller = TemplateController(**params) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def _run(data_path, **kwargs): # pragma: no cover controller = NeoController(data_path, **kwargs) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def _run(params): controller = TemplateController(**params) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def _run(params): # pragma: no cover controller = TemplateController(**params) gui = controller.create_gui() gui.show() #pdb.set_trace() gd=controller.model.metadata['group'] gtable = controller.supervisor.cluster_view outfile = open('tempData.txt','w') #pdb.set_trace() header = gtable._get_row(list(gd.keys())[0]) headermsg = '' for gid,gel in header.items(): headermsg=headermsg +gid +',' outfile.write(headermsg.strip(', ')+'\n') for icluster in gd.keys(): grow = gtable._get_row(icluster) msg='' #pdb.set_trace() for gid,gel in grow.items(): msg=msg + str(gel) +', ' outfile.write(msg.strip(', ')+'\n') outfile.close() run_app() gui.close() del gui
def kwik_gui(path, channel_group=None, clustering=None, **kwargs): # pragma: no cover """Launch the Kwik GUI.""" assert path create_app() controller = KwikController( path, channel_group=channel_group, clustering=clustering, **kwargs) gui = controller.create_gui() gui.show() run_app() gui.close()
def _run(path, channel_group, clustering): controller = KwikController(path, channel_group=channel_group, clustering=clustering, ) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def _run(path, channel_group, clustering): controller = KwikController( path, channel_group=channel_group, clustering=clustering, ) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def kilosort(dat_path, **kwargs): """Launch the trace GUI on a raw data file.""" create_app() with capture_exceptions(): kwargs['n_channels_dat'] = kwargs.pop('n_channels') kwargs['order'] = 'F' if kwargs.pop('fortran', None) else None creator = KilosortGUICreator(dat_path, **kwargs) gui = creator.create_gui() gui.show() run_app() gui.close()
def template_gui(params_path, **kwargs): # pragma: no cover """Launch the Template GUI.""" # Create a `phy.log` log file with DEBUG level. _add_log_file(Path(params_path).parent / 'phy.log') create_app() controller = TemplateController(**get_template_params(params_path), **kwargs) gui = controller.create_gui() gui.show() run_app() gui.close() controller.model.close()
def cluster_manual(path, channel_group=None, clustering=None): """Launch the Kwik GUI on a Kwik file.""" # Create the Qt application. create_app() controller = KwikController(path, channel_group=channel_group, clustering=clustering, ) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def template_gui(params_path, **kwargs): # pragma: no cover """Launch the Template GUI.""" # Create a `phy.log` log file with DEBUG level. p = Path(params_path) dir_path = p.parent _add_log_file(dir_path / 'phy.log') create_app() controller = TemplateController(model=load_model(params_path), dir_path=dir_path, **kwargs) gui = controller.create_gui() gui.show() run_app() gui.close() controller.model.close()
def template_gui(params_path, **kwargs): # pragma: no cover """Launch the Template GUI.""" # Create a `phy.log` log file with DEBUG level. p = Path(params_path) dir_path = p.parent _add_log_file(dir_path / 'phy.log') model = load_model(params_path) # Automatically export spike waveforms when using compressed raw ephys. if model.spike_waveforms is None and isinstance(model.traces, MtscompEphysReader): # TODO: customizable values below. model.save_spikes_subset_waveforms( max_n_spikes_per_template=500, max_n_channels=16) create_app() controller = TemplateController(model=model, dir_path=dir_path, **kwargs) gui = controller.create_gui() gui.show() run_app() gui.close() controller.model.close()
def trace_gui(dat_path, **kwargs): # pragma: no cover """Launch the Trace GUI. Parameters ---------- dat_path : str or Path Path to the raw data file sample_rate : float The data sampling rate, in Hz. n_channels_dat : int The number of columns in the raw data file. dtype : str The NumPy data type of the raw binary file. """ gui = create_trace_gui(dat_path, **kwargs) gui.show() run_app() gui.close()
def main(argv=None): if argv is None: argv = sys.argv[1:] gheader = Fore.GREEN + get_header() header = gheader + Fore.RESET parser = argparse.ArgumentParser(description=header, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('datafile', help='data file') parser.add_argument('-e', '--extension', help='extension to consider for visualization', default='') if len(argv) == 0: parser.print_help() sys.exit() args = parser.parse_args(argv) filename = os.path.abspath(args.datafile) extension = args.extension params = circus.shared.utils.io.load_parameters(filename) mytest = StrictVersion(phycontrib.__version__) >= StrictVersion("1.0.12") if not mytest: print_and_log(['You need to update phy-contrib to the latest git version'], 'error', params) sys.exit(0) sampling_rate = float(params.getint('data', 'sampling_rate')) data_dtype = params.get('data', 'data_dtype') file_out_suff = params.get('data', 'file_out_suff') data_offset = params.getint('data', 'data_offset') probe = read_probe(params) if extension != '': extension = '-' + extension output_path = params.get('data', 'file_out_suff') + extension + '.GUI' if not os.path.exists(output_path): print_and_log(['Data should be first exported with the converting method!'], 'error', params) else: print_and_log(["Launching the phy GUI..."], 'info', params) gui_params = {} gui_params['dat_path'] = params.get('data', 'data_file') gui_params['n_channels_dat'] = params.getint('data', 'N_total') gui_params['n_features_per_channel'] = 5 gui_params['dtype'] = params.get('data', 'data_dtype') gui_params['offset'] = params.getint('data', 'data_offset') gui_params['sample_rate'] = params.getint('data', 'sampling_rate') gui_params['hp_filtered'] = True os.chdir(output_path) create_app() controller = TemplateController(**gui_params) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def main(argv=None): if argv is None: argv = sys.argv[1:] header = get_colored_header() header += '''Utility to launch the phy GUI and visualize the results. [data must be first converted with the converting mode] ''' parser = argparse.ArgumentParser( description=header, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('datafile', help='data file') parser.add_argument('-e', '--extension', help='extension to consider for visualization', default='') if len(argv) == 0: parser.print_help() sys.exit() args = parser.parse_args(argv) filename = os.path.abspath(args.datafile) extension = args.extension params = CircusParser(filename) if os.path.exists(params.logfile): os.remove(params.logfile) logger = init_logging(params.logfile) logger = logging.getLogger(__name__) if extension != '': extension = '-' + extension try: import traitlets except ImportError: print_and_log( ['The package traitlets required by phy is not installed'], 'error', logger) sys.exit(1) try: import click except ImportError: print_and_log(['The package click required by phy is not installed'], 'error', logger) sys.exit(1) try: import joblib except ImportError: print_and_log(['The package joblib required by phy is not installed'], 'error', logger) sys.exit(1) if HAVE_PHYCONTRIB: mytest = StrictVersion( phycontrib.__version__) >= StrictVersion("1.0.12") if not mytest: print_and_log( ['You need to update phy-contrib to the latest git version'], 'error', logger) sys.exit(1) print_and_log([ 'phy-contrib is deprecated, you should upgrade to phy 2.0 and phylib' ], 'info', logger) if HAVE_PHYLIB: try: import colorcet except ImportError: print_and_log( ['The package colorcet required by phy is not installed'], 'error', logger) sys.exit(1) try: import qtconsole except ImportError: print_and_log( ['The package qtconsole required by phy is not installed'], 'error', logger) sys.exit(1) if not test_patch_for_similarities(params, extension): print_and_log( ['You should re-export the data because of a fix in 0.6'], 'error', logger) continue_anyway = query_yes_no( Fore.WHITE + "Continue anyway (results may not be fully correct)?", default=None) if not continue_anyway: sys.exit(1) data_file = params.get_data_file() data_dtype = data_file.data_dtype if data_file.params.has_key('data_offset'): data_offset = data_file.data_offset else: data_offset = 0 file_format = data_file.description file_out_suff = params.get('data', 'file_out_suff') if file_format not in supported_by_phy: print_and_log([ "File format %s is not supported by phy. TraceView disabled" % file_format ], 'info', logger) if numpy.iterable(data_file.gain): print_and_log( ['Multiple gains are not supported, using a default value of 1'], 'info', logger) gain = 1 else: if data_file.gain != 1: print_and_log([ "Gain of %g is not supported by phy. Expecting a scaling mismatch" % data_file.gain ], 'info', logger) gain = data_file.gain probe = params.probe output_path = params.get('data', 'file_out_suff') + extension + '.GUI' if not os.path.exists(output_path): print_and_log( ['Data should be first exported with the converting method!'], 'error', logger) else: print_and_log(["Launching the phy GUI..."], 'info', logger) gui_params = {} if file_format in supported_by_phy: if not params.getboolean('data', 'overwrite'): gui_params['dat_path'] = r"%s" % params.get( 'data', 'data_file_no_overwrite') else: if params.get('data', 'stream_mode') == 'multi-files': data_file = params.get_data_file(source=True, has_been_created=False) gui_params['dat_path'] = [ r"%s" % f for f in data_file.get_file_names() ] else: gui_params['dat_path'] = r"%s" % params.get( 'data', 'data_file') else: gui_params['dat_path'] = 'giverandomname.dat' gui_params['n_channels_dat'] = params.nb_channels gui_params['n_features_per_channel'] = 5 gui_params['dtype'] = data_dtype gui_params['offset'] = data_offset gui_params['sample_rate'] = params.rate gui_params['dir_path'] = output_path gui_params['hp_filtered'] = True os.chdir(output_path) create_app() controller = TemplateController(**gui_params) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def main(argv=None): if argv is None: argv = sys.argv[1:] header = get_colored_header() parser = argparse.ArgumentParser( description=header, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('datafile', help='data file') parser.add_argument('-e', '--extension', help='extension to consider for visualization', default='') if len(argv) == 0: parser.print_help() sys.exit() args = parser.parse_args(argv) filename = os.path.abspath(args.datafile) extension = args.extension params = CircusParser(filename) if os.path.exists(params.logfile): os.remove(params.logfile) logger = init_logging(params.logfile) logger = logging.getLogger(__name__) mytest = StrictVersion(phycontrib.__version__) >= StrictVersion("1.0.12") if not mytest: print_and_log( ['You need to update phy-contrib to the latest git version'], 'error', logger) sys.exit(1) data_file = params.get_data_file() data_dtype = data_file.data_dtype if hasattr(data_file, 'data_offset'): data_offset = data_file.data_offset else: data_offset = 0 file_format = data_file.description file_out_suff = params.get('data', 'file_out_suff') if file_format not in supported_by_phy: print_and_log([ "File format %s is not supported by phy. TraceView disabled" % file_format ], 'info', logger) if numpy.iterable(data_file.gain): print_and_log( ['Multiple gains are not supported, using a default value of 1'], 'info', logger) gain = 1 else: if data_file.gain != 1: print_and_log([ "Gain of %g is not supported by phy. Expecting a scaling mismatch" % gain ], 'info', logger) gain = data_file.gain probe = params.probe if extension != '': extension = '-' + extension output_path = params.get('data', 'file_out_suff') + extension + '.GUI' if not os.path.exists(output_path): print_and_log( ['Data should be first exported with the converting method!'], 'error', logger) else: print_and_log(["Launching the phy GUI..."], 'info', logger) gui_params = {} if file_format in supported_by_phy: gui_params['dat_path'] = params.get('data', 'data_file') else: gui_params['dat_path'] = '' gui_params['n_channels_dat'] = params.nb_channels gui_params['n_features_per_channel'] = 5 gui_params['dtype'] = data_dtype gui_params['offset'] = data_offset gui_params['sample_rate'] = params.rate gui_params['hp_filtered'] = True os.chdir(output_path) create_app() controller = TemplateController(**gui_params) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
def main(argv=None): if argv is None: argv = sys.argv[1:] header = get_colored_header() parser = argparse.ArgumentParser( description=header, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('datafile', help='data file') parser.add_argument('-e', '--extension', help='extension to consider for visualization', default='') if len(argv) == 0: parser.print_help() sys.exit() args = parser.parse_args(argv) filename = os.path.abspath(args.datafile) extension = args.extension params = CircusParser(filename) if os.path.exists(params.logfile): os.remove(params.logfile) logger = init_logging(params.logfile) logger = logging.getLogger(__name__) mytest = StrictVersion(phycontrib.__version__) >= StrictVersion("1.0.12") if not mytest: print_and_log( ['You need to update phy-contrib to the latest git version'], 'error', logger) sys.exit(1) if not test_patch_for_similarities(params, extension): print_and_log( ['You should re-export the data because of a fix in 0.6'], 'error', logger) continue_anyway = query_yes_no( Fore.WHITE + "Continue anyway (results may not be fully correct)?", default=None) if not continue_anyway: sys.exit(1) data_file = params.get_data_file() data_dtype = data_file.data_dtype if data_file.params.has_key('data_offset'): data_offset = data_file.data_offset else: data_offset = 0 file_format = data_file.description file_out_suff = params.get('data', 'file_out_suff') if file_format not in supported_by_phy: print_and_log([ "File format %s is not supported by phy. TraceView disabled" % file_format ], 'info', logger) if numpy.iterable(data_file.gain): print_and_log( ['Multiple gains are not supported, using a default value of 1'], 'info', logger) gain = 1 else: if data_file.gain != 1: print_and_log([ "Gain of %g is not supported by phy. Expecting a scaling mismatch" % data_file.gain ], 'info', logger) gain = data_file.gain probe = params.probe if extension != '': extension = '-' + extension output_path = params.get('data', 'file_out_suff') + extension + '.GUI' if not os.path.exists(output_path): print_and_log( ['Data should be first exported with the converting method!'], 'error', logger) else: print_and_log(["Launching the phy GUI..."], 'info', logger) gui_params = {} if file_format in supported_by_phy: if not params.getboolean('data', 'overwrite'): gui_params['dat_path'] = params.get('data', 'data_file_no_overwrite') else: if params.get('data', 'stream_mode') == 'multi-files': data_file = params.get_data_file(source=True, has_been_created=False) gui_params['dat_path'] = ' '.join( data_file.get_file_names()) else: gui_params['dat_path'] = params.get('data', 'data_file') else: gui_params['dat_path'] = 'giverandomname.dat' gui_params['n_channels_dat'] = params.nb_channels gui_params['n_features_per_channel'] = 5 gui_params['dtype'] = data_dtype gui_params['offset'] = data_offset gui_params['sample_rate'] = params.rate gui_params['dir_path'] = output_path gui_params['hp_filtered'] = True f = open(os.path.join(output_path, 'params.py'), 'w') for key, value in gui_params.items(): if key in ['dir_path', 'dat_path', 'dtype']: f.write('%s = "%s"\n' % (key, value)) else: f.write("%s = %s\n" % (key, value)) f.close() os.chdir(output_path) create_app() controller = TemplateController(**gui_params) gui = controller.create_gui() gui.show() run_app() gui.close() del gui
lf = Binload(nCh=nCh, fs=fs) lf.load(filename,'i'+str(numbyte), seekpos=0) t, data = lf.tonumpyarray() wave_view = view_multiwave(data[time_slice*span:(time_slice+1)*span,:], fs=25000) wave_view.gap_value = 0.9 wave_view.attach(gui) ############################################################################################ from phy.gui import Actions actions = Actions(gui) @actions.add(shortcut=',') def page_up(): global time_slice time_slice -= 1 if time_slice >= 0: wave_view.set_data(data[time_slice*span:(time_slice+1)*span,:], time_slice) else: time_slice = 0 @actions.add(shortcut='.') def page_down(): global time_slice time_slice += 1 wave_view.set_data(data[time_slice*span:(time_slice+1)*span,:], time_slice) gui.show() run_app()