Пример #1
0
    def run(self):
        _big_table_data = self.big_table_data
        _data_0_0 = _big_table_data[0,0]
        if _data_0_0 is None:
            return
        
        self.nbr_reduction_process = self.calculate_nbr_reduction_process()
        self.cleanup()

        o_general_settings = GlobalReductionSettingsHandler(parent = self.parent)
        o_reduction_progressbar_handler = ProgressBarHandler(parent=self.parent)
        o_reduction_progressbar_handler.setup(nbr_reduction = self.nbr_reduction_process,
                                              label = 'Reduction Process ')
        
        for row_index in range(self.nbr_reduction_process):
            
            o_individual_settings = IndividualReductionSettingsHandler(parent = self.parent,
                                                                       row_index = row_index)
            
            self.launch_reduction(o_general = o_general_settings,
                                  o_individual = o_individual_settings,
                                  debug = self.debug)
            self.save_reduction(row = row_index,
                                workspace = o_individual_settings._output_workspace_name)
            o_reduction_progressbar_handler.next_step()
            
            
        self.parent.big_table_data = self.big_table_data
        o_reduction_progressbar_handler.end()
Пример #2
0
    def run(self):
        _big_table_data = self.big_table_data
        _data_0_0 = _big_table_data[0,0]
        if _data_0_0 is None:
            return
        
        StatusMessageHandler(parent = self.parent, 
                             message = 'Running reduction ...', 
                             is_threaded = False)
        
        self.parent.ui.reduceButton.setEnabled(False)
        
        self.nbr_reduction_process = self.calculate_nbr_reduction_process()
        self.cleanup()

        o_general_settings = GlobalReductionSettingsHandler(parent = self.parent)
        o_reduction_progressbar_handler = ProgressBarHandler(parent=self.parent)
        o_reduction_progressbar_handler.setup(nbr_reduction = self.nbr_reduction_process,
                                              label = 'Reduction Process ')
        
        for row_index in range(self.nbr_reduction_process):
            
            o_individual_settings = IndividualReductionSettingsHandler(parent = self.parent,
                                                                       row_index = row_index)
            
            # run reduction
            self.launch_reduction(o_general = o_general_settings,
                                  o_individual = o_individual_settings,
                                  debug = self.debug)
            if self.error:
                break
            
            self.save_reduction(row = row_index,
                                workspace = o_individual_settings._output_workspace_name)
            
            # scale
            o_calculate_sf = LiveCalculateSF(parent = self.parent,
                                             row_index = row_index)
            o_calculate_sf.run()
            
            # plot
            o_reduced_plot = LiveReducedDataHandler(parent = self.parent,
                                                    row_index = row_index)
            o_reduced_plot.populate_table()
            o_reduced_plot.live_plot()

            o_reduction_progressbar_handler.next_step()

        self.parent.big_table_data = self.big_table_data
        o_reduction_progressbar_handler.end()
        self.parent.ui.reduceButton.setEnabled(True)
        
        # save reduced data
        self.save_reduced_for_ascii_loaded()
        
        StatusMessageHandler(parent = self.parent, 
                             message = 'Done!', 
                             is_threaded = True)
    def __init__(self, parent=None):
        self.parent = parent


        nbr_lconfig = self.get_nbr_lconfig()
        big_table_data = self.parent.big_table_data
        o_load_config_progressbar_handler = ProgressBarHandler(parent = parent)
        o_load_config_progressbar_handler.setup(nbr_reduction = nbr_lconfig,
                                                label = 'Loading Config.')
        
        for index_row, lconfig in enumerate(big_table_data[:,2]):
            if lconfig is None:
                o_load_config_progressbar_handler.end()
                return
            
            list_data_run = lconfig.data_sets
            o_list_data_nexus = LocateListRun(list_run = list_data_run)
            list_data_nexus= o_list_data_nexus.list_run_found
            _add_data_nexus = AddListNexus(list_nexus = list_data_nexus,
                                           list_run = list_data_run,
                                           metadata_only = False,
                                           check_nexus_compatibility = False,
                                           prefix = 'data')
            data_lrdata = LRData(_add_data_nexus.wks)
            self.update_lrdata(lrdata = data_lrdata, 
                               lconfig = lconfig, 
                               type = 'data',
                               row = index_row)
                        
            list_norm_run = lconfig.norm_sets
            o_list_norm_nexus = LocateListRun(list_run = list_norm_run)
            list_norm_nexus = o_list_norm_nexus.list_run_found
            if list_norm_nexus != []:
                _add_norm_nexus = AddListNexus(list_nexus = list_norm_nexus,
                                               list_run = list_norm_run,
                                               metadata_only = False,
                                               check_nexus_compatibility = False,
                                               prefix = 'norm')
                norm_lrdata = LRData(_add_norm_nexus.wks)
                self.update_lrdata(lrdata = norm_lrdata, 
                                   lconfig = lconfig, 
                                   type = 'norm',
                                   row = index_row)

            is_display_requested = self.display_of_this_row_checked(index_row)
            if is_display_requested:
                self.display_plots(row = index_row)
                
            o_load_config_progressbar_handler.next_step()
