Exemplo n.º 1
0
    def __setattr__(self, attribute_name, value):
        """
        We need to override the Parametrized __setattr__ to handle setting of SParameterSet parameters.
        """
        def set_in_dict(path, dt, value):
            keys = path.split('_')
            for key in keys[:-1]:
                dt = dt[key]
            dt[keys[-1]] = value

        if hasattr(self, 'expanded_params_names'):
            if attribute_name in self.expanded_params_names:
                self.expanded_paramset_params_dict[attribute_name] = value

                n = []
                for z in self.expanded_paramset_params:
                    if z[0] == attribute_name:
                        n.append((z[0], value))
                    else:
                        n.append(z)
                self.expanded_paramset_params = n

                #HAAAAAAAAAAAAACK
                if attribute_name == 'stimulating_signal_parameters_orientation':
                    getattr(
                        self, 'direct_stimulation_parameters'
                    )['stimulating_signal_parameters']['orientation'] = value

                if attribute_name == 'stimulating_signal_parameters_scale':
                    getattr(self, 'direct_stimulation_parameters'
                            )['stimulating_signal_parameters']['scale'] = value

                if attribute_name == 'stimulating_signal_parameters_contrast':
                    getattr(
                        self, 'direct_stimulation_parameters'
                    )['stimulating_signal_parameters']['contrast'] = value

                if attribute_name == 'stimulating_signal_parameters_size':
                    getattr(self, 'direct_stimulation_parameters'
                            )['stimulating_signal_parameters']['size'] = value

                #set_in_dict(attribute_name,getattr(self,'direct_stimulation_parameters'),value)
                #set_in_dict(path[1:,],self.params()[path[0]],value)
                return
        Parameterized.__setattr__(self, attribute_name, value)
        Parameterized.__setattr__(self, 'cached_get_param_values', None)
Exemplo n.º 2
0
    def __setattr__(self,attribute_name,value):
        """
        We need to override the Parametrized __setattr__ to handle setting of SParameterSet parameters.
        """
        def set_in_dict(path, dt,value):
            keys = path.split('_')
            for key in keys[:-1]:
                dt = dt[key]
            dt[keys[-1]]=value

        if hasattr(self, 'expanded_params_names'):
            if attribute_name in self.expanded_params_names:
                self.expanded_paramset_params_dict[attribute_name] = value;

                n =[]
                for z in self.expanded_paramset_params:
                    if z[0] == attribute_name:
                       n.append((z[0],value)) 
                    else:
                       n.append(z)   
                self.expanded_paramset_params = n

                #HAAAAAAAAAAAAACK
                if attribute_name == 'stimulating_signal_parameters_orientation':
                    getattr(self,'direct_stimulation_parameters')['stimulating_signal_parameters']['orientation']=value

                if attribute_name == 'stimulating_signal_parameters_scale':
                    getattr(self,'direct_stimulation_parameters')['stimulating_signal_parameters']['scale']=value

                if attribute_name == 'stimulating_signal_parameters_contrast':
                    getattr(self,'direct_stimulation_parameters')['stimulating_signal_parameters']['contrast']=value

                if attribute_name == 'stimulating_signal_parameters_size':
                    getattr(self,'direct_stimulation_parameters')['stimulating_signal_parameters']['size']=value


                #set_in_dict(attribute_name,getattr(self,'direct_stimulation_parameters'),value)
                #set_in_dict(path[1:,],self.params()[path[0]],value)
                return
        Parameterized.__setattr__(self,attribute_name,value)
        Parameterized.__setattr__(self,'cached_get_param_values',None)
Exemplo n.º 3
0
 def get_param_values(self,onlychanged=False):
     if self.cached_get_param_values == None:
        Parameterized.__setattr__(self,'cached_get_param_values',Parameterized.get_param_values(self,onlychanged))
     return self.cached_get_param_values
Exemplo n.º 4
0
 def get_param_values(self,onlychanged=False):
     if self.cached_get_param_values == None:
        Parameterized.__setattr__(self,'cached_get_param_values',Parameterized.get_param_values(self,onlychanged))
     return self.cached_get_param_values