def run_auto(kwik_path, clustering=None, interactive=False, **kwargs): from phy.cluster import Session if not op.exists(kwik_path): print("The file `{}` doesn't exist.".format(kwik_path)) return session = Session(kwik_path, use_store=False) session.cluster(clustering=clustering, **kwargs) session.save() session.close()
def run_manual(kwik_path, clustering=None, interactive=False, cluster_ids=None): import phy from phy.cluster import Session from phy.gui import start_qt_app, run_qt_app if not op.exists(kwik_path): print("The file `{}` doesn't exist.".format(kwik_path)) return 1 print("\nLoading {}...".format(kwik_path)) session = Session(kwik_path, clustering=clustering, ) print("Data successfully loaded!\n") session.model.describe() start_qt_app() gui = session.show_gui(cluster_ids=cluster_ids, show=False) print("\nPress `ctrl+h` to see the list of keyboard shortcuts.\n") # Interactive mode with IPython. if interactive: print("\nStarting IPython...") from IPython import start_ipython # Namespace. ns = {'phy': phy, 'session': session, 'model': session.model, 'kwik_path': kwik_path, 'gui': gui, } start_ipython(["--gui=qt", "-i", "-c='gui.show()'"], user_ns=ns) else: gui.show() run_qt_app()