コード例 #1
0
    def on_loading_finished(self):
        if self.run_list and self.run_list[0] == 'Current':
            self.run_list = [
                self._model._loaded_data_store.get_latest_data()['run']
            ][0]
            self._model.current_run = self.run_list

        if self._load_multiple_runs and self._multiple_file_mode == "Co-Add":
            run_list_to_add = [
                run for run in self.run_list
                if self._model._loaded_data_store.get_data(run=[run])
            ]
            run_list = [[
                run for run in self.run_list
                if self._model._loaded_data_store.get_data(run=[run])
            ]]
            load_utils.combine_loaded_runs(self._model, run_list_to_add)
        else:
            run_list = [[run] for run in self.run_list
                        if self._model._loaded_data_store.get_data(run=[run])]

        self._model._context.current_runs = run_list

        self.update_view_from_model(run_list)
        self._view.notify_loading_finished()
        self.enable_loading()
コード例 #2
0
    def on_loading_finished(self):
        try:
            if self.run_list and self.run_list[0] == 'Current':
                latest_loaded_run = self._model.get_latest_loaded_run()
                if isinstance(latest_loaded_run, list):
                    self.run_list = latest_loaded_run
                else:
                    self.run_list[0] = latest_loaded_run
                self._model.current_run = self.run_list
            run_list = [[run] for run in self.run_list
                        if self._model._loaded_data_store.get_data(run=[run])]
            self._model.current_runs = run_list

            if self._load_multiple_runs and self._multiple_file_mode == "Co-Add":
                run_list_to_add = [
                    run for run in self.run_list
                    if self._model.get_data(run=[run])
                ]
                run_list = [[
                    run for run in self.run_list
                    if self._model.get_data(run=[run])
                ]]
                load_utils.combine_loaded_runs(self._model,
                                               run_list_to_add,
                                               delete_added=True)
                self._model.current_runs = run_list

            self.update_view_from_model(run_list)
            self._view.notify_loading_finished()
        except IndexError as error:
            self._view.warning_popup(error)
        finally:
            self.enable_loading()
            self.enable_notifier.notify_subscribers()
コード例 #3
0
ファイル: presenter.py プロジェクト: samueljackson92/mantid
    def on_loading_finished(self):
        file_list = self._model.loaded_filenames
        self.set_file_edit(file_list)

        if self._multiple_files and self._multiple_file_mode == "Co-Add":
            load_utils.combine_loaded_runs(self._model, self._model.loaded_runs)

        self._view.notify_loading_finished()
        self.enable_loading()
        self._model.add_directories_to_config_service(file_list)
コード例 #4
0
ファイル: presenter.py プロジェクト: samueljackson92/mantid
    def on_loading_finished(self):
        file_list = self._model.loaded_filenames
        self.set_file_edit(file_list)

        if self._multiple_files and self._multiple_file_mode == "Co-Add":
            load_utils.combine_loaded_runs(self._model,
                                           self._model.loaded_runs)

        self._view.notify_loading_finished()
        self.enable_loading()
        self._model.add_directories_to_config_service(file_list)
コード例 #5
0
    def on_loading_finished(self):
        # If in single file mode, remove the previous run
        if not self._load_multiple_runs and len(self._model.loaded_runs) > 1:
            self._model.remove_previous_data()

        run_list = self._model.loaded_runs
        self.set_run_edit_from_list(run_list)

        if self._load_multiple_runs and self._multiple_file_mode == "Co-Add":
            load_utils.combine_loaded_runs(self._model, run_list)

        self._view.notify_loading_finished()
        self.enable_loading()
コード例 #6
0
ファイル: presenter.py プロジェクト: samueljackson92/mantid
    def on_loading_finished(self):
        # If in single file mode, remove the previous run
        if not self._load_multiple_runs and len(self._model.loaded_runs) > 1:
            self._model.remove_previous_data()

        run_list = self._model.loaded_runs
        self.set_run_edit_from_list(run_list)

        if self._load_multiple_runs and self._multiple_file_mode == "Co-Add":
            load_utils.combine_loaded_runs(self._model, run_list)

        self._view.notify_loading_finished()
        self.enable_loading()
コード例 #7
0
 def test_combine_loaded_runs_for_psi_data(self, clone_mock):
     workspace = mock.MagicMock()
     workspace.workspace.name = "name"
     model = mock.MagicMock()
     model._data_context.num_periods = mock.Mock(return_value=1)
     # Workspace is missing DeadTimeTable and DetectorGroupingTable which should be handled without raising
     model._loaded_data_store.get_data = mock.Mock(
         return_value={
             "workspace": {
                 "OutputWorkspace": workspace,
                 "MainFieldDirection": 0,
                 "TimeZero": 0,
                 "FirstGoodData": 0,
                 "DataDeadTimeTable": "dtt"
             }
         })
     run_list = [1529]
     utils.combine_loaded_runs(model, run_list)
