Beispiel #1
0
def evaluate_live(model):
    # not in use
    for phase in model.editor.phases:
        logger.debug("Start phase {0} [ExperimentModel]".format(phase))
        model.handler.update_phase(phase.name)
        phase.start()
        RunThread(target=model.send_image)
Beispiel #2
0
 def append_preview_to_queue(self, url, fname):
     # Appends a preview to the event queue
     try:
         with self.lock:
             self.queue_preview.append((url, fname))
         RunThread(target=self._download_previews_in_background)
     except Exception, e:
         msg = "Image: {0} Exception: {1}".format(self.img_num, str(e))
         self.logger.error(msg)
Beispiel #3
0
    def show(self, task):
        """
        Show the StartDialog and initialize the application in the background.

        :param task: Task 
        :type task: Built-in function
        """
        self.task = task
        RunThread(target=self.initialize)
        self.configure_traits()
Beispiel #4
0
    def use_all_ports(self, reset=True, reset_time=0.1):
        """
        Records all values of the input ports and save them \
        in the recorder-object. Furthermore the method trigger 
        a digital output signal to all output ports to take a
        picture.

        :param reset: True if the port should reset, False otherwise
        :type reset: bool
        :param reset_time: Time to pass to reset the port
        :type reset_time: float
        """
        self.logger.debug(
            "Trigger and recorder all ports [ExperimentRecorder]")
        self.cur_image += 1
        self.measuring_card.trigger_all_ports(reset, reset_time)
        RunThread(target=self.handler._update_icon)
        information = self.measuring_card.record_all_ports()
        for info in information:
            self.recorder.append(info, self.handler.get_time())
        RunThread(target=self.recorder._update_plots)
        RunThread(target=self.camera_handler.download_last_image)
Beispiel #5
0
 def append_image_to_queue(self, fpath, fname, url_photo, threading=True):
     # Appends a image to the event queue
     try:
         with self.lock:
             self.queue.append((url_photo, fpath))
         if threading and not self.download_image:
             # Do not start a new thread if one is already running
             RunThread(target=self._download_images_in_background)
         elif not threading:
             # Do not download the images in the background
             self._download_images_in_background()
     except Exception, e:
         msg = "Image: {0} Exception: {1}".format(self.img_num, str(e))
         self.logger.error(msg)
Beispiel #6
0
    def open_dialog(self):
        """Open the dialog to input the values for the port.

        :returns: True, if the user want create a port, False otherwise
        :rtype: bool
        """
        self.update_running = True
        # updates the value of the port automatically after pass a given time
        # to make sure that the user see all of the time
        # the current value of the port
        RunThread(target=self._update_value)
        self._check_attributes()
        confirm = self.configure_traits(kind="livemodal")
        self.update_running = False
        return confirm
Beispiel #7
0
 def _connect_btn_fired(self):
     RunThread(target=self._connect)
Beispiel #8
0
 def _start_record(self):
     # Starts the recorder of the experiment. The method
     # must call in a own thread to avoid that the gui
     # is not usable
     RunThread(target=self.handler._update_values)
     self.eval_methods.evaluate(model=self)
Beispiel #9
0
 def start(self):
     """Start the experiment."""
     self.recorder.reset(self.measuring_card.input_ports)
     RunThread(target=self._start_record)
Beispiel #10
0
 def start_clock(self):
     """Run the clock in the status bar."""
     self.logger.info("Start the time-thread [SMRCWindow]")
     self.clock = secs_to_time(0)
     RunThread(target=self._run_clock)