Example #1
0
    def _on_analyze(self):
        """
        Searches for events in the file that is currently highlighted in the files list.
        """
        selected_items = self.file_list_widget.selectedItems()
        if len(selected_items) > 0:
            curr_item = selected_items[0]
        else:
            return

        parameters = self.get_current_analysis_parameters()
        if isinstance(parameters, dict) and 'error' in parameters:
            self._dispatch_status_update(parameters['error'])
            return

        debug = self.debug_check_box.isChecked()

        # Clear the current events
        del self.events[:]
        # self.prev_concat_time = 0.

        file_names = [str(curr_item.get_file_name())]

        self._dispatch_status_update("Event Count: 0 Percent Done: 0")

        # Start analyzing data in new analyzethread.
        self.analyzethread = AnalyzeDataThread(file_names, parameters, debug)
        self.analyzethread.dataReady.connect(
            self._analyze_data_thread_callback)
        self.add_thread(self.analyzethread)
        self.analyzethread.start()

        self.stop_analyze_button.setEnabled(True)
Example #2
0
    def test_one_file_with_events(self, filename):
        """
        Tests that events are found and event databases are saved.
        """
        test_data_file_names = tf.get_all_file_names()

        test_file = tf.get_abs_path('chimera_1event.log')
        analyze_thread = AnalyzeDataThread([test_file],
                                           Parameters(),
                                           debug=True,
                                           save_file_names=[filename])
        analyze_thread.start()

        # wait until the thread has finished
        analyze_thread.wait()

        self.assertTrue(os.path.exists(filename))