Пример #4
0
    def run(self):
        _big_table_data = self.big_table_data
        _data_0_0 = _big_table_data[0, 0]
        if _data_0_0 is None:
            return

        StatusMessageHandler(parent=self.parent,
                             message='Running reduction ...',
                             is_threaded=False)

        self.parent.ui.reduceButton.setEnabled(False)

        self.cleanup()

        o_general_settings = GlobalReductionSettingsHandler(parent=self.parent)
        o_reduction_progressbar_handler = ProgressBarHandler(
            parent=self.parent)
        o_reduction_progressbar_handler.setup(
            nbr_reduction=self.nbr_reduction_process,
            label='Reduction Process ')

        for row_index in range(self.nbr_reduction_process):
            o_individual_settings = IndividualReductionSettingsHandler(
                parent=self.parent, row_index=row_index)

            # run reduction
            try:
                self.launch_reduction(o_general=o_general_settings,
                                      o_individual=o_individual_settings)
            except:
                logging.error(sys.exc_info()[1])
                self.parent.ui.reduceButton.setEnabled(True)
                StatusMessageHandler(parent=self.parent,
                                     message='Failed!',
                                     is_threaded=True)
                return

            self.save_reduction(
                row=row_index,
                workspace=o_individual_settings._output_workspace_name)

            # scale
            o_calculate_sf = LiveCalculateSF(parent=self.parent,
                                             row_index=row_index)
            o_calculate_sf.run()

            # plot
            o_reduced_plot = LiveReducedDataHandler(parent=self.parent,
                                                    row_index=row_index)
            o_reduced_plot.populate_table()
            o_reduced_plot.live_plot()
            self.parent.ui.data_stitching_plot.draw()
            QApplication.processEvents()

            o_reduction_progressbar_handler.next_step()

        o_reduced_plot.save_xy_axis()
        self.parent.big_table_data = self.big_table_data
        o_reduction_progressbar_handler.end()
        self.parent.ui.reduceButton.setEnabled(True)

        # save reduced data
        self.save_reduced_for_ascii_loaded()

        # save size of view for home button
        self.save_stitching_plot_view()

        StatusMessageHandler(parent=self.parent,
                             message='Done!',
                             is_threaded=True)
Пример #5
0
    def __init__(self, parent=None):
        self.parent = parent

        nbr_lconfig = self.get_nbr_lconfig()
        big_table_data = self.parent.big_table_data
        o_load_config_progressbar_handler = ProgressBarHandler(parent=parent)
        o_load_config_progressbar_handler.setup(nbr_reduction=nbr_lconfig,
                                                label='Loading Config.')

        b_refresh_display_after_full_loading = False  #only if no clocking info of plot displayed
        for index_row, lconfig in enumerate(big_table_data[:, 2]):
            if lconfig is None:
                o_load_config_progressbar_handler.end()
                break

            list_data_run = lconfig.data_sets
            o_list_data_nexus = LocateListRun(list_run=list_data_run)
            list_data_nexus = o_list_data_nexus.list_nexus_found
            #            list_data_nexus= o_list_data_nexus.list_run_found
            _add_data_nexus = AddListNexus(list_nexus=list_data_nexus,
                                           list_run=list_data_run,
                                           metadata_only=False,
                                           check_nexus_compatibility=False,
                                           prefix='data')
            data_lrdata = LRData(_add_data_nexus.wks,
                                 lconfig=lconfig,
                                 is_data=True,
                                 parent=self.parent)
            self.update_lrdata(lrdata=data_lrdata,
                               lconfig=lconfig,
                               type='data',
                               row=index_row)

            list_norm_run = lconfig.norm_sets
            o_list_norm_nexus = LocateListRun(list_run=list_norm_run)
            list_norm_nexus = o_list_norm_nexus.list_nexus_found
            if list_norm_nexus != []:
                _add_norm_nexus = AddListNexus(list_nexus=list_norm_nexus,
                                               list_run=list_norm_run,
                                               metadata_only=False,
                                               check_nexus_compatibility=False,
                                               prefix='norm')
                norm_lrdata = LRData(_add_norm_nexus.wks,
                                     is_data=False,
                                     parent=self.parent)
                self.update_lrdata(lrdata=norm_lrdata,
                                   lconfig=lconfig,
                                   type='norm',
                                   row=index_row)

            is_display_requested = self.display_of_this_row_checked(index_row)
            if is_display_requested:
                self.display_plots(row=index_row)

            if is_display_requested and data_lrdata.clocking == ['', '']:
                b_refresh_display_after_full_loading = True

            o_load_config_progressbar_handler.next_step()

        self.globalize_clocking_parameters()
        big_table_data = self.parent.big_table_data
        if b_refresh_display_after_full_loading:
            for index_row, lconfig in enumerate(big_table_data[:, 2]):
                if lconfig is None:
                    return
                is_display_requested = self.display_of_this_row_checked(
                    index_row)
                if is_display_requested:
                    self.display_plots(row=index_row)