Ejemplo n.º 1
0
 def start_compressed(self):
     self.scan = Scan(copy.deepcopy(self.scan_dict))
     self.scan.bind_to('Progress', self.update_progress)
     self.scan.bind_to('Live', self.update_image)
     self.scan.bind_to('Bact', self.update_image)
     self.scan.bind_to('Cur_Bact', self.update_image)
     self.scan.compressed_scan()
     self.scan_completed = True
Ejemplo n.º 2
0
    def get_scans(self):
        user = self.setCredentialsForAnyUser()
        self.assertTrue(len(user.scans.all()) == 0)
        scan = Scan(user=user, text="0001")
        scan.save()

        response = self.client.get(reverse('scan-list'))

        self.assertTrue(response.status_code == status.HTTP_200_OK)
        self.assertTrue(json.loads(response.content)[0]['text'] == "0001")
Ejemplo n.º 3
0
    def test_duplicates(self):
        user = self.setCredentialsForAnyUser()
        self.assertTrue(len(user.scans.all()) == 0)
        scan = Scan(user=user, text="0001")
        scan.save()

        data = {"text": "0001"}
        response = self.client.post(reverse('scan-list'), data, format='json')
        print response

        self.assertTrue(response.status_code == status.HTTP_201_CREATED)
        self.assertTrue(len(user.scans.all()) == 1)
        self.assertTrue(user.scans.all()[0].text == "0001")
Ejemplo n.º 4
0
 def start_scan(self, path, count):
     self.scan_aborted = False
     for x in range(count):
         if not self.scan_completed:
             self.scan = Scan(copy.deepcopy(self.scan_dict))
             for label in self.IMAGE_LABEL:
                 self.scan.bind_to(label, self.update_image)
             self.scan.bind_to('progress', self.update_progress)
             self.scan.bind_to('live_plot', self.update_plot)
             self.scan.full_scan(x + 1, path)
             self.scan.__exit__(None, None, None)
     if not self.scan_aborted:
         print('Alles Fertig')
     self.scan_completed = True
Ejemplo n.º 5
0
 def start(self):
     self.start_button.config(state='disabled')
     self.scan_window = tk.Toplevel(self.window)
     self.window_text = tk.Text(self.scan_window, wrap='word', height = 11, width=50)
     self.window_text.grid(column=0, row=0, columnspan = 2, sticky='NSWE', padx=5, pady=5)
     self.meas_paused = False
     self.window_pause_txt = tk.StringVar()
     self.window_pause = tk.Button(self.scan_window, textvariable=self.window_pause_txt, command=self.pause_meas)
     self.window_pause_txt.set('Pause')
     self.window_pause.grid(column=0, row=1, sticky='NSWE', padx=5, pady=5)
     #sys.stdout = StdoutRedirector(self.window_text, sys.stdout)
     self.update_dict()
     self.scan = Scan(copy.deepcopy(self.scan_dict))
     self.scan_thread = threading.Thread(target=self.scan.start_scan, args=(self.entries['Csv_path'].get()))
     self.scan_thread.start()
Ejemplo n.º 6
0
 def test_fourier(self):
     self.scan = Scan(copy.deepcopy(self.scan_dict))
     self.scan.bind_to('live_plot', self.update_plot)
     self.scan.bind_to('bact', self.update_image)
     self.scan.bind_to('points', self.update_image)
     self.fig = plt.figure(figsize=(10, 4), dpi=100)
     self.ax = self.fig.add_subplot(1, 1, 1)
     self.ax.yaxis.set_visible(False)
     self.ax.xaxis.set_visible(False)
     self.fig.tight_layout()
     self.canvas = FigureCanvasTkAgg(self.fig, master=self.live_plot)
     self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1)
     self.avrg_pointer = 0
     self.plot_data = np.zeros((1, 100))
     self.ani = animation.FuncAnimation(self.fig,
                                        self.animate_plot,
                                        interval=100)
     self.scan.test_fourier()
     self.scan.__exit__('abort', None, None)
Ejemplo n.º 7
0
 def setUp(self):
     self.scan = Scan()
     self.scan.start()