コード例 #8
0
    def on_loading_finished(self):
        instrument_from_workspace = self._model._loaded_data_store.\
            get_latest_data()['workspace']['OutputWorkspace'][0].workspace.getInstrument().getName()
        if instrument_from_workspace != self._model._context.instrument:
            self._model._context.instrument = instrument_from_workspace

        if self._multiple_files and self._multiple_file_mode == "Co-Add":
            file_list = [
                filename for filename in self.filenames
                if self._model._loaded_data_store.get_data(
                    filename=filename,
                    instrument=self._model._context.instrument)
            ]
            run_list_to_add = [
                self._model._loaded_data_store.get_data(
                    filename=filename)['run'][0] for filename in file_list
            ]
            run_list = [[
                self._model._loaded_data_store.get_data(
                    filename=filename)['run'][0] for filename in file_list
            ]]
            load_utils.combine_loaded_runs(self._model, run_list_to_add)

        else:
            file_list = [
                filename for filename in self.filenames
                if self._model._loaded_data_store.get_data(
                    filename=filename,
                    instrument=self._model._context.instrument)
            ]
            run_list = [
                self._model._loaded_data_store.get_data(
                    filename=filename)['run'] for filename in file_list
            ]

        self.set_file_edit(file_list)
        self._model._context.current_runs = run_list

        self._view.notify_loading_finished()
        self.enable_loading()
        self._model.add_directories_to_config_service(file_list)
コード例 #9
0
    def on_loading_finished(self):
        try:
            if self.run_list and self.run_list[0] == 'Current':
                latest_loaded_run = self._model.get_latest_loaded_run()
                if isinstance(latest_loaded_run, list):
                    self.run_list = latest_loaded_run
                else:
                    self.run_list[0] = latest_loaded_run
                self._model.current_run = self.run_list
            run_list = [[run] for run in self.run_list
                        if self._model._loaded_data_store.get_data(run=[run])]
            self._model.current_runs = run_list

            if self._load_multiple_runs and self._multiple_file_mode == "Co-Add":
                run_list_to_add = [
                    run for run in self.run_list
                    if self._model.get_data(run=[run])
                ]
                run_list = [[
                    run for run in self.run_list
                    if self._model.get_data(run=[run])
                ]]
                load_utils.combine_loaded_runs(self._model,
                                               run_list_to_add,
                                               delete_added=True)
                self._model.current_runs = run_list

            self.update_view_from_model(run_list)
            self._view.notify_loading_finished()
        except ValueError:
            self._view.warning_popup(
                'Attempting to co-add data with different time bins. This is not currently supported.'
            )
            self._view.reset_run_edit_from_cache()
        except RuntimeError as error:
            self._view.warning_popup(error)
            self._view.reset_run_edit_from_cache()
        finally:
            self.enable_loading()
            self.enable_notifier.notify_subscribers()
コード例 #10
0
    def on_loading_finished(self):
        try:
            if self.run_list and self.run_list[0] == 'Current':
                self.run_list = self._model.get_latest_loaded_run()
                self._model.current_run = self.run_list

            run_list = [[run] for run in self.run_list if self._model._loaded_data_store.get_data(run=[run])]
            self._model.current_runs = run_list

            if self._load_multiple_runs and self._multiple_file_mode == "Co-Add":
                run_list_to_add = [run for run in self.run_list if self._model.get_data(run=[run])]
                run_list = [[run for run in self.run_list if self._model.get_data(run=[run])]]
                load_utils.combine_loaded_runs(self._model, run_list_to_add)
                self._model.current_runs = run_list

            self.update_view_from_model(run_list)
            self._view.notify_loading_finished()
        except IndexError as error:
            self._view.warning_popup(error)
        finally:
            self.enable_loading()
            self.enable_notifier.notify_subscribers()
コード例 #11
0
ファイル: presenter.py プロジェクト: mantidproject/mantid
    def on_loading_finished(self):
        instrument_from_workspace = self._model.get_instrument_from_latest_run()
        if instrument_from_workspace != self._model._data_context.instrument:
            self._model.instrument = instrument_from_workspace

        if self._multiple_files and self._multiple_file_mode == "Co-Add":
            file_list = [filename for filename in self.filenames if
                         self._model.get_data(filename=filename, instrument=self._model._data_context.instrument)]
            run_list_to_add = [self._model.get_data(filename=filename)['run'][0] for filename in file_list]
            run_list = [
                [self._model.get_data(filename=filename)['run'][0] for filename in file_list]]
            load_utils.combine_loaded_runs(self._model, run_list_to_add)

        else:
            file_list = [filename for filename in self.filenames if
                         self._model._loaded_data_store.get_data(filename=filename, instrument=self._model.instrument)]
            run_list = [self._model.get_data(filename=filename)['run'] for filename in file_list]

        self.set_file_edit(file_list)
        self._model.current_runs = run_list

        self._view.notify_loading_finished()
        self.enable_loading()
        self._model.add_directories_to_config_service(file_list)