def test_setup(ctrl): from instamatic import TEMController ctrl2 = TEMController.get_instance() assert ctrl2 is ctrl
def __init__(self, parent): LabelFrame.__init__(self, parent, text="Continuous rotation electron diffraction (TVIPS)") self.parent = parent sbwidth = 10 self.init_vars() frame = Frame(self) Label(frame, text="Target angle (degrees):").grid(row=4, column=0, sticky="W") self.e_target_angle = Spinbox(frame, textvariable=self.var_target_angle, width=sbwidth, from_=-80.0, to=80.0, increment=5.0, state=NORMAL) self.e_target_angle.grid(row=4, column=1, sticky="W", padx=10) self.InvertAngleButton = Button(frame, text="Invert", command=self.invert_angle) self.InvertAngleButton.grid(row=4, column=2, sticky="EW") self.c_toggle_manual_control = Checkbutton(frame, text="Manual rotation control", variable=self.var_toggle_manual_control, command=self.toggle_manual_control) self.c_toggle_manual_control.grid(row=4, column=3, sticky="W") # defocus button Label(frame, text="Diff defocus:").grid(row=6, column=0, sticky="W") self.e_diff_defocus = Spinbox(frame, textvariable=self.var_diff_defocus, width=sbwidth, from_=-10000, to=10000, increment=100) self.e_diff_defocus.grid(row=6, column=1, sticky="W", padx=10) Label(frame, text="Exposure (ms):").grid(row=7, column=0, sticky="W") self.e_exposure = Spinbox(frame, textvariable=self.var_exposure, width=sbwidth, from_=0, to=10000, increment=100) self.e_exposure.grid(row=7, column=1, sticky="W", padx=10) Label(frame, text="Mode:").grid(row=8, column=0, sticky="W") self.o_mode = OptionMenu(frame, self.var_mode, 'diff', 'diff', 'mag1', 'mag2', 'lowmag', 'samag') self.o_mode.grid(row=8, column=1, sticky="W", padx=10) self.c_toggle_defocus = Checkbutton(frame, text="Toggle defocus", variable=self.var_toggle_diff_defocus, command=self.toggle_diff_defocus) self.c_toggle_defocus.grid(row=6, column=3, sticky="W") self.b_reset_defocus = Button(frame, text="Reset", command=self.reset_diff_defocus, state=DISABLED) self.b_reset_defocus.grid(row=6, column=2, sticky="EW") self.c_toggle_diffraction = Checkbutton(frame, text="Toggle DIFF", variable=self.var_toggle_diff_mode, command=self.toggle_diff_mode) self.c_toggle_diffraction.grid(row=7, column=3, sticky="W") self.c_toggle_screen = Checkbutton(frame, text="Toggle screen", variable=self.var_toggle_screen, command=self.toggle_screen) self.c_toggle_screen.grid(row=8, column=3, sticky="W") self.b_start_liveview = Button(frame, text="Start live view", command=self.start_liveview) self.b_start_liveview.grid(row=7, column=2, sticky="EW") self.b_stop_liveview = Button(frame, text="Stop live view", command=self.stop_liveview) self.b_stop_liveview.grid(row=8, column=2, sticky="EW") self.c_toggle_beamblank = Checkbutton(frame, text="Toggle beamblank", variable=self.var_toggle_beamblank, command=self.toggle_beamblank) self.c_toggle_beamblank.grid(row=10, column=3, sticky="W") frame.pack(side="top", fill="x", padx=10, pady=10) frame = Frame(self) self.e_instructions = Entry(frame, width=50, textvariable=self.var_instruction_file) self.e_instructions.grid(row=4, column=1, sticky="EW") self.BrowseTrackButton = Button(frame, text="Browse..", command=self.browse_instructions) self.BrowseTrackButton.grid(row=4, column=2, sticky="EW") Label(frame, text="Instruction file:").grid(row=4, column=0, sticky="W") frame.pack(side="top", fill="x", padx=10, pady=10) frame = Frame(self) self.SearchButton = Button(frame, text="Search", command=self.search) self.SearchButton.grid(row=1, column=0, sticky="EW") self.FocusButton = Button(frame, text="Focus", command=self.focus) self.FocusButton.grid(row=1, column=1, sticky="EW") self.GetImageButton = Button(frame, text="Get image", command=self.get_image) self.GetImageButton.grid(row=1, column=2, sticky="EW") frame.columnconfigure(0, weight=1) frame.columnconfigure(1, weight=1) frame.columnconfigure(2, weight=1) frame.pack(fill="x", padx=10, pady=10) frame = Frame(self) self.SerialButton = Button(frame, text="Start serial acquisition", width=25, command=self.serial_collection) self.SerialButton.grid(row=1, column=0, sticky="EW") frame.pack(fill="x", padx=10, pady=10) frame = Frame(self) self.GetReadyButton = Button(frame, text="Get Ready", command=self.prime_collection) self.GetReadyButton.grid(row=1, column=0, sticky="EW") self.AcquireButton = Button(frame, text="Acquire", command=self.start_collection, state=DISABLED) self.AcquireButton.grid(row=1, column=1, sticky="EW") self.FinalizeButton = Button(frame, text="Finalize", command=self.stop_collection, state=DISABLED) self.FinalizeButton.grid(row=1, column=2, sticky="EW") frame.columnconfigure(0, weight=1) frame.columnconfigure(1, weight=1) frame.columnconfigure(2, weight=1) frame.pack(side="bottom", fill="x", padx=10, pady=10) from instamatic import TEMController self.ctrl = TEMController.get_instance()
def __init__(self, parent): LabelFrame.__init__(self, parent, text="Stage Control") self.parent = parent self.init_vars() frame = Frame(self) b_stage_stop = Button(frame, text="Stop stage", command=self.stage_stop) b_stage_stop.grid(row=0, column=2, sticky="W") cb_nowait = Checkbutton(frame, text="Wait for stage", variable=self.var_stage_wait) cb_nowait.grid(row=0, column=3) b_find_eucentric_height = Button(frame, text="Find eucentric height", command=self.find_eucentric_height) b_find_eucentric_height.grid(row=0, column=0, sticky="EW", columnspan=2) Label(frame, text="Mode:").grid(row=8, column=0, sticky="W") self.o_mode = OptionMenu(frame, self.var_mode, 'diff', 'diff', 'mag1', 'mag2', 'lowmag', 'samag', command=self.set_mode) self.o_mode.grid(row=8, column=1, sticky="W", padx=10) frame.pack(side="top", fill="x", padx=10, pady=10) frame = Frame(self) Label(frame, text="Angle (-)", width=20).grid(row=1, column=0, sticky="W") Label(frame, text="Angle (0)", width=20).grid(row=2, column=0, sticky="W") Label(frame, text="Angle (+)", width=20).grid(row=3, column=0, sticky="W") Label(frame, text="Alpha wobbler (±)", width=20).grid(row=4, column=0, sticky="W") Label(frame, text="Stage(XY)", width=20).grid(row=5, column=0, sticky="W") e_negative_angle = Spinbox(frame, width=10, textvariable=self.var_negative_angle, from_=-90, to=90, increment=5) e_negative_angle.grid(row=1, column=1, sticky="EW") e_neutral_angle = Spinbox(frame, width=10, textvariable=self.var_neutral_angle, from_=-90, to=90, increment=5) e_neutral_angle.grid(row=2, column=1, sticky="EW") e_positive_angle = Spinbox(frame, width=10, textvariable=self.var_positive_angle, from_=-90, to=90, increment=5) e_positive_angle.grid(row=3, column=1, sticky="EW") e_alpha_wobbler = Spinbox(frame, width=10, textvariable=self.var_alpha_wobbler, from_=-90, to=90, increment=1) e_alpha_wobbler.grid(row=4, column=1, sticky="EW") self.b_start_wobble = Button(frame, text="Start", command=self.start_alpha_wobbler) self.b_start_wobble.grid(row=4, column=2, sticky="W") self.b_stop_wobble = Button(frame, text="Stop", command=self.stop_alpha_wobbler, state=DISABLED) self.b_stop_wobble.grid(row=4, column=3, sticky="W") e_stage_x = Entry(frame, width=10, textvariable=self.var_stage_x) e_stage_x.grid(row=5, column=1, sticky="EW") e_stage_y = Entry(frame, width=10, textvariable=self.var_stage_y) e_stage_y.grid(row=5, column=2, sticky="EW") b_negative_angle = Button(frame, text="Set", command=self.set_negative_angle) b_negative_angle.grid(row=1, column=2, sticky="W") b_neutral_angle = Button(frame, text="Set", command=self.set_neutral_angle) b_neutral_angle.grid(row=2, column=2, sticky="W") b_positive_angle = Button(frame, text="Set", command=self.set_positive_angle) b_positive_angle.grid(row=3, column=2, sticky="W") b_stage = Button(frame, text="Set", command=self.set_stage) b_stage.grid(row=5, column=3, sticky="W") b_stage_get = Button(frame, text="Get", command=self.get_stage) b_stage_get.grid(row=5, column=4, sticky="W") # frame.grid_columnconfigure(1, weight=1) frame.pack(side="top", fill="x", padx=10, pady=10) frame = Frame(self) Label(frame, text="Brightness", width=20).grid(row=11, column=0, sticky="W") e_brightness = Entry(frame, width=10, textvariable=self.var_brightness) e_brightness.grid(row=11, column=1, sticky="W") b_brightness = Button(frame, text="Set", command=self.set_brightness) b_brightness.grid(row=11, column=2, sticky="W") b_brightness_get = Button(frame, text="Get", command=self.get_brightness) b_brightness_get.grid(row=11, column=3, sticky="W") slider = Scale(frame, variable=self.var_brightness, from_=0, to=2**16 - 1, orient=HORIZONTAL, command=self.set_brightness) slider.grid(row=12, column=0, columnspan=3, sticky="EW") frame.pack(side="top", fill="x", padx=10, pady=10) frame = Frame(self) Label(frame, text="DiffFocus", width=20).grid(row=11, column=0, sticky="W") e_difffocus = Entry(frame, width=10, textvariable=self.var_difffocus) e_difffocus.grid(row=11, column=1, sticky="W") b_difffocus = Button(frame, text="Set", command=self.set_difffocus) b_difffocus.grid(row=11, column=2, sticky="W") b_difffocus_get = Button(frame, text="Get", command=self.get_difffocus) b_difffocus_get.grid(row=11, column=3, sticky="W") slider = Scale(frame, variable=self.var_difffocus, from_=0, to=2**16 - 1, orient=HORIZONTAL, command=self.set_difffocus) slider.grid(row=12, column=0, columnspan=3, sticky="EW") frame.pack(side="top", fill="x", padx=10, pady=10) from instamatic import TEMController self.ctrl = TEMController.get_instance()
def __init__(self, parent): LabelFrame.__init__(self, parent, text='Stage Control') self.parent = parent self.init_vars() frame = Frame(self) b_stage_stop = Button(frame, text='Stop stage', command=self.stage_stop) b_stage_stop.grid(row=0, column=2, sticky='W') cb_nowait = Checkbutton(frame, text='Wait for stage', variable=self.var_stage_wait) cb_nowait.grid(row=0, column=3) b_find_eucentric_height = Button(frame, text='Find eucentric height', command=self.find_eucentric_height) b_find_eucentric_height.grid(row=0, column=0, sticky='EW', columnspan=2) Label(frame, text='Mode:').grid(row=8, column=0, sticky='W') self.o_mode = OptionMenu(frame, self.var_mode, 'diff', 'diff', 'mag1', 'mag2', 'lowmag', 'samag', command=self.set_mode) self.o_mode.grid(row=8, column=1, sticky='W', padx=10) frame.pack(side='top', fill='x', padx=10, pady=10) frame = Frame(self) Label(frame, text='Angle (-)', width=20).grid(row=1, column=0, sticky='W') Label(frame, text='Angle (0)', width=20).grid(row=2, column=0, sticky='W') Label(frame, text='Angle (+)', width=20).grid(row=3, column=0, sticky='W') Label(frame, text='Alpha wobbler (±)', width=20).grid(row=4, column=0, sticky='W') Label(frame, text='Stage(XY)', width=20).grid(row=6, column=0, sticky='W') e_negative_angle = Spinbox(frame, width=10, textvariable=self.var_negative_angle, from_=-90, to=90, increment=5) e_negative_angle.grid(row=1, column=1, sticky='EW') e_neutral_angle = Spinbox(frame, width=10, textvariable=self.var_neutral_angle, from_=-90, to=90, increment=5) e_neutral_angle.grid(row=2, column=1, sticky='EW') e_positive_angle = Spinbox(frame, width=10, textvariable=self.var_positive_angle, from_=-90, to=90, increment=5) e_positive_angle.grid(row=3, column=1, sticky='EW') e_alpha_wobbler = Spinbox(frame, width=10, textvariable=self.var_alpha_wobbler, from_=-90, to=90, increment=1) e_alpha_wobbler.grid(row=4, column=1, sticky='EW') self.b_start_wobble = Button(frame, text='Start', command=self.start_alpha_wobbler) self.b_start_wobble.grid(row=4, column=2, sticky='W') self.b_stop_wobble = Button(frame, text='Stop', command=self.stop_alpha_wobbler, state=DISABLED) self.b_stop_wobble.grid(row=4, column=3, sticky='W') e_stage_x = Entry(frame, width=10, textvariable=self.var_stage_x) e_stage_x.grid(row=6, column=1, sticky='EW') e_stage_y = Entry(frame, width=10, textvariable=self.var_stage_y) e_stage_y.grid(row=6, column=2, sticky='EW') if config.settings.use_goniotool: Label(frame, text='Rot. Speed', width=20).grid(row=5, column=0, sticky='W') e_goniotool_tx = Spinbox(frame, width=10, textvariable=self.var_goniotool_tx, from_=1, to=12, increment=1) e_goniotool_tx.grid(row=5, column=1, sticky='EW') b_goniotool_set = Button(frame, text='Set', command=self.set_goniotool_tx) b_goniotool_set.grid(row=5, column=2, sticky='W') b_goniotool_default = Button(frame, text='Default', command=self.set_goniotool_tx_default) b_goniotool_default.grid(row=5, column=3, sticky='W') b_negative_angle = Button(frame, text='Set', command=self.set_negative_angle) b_negative_angle.grid(row=1, column=2, sticky='W') b_neutral_angle = Button(frame, text='Set', command=self.set_neutral_angle) b_neutral_angle.grid(row=2, column=2, sticky='W') b_positive_angle = Button(frame, text='Set', command=self.set_positive_angle) b_positive_angle.grid(row=3, column=2, sticky='W') b_stage = Button(frame, text='Set', command=self.set_stage) b_stage.grid(row=6, column=3, sticky='W') b_stage_get = Button(frame, text='Get', command=self.get_stage) b_stage_get.grid(row=6, column=4, sticky='W') # defocus button Label(frame, text='Diff defocus:', width=20).grid(row=13, column=0, sticky='W') self.e_diff_defocus = Spinbox(frame, textvariable=self.var_diff_defocus, width=10, from_=-10000, to=10000, increment=100) self.e_diff_defocus.grid(row=13, column=1, sticky='EW') self.c_toggle_defocus = Checkbutton( frame, text='Toggle defocus', variable=self.var_toggle_diff_defocus, command=self.toggle_diff_defocus) self.c_toggle_defocus.grid(row=13, column=2, sticky='W', columnspan=2) self.b_reset_defocus = Button(frame, text='Reset', command=self.reset_diff_defocus, state=DISABLED) self.b_reset_defocus.grid(row=13, column=4, sticky='EW') # frame.grid_columnconfigure(1, weight=1) frame.pack(side='top', fill='x', padx=10, pady=10) frame = Frame(self) Label(frame, text='Brightness', width=20).grid(row=11, column=0, sticky='W') e_brightness = Entry(frame, width=10, textvariable=self.var_brightness) e_brightness.grid(row=11, column=1, sticky='W') b_brightness = Button(frame, text='Set', command=self.set_brightness) b_brightness.grid(row=11, column=2, sticky='W') b_brightness_get = Button(frame, text='Get', command=self.get_brightness) b_brightness_get.grid(row=11, column=3, sticky='W') slider = Scale(frame, variable=self.var_brightness, from_=0, to=2**16 - 1, orient=HORIZONTAL, command=self.set_brightness) slider.grid(row=12, column=0, columnspan=3, sticky='EW') frame.pack(side='top', fill='x', padx=10, pady=10) frame = Frame(self) Label(frame, text='DiffFocus', width=20).grid(row=11, column=0, sticky='W') e_difffocus = Entry(frame, width=10, textvariable=self.var_difffocus) e_difffocus.grid(row=11, column=1, sticky='W') b_difffocus = Button(frame, text='Set', command=self.set_difffocus) b_difffocus.grid(row=11, column=2, sticky='W') b_difffocus_get = Button(frame, text='Get', command=self.get_difffocus) b_difffocus_get.grid(row=11, column=3, sticky='W') slider = Scale(frame, variable=self.var_difffocus, from_=0, to=2**16 - 1, orient=HORIZONTAL, command=self.set_difffocus) slider.grid(row=12, column=0, columnspan=3, sticky='EW') frame.pack(side='top', fill='x', padx=10, pady=10) from instamatic import TEMController self.ctrl = TEMController.get_instance()