Example #1
0
 def _show_missing_warning(self):
     dlg = ErrorMessage()
     dlg.err_msg = 'This matrix has missing values'
     dlg.err_val = ("At the current version of ConsumerCheck Prefmap does not handle missing values. There are three options to work around this problem:\n"
                    "  1. Impute the missing values with the imputation method of your choice outside ConsumerCheck and re-import the data\n"
                    "  2. Remove the column with the missing values and re-import the data\n"
                    "  3. Remove the row with the missing values and re-import the data")
     dlg.edit_traits(parent=self.win_handle, kind='modal')
Example #2
0
 def _show_alignment_warning(self, nds, nls, nlc, nca=0):
     dlg = ErrorMessage()
     dlg.err_msg = 'Alignment mismatch between the data set'
     dlg.err_val = 'There is {0} variants in the design matrix and {1} variants in the liking matrix. There is {2} consumers in the liking matrix and {3} consumers in the consumer characteristics matrix'.format(
         nds, nls, nlc, nca)
     dlg.edit_traits(parent=self.win_handle, kind='modal')
Example #3
0
 def _show_alignment_warning(self, ds_c, ds_s):
     dlg = ErrorMessage()
     dlg.err_msg = 'Consumer liking and sensory profiling data does not align'
     dlg.err_val = 'The Consumer liking data and descriptive analysis/sensory profiling data do not align. There are {0} rows in {1} and {2} rows in the {3}. Please select other data.'.format(ds_c.n_objs, ds_c.display_name, ds_s.n_objs, ds_s.display_name)
     dlg.edit_traits(parent=self.win_handle, kind='modal')
Example #4
0
 def _show_zero_var_warning(self):
     dlg = ErrorMessage()
     dlg.err_msg = 'Removed zero variance variables'
     dlg.err_val = ', '.join(self.model.C_zero_std+self.model.S_zero_std)
     dlg.edit_traits(parent=self.win_handle, kind='modal')
Example #5
0
def dclk_activator(obj):
    owner = obj.owner_ref
    pfn = obj.plot_func_name
    if isinstance(owner, SegmentTE):
        segments = owner.calcc.model.selected_segments
        try:
            n = 0
            n = len(segments)
            if n < 2:
                raise Exception()
        except (TypeError, Exception):
            dlg = ErrorMessage()
            dlg.err_msg = 'You have to define 2 or more segments before you can do this analysis'
            dlg.err_val = 'Defined segments: {}'.format(n)
            # dlg.edit_traits(parent=self.win_handle, kind='modal')
            dlg.configure_traits()
            return
        res = owner.calcc.model.calc_plsr_da(segments)
        func = getattr(owner.calcc, pfn)
        view = func(res)
        loop = owner.plots_act
        owner.calcc.open_window(view, loop, res)
    elif isinstance(owner, ColorTE):
        res = owner.calcc.model.pca_L
        func = getattr(owner.calcc, pfn)
        view = func(res, owner.name)
        loop = owner.plots_act
        owner.calcc.open_window(view, loop, res)
    elif isinstance(owner, PCLikingTE):
        selpc = owner.calcc.model.settings.selected_liking_pc
        try:
            n = 0
            n = len(selpc)
            if n < 1:
                raise Exception()
        except Exception:
            dlg = ErrorMessage()
            dlg.err_msg = 'You have to select principal components of consumer liking'
            dlg.err_val = ''
            # dlg.edit_traits(parent=self.win_handle, kind='modal')
            dlg.configure_traits()
            return
        res = owner.calcc.model.calc_pls_pc_likings(selpc)
        func = getattr(owner.calcc, pfn)
        view = func(res)
        loop = owner.plots_act
        owner.calcc.open_window(view, loop, res)
    elif isinstance(owner, TreeElement):
        res = owner.calcc.model.calc_pls_raw_liking()
        func = getattr(owner.calcc, pfn)
        view = func(res)
        loop = owner.plots_act
        owner.calcc.open_window(view, loop, res)
    elif isinstance(owner, IndDiffController):
        func = getattr(owner, pfn)
        func()