diff --git a/pyproject.toml b/pyproject.toml index 592b4f59..924c3d2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ dependencies = [ "numpy>=1.21.2", "matplotlib>=3.4.3", "scipy>=1.7.1", + "h5py>=3.3.0", "qcsapphire>=1.0.1", "qt3rfsynthcontrol>=1.0.1", "nipiezojenapy>=1.0.1", diff --git a/src/applications/piezoscan.py b/src/applications/piezoscan.py index 1defffac..37417103 100644 --- a/src/applications/piezoscan.py +++ b/src/applications/piezoscan.py @@ -1,26 +1,23 @@ -import time import argparse -import collections import tkinter as tk -import tkinter.ttk as ttk import logging import datetime from threading import Thread import numpy as np -import scipy.optimize import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk import matplotlib -matplotlib.use('Agg') import nidaqmx +import h5py import qt3utils.nidaq import qt3utils.datagenerators as datasources -import qt3utils.datagenerators.piezoscanner import qt3utils.pulsers.pulseblaster import nipiezojenapy +matplotlib.use('Agg') + parser = argparse.ArgumentParser(description='NI DAQ (PCIx 6363) / Jena Piezo Scanner', formatter_class=argparse.ArgumentDefaultsHelpFormatter) @@ -86,10 +83,10 @@ def __init__(self, mplcolormap = 'Reds'): def update(self, model): if self.log_data: - data = np.log10(model.data) + data = np.log10(model.scanned_count_rate) data[np.isinf(data)] = 0 #protect against +-inf else: - data = model.data + data = model.scanned_count_rate self.artist = self.ax.imshow(data, cmap=self.cmap, extent=[model.xmin, model.xmax + model.step_size, @@ -117,6 +114,7 @@ def onclick(self, event): #todo: draw a circle around clicked point? Maybe with a high alpha, so that its faint self.onclick_callback(event) + class SidePanel(): def __init__(self, root, scan_range): frame = tk.Frame(root) @@ -231,7 +229,6 @@ def __init__(self, root, scan_range): self.log10Button = tk.Button(frame, text="Log10") self.log10Button.grid(row=row, column=2, pady=(2,15)) - def update_go_to_position(self, x = None, y = None, z = None): if x is not None: self.go_to_x_position_text.set(np.round(x,4)) @@ -294,11 +291,11 @@ def show_optimization_plot(self, title, old_opt_value, class MainTkApplication(): - def __init__(self, data_model): + def __init__(self, counter_scanner): self.root = tk.Tk() - self.model = data_model - scan_range = [data_model.stage_controller.minimum_allowed_position, - data_model.stage_controller.maximum_allowed_position] + self.counter_scanner = counter_scanner + scan_range = [counter_scanner.stage_controller.minimum_allowed_position, + counter_scanner.stage_controller.maximum_allowed_position] self.view = MainApplicationView(self.root, scan_range) self.view.sidepanel.startButton.bind("