def __init__(self): super().__init__(self) self.options = self.main_menu_options self.system = CESystem() self.auto_run = AutomatedControl.AutoRun(self.system) self.auto_run.path_information.add_callback(print) self.view = None # type: tkinter.Tk self.menu = None self.ce_display = None # Define Submenus self.system_menu = SystemMenu(self, self) self.config_menu = ConfigMenu(self, self)
def __init__(self, system: CESystem()): """ Creates and AutoRun object that groups templates and methods together and coordinates the actions on a CE system object so that an automated run can take place. :param system: CE system object that will be automated """ self.system = system # L3 CE Systems object self.style = 'CE' self.methods = [] self.gate = GateSpecial() self.repetitions = 1 self.repetition_style = 'method' self._queue = Queue() self.is_running = threading.Event() self.continue_event = threading.Event() self.continue_callbacks = {} self.simple_wait_callbacks = [] self.traced_thread = Util.TracedThread() self.traced_thread.name = 'AutoRun' self.data_dir = get_system_var('data_dir')[0] self.safe_enabled = False self.template = None self.template: Template self.path_information = PathTrace() self.last_path = None #of_x = FileIO.get_system_var('offset_x') #of_y = FileIO.get_system_var('offset_y') self.offset = (0, 0)
else: extra_t = xcalc / vmax extra_v = np.linspace(vmax, vmax, int(round(extra_t * 1000))) v_profile = velocity.copy() v_profile = np.concatenate((v_profile, extra_v)) if extra: extra_a = np.zeros(int(round(extra_t * 1000))) accel = np.concatenate((accel, extra_a, -accel)) v_profile = np.concatenate((v_profile, np.flip(velocity))) x = np.zeros(len(v_profile)) for i, v in enumerate(v_profile): x[i] = np.trapz(v_profile[:i]) if extra: return x / 1000, v_profile, accel return x / 1000 if __name__ == "__main__": logger = logging.getLogger() logger.setLevel(logging.INFO) system = CESystem() system.load_config() system.open_controllers() tm = AutomatedControl.Template() xyz0 = [20, 20, 3] xyz1 = [100, 35, 10] path = SafeMove(system, tm, xyz0, xyz1, visual=True).move()
def __init__(self, system: CESystem()): super().__init__(system) self.style = 'CHIP'
:param lower_y: :param right_x: :param upper_y: :return: """ self.dimensions = [left_x, lower_y, right_x, upper_y] class AutoSpecial: pass if __name__ == "__main__": import matplotlib.pyplot as plt import numpy as np import logging import os os.chdir(os.path.abspath('..')) logger = logging.getLogger() logger.setLevel(logging.INFO) system = CESystem() system.load_config( config_file=r'E:\Scripts\AutomatedCE\config\TestChip.cfg') system.open_controllers() auto = ChipRun(system) auto.add_method(r'E:\Scripts\AutomatedCE\config\methods-chep.txt') # auto.set_template() auto.repetitions = 2 # auto.start_run()
class MainMenu(mui.Menu): main_menu_options = """ CE Main Menu: 1. System Menu 2. Config Menu 3. Start Run 4. Stop CE 5. Simulate Run """ def __init__(self): super().__init__(self) self.options = self.main_menu_options self.system = CESystem() self.auto_run = AutomatedControl.AutoRun(self.system) self.auto_run.path_information.add_callback(print) self.view = None # type: tkinter.Tk self.menu = None self.ce_display = None # Define Submenus self.system_menu = SystemMenu(self, self) self.config_menu = ConfigMenu(self, self) def setup(self): # Assign Callbacks self.auto_run.continue_callbacks[ 'manual_cell'] = lambda msg: messagebox.askokcancel( "Manual Cell Lysis and Loading", msg) self.menu = ManualCellPopup(self.view, None, None, True, self.auto_run, self.system) self.auto_run.continue_callbacks[ 'manual_cell'] = lambda message, step, simulation: self.menu.update_step( message, step, simulation) self.menu.top.withdraw() def interpret(self, text: str): """ Interprets the Main menu options :param text: string identifier for the method :return: new menu to be loaded :rtype: mui.Menu """ if text == "1": return self.system_menu elif text == "2": return self.config_menu elif text == "3": self.ce_display = DisplayWindows.TkCEDisplay( self.system, self.view) self.ce_display.start_live_view() self.auto_run.start_run() elif text == "4": self.system.stop_ce() self.auto_run.stop_run() elif text == "5": self.auto_run.start_run(simulated=True) return self
:param args: :return: list of artists for animation function """ data = self.system.detector.get_data() power_data = self.system.high_voltage.get_data() ax1, ax2 = self.plot_axes[0:2] try: ax1.set_xlim(min(data['time_data']), max(data['time_data'])) ax1.set_ylim(min(data['rfu']) * 0.95, max(data['rfu'] * 1.05)) # ax2.set_ylim(min(power_data['current'])*0.95, max(power_data['current'])*1.05) except ValueError: logging.warning("No data to plot") return self._artists self._artists[0].set_data(data['time_data'], data['rfu']) self._artists[1].set_data(power_data['time_data'], power_data['current']) return self._artists if __name__ == "__main__": import sys import os os.chdir(os.path.abspath('..')) sys = CESystem() sys.load_config(config_file=r'E:\Scripts\AutomatedCE\config\TestChip.cfg') sys.open_controllers() sys.startup_utilities() c = sys.camera wn = PLTMicroscopeDisplay(sys)