Пример #1
0
	def __init__(self, label = 'another reaction', 
			rate = float(10.0), propensity_scheme = 'classic', 
			propensity_function_maker = None, parent = None, 
			occurrences = [], used = None, produced = None, 
			visible_attributes = ['label', 'propensity_scheme', 
								'rate', 'used', 'produced']):
		self.system = None
		self.rate = rate
		if occurrences is None: self.occurrences = []
		else: self.occurrences = occurrences
		#instances of these are somehow coupled unless a 
		#	used and produced list is passed to init, 
		#	EVEN an empty list will do (used = [] does not!)
		if used is None: self.used = []
		else: self.used = used
		if produced is None: self.produced = []
		else: self.produced = produced
		self.propensity = 1.0
		self.propensity_minimum = 1e-30
		self.propensity_scheme = propensity_scheme
		parameter_space_templates =\
			[lgeo.interface_template_p_space_axis(parent = self, 
							p_sp_bounds = [0.0000001, 1000.0], 
							instance = self, key = 'rate')]
		modular_object.__init__(self, label = label, parent = parent, 
							visible_attributes = visible_attributes, 
			parameter_space_templates = parameter_space_templates)
Пример #2
0
	def __init__(self, *args, **kwargs):
		if 'label' not in kwargs.keys(): kwargs['label'] = 'variable'
		self.impose_default('value', 1.0, **kwargs)
		self.brand_new = True
		parameter_space_templates =			[lgeo.interface_template_p_space_axis(instance = self, 
								p_sp_bounds = ['-10e64', '10e64'], 
									parent = self, key = 'value')]
		modular_object.__init__(self, *args, 
			parameter_space_templates =				parameter_space_templates, **kwargs)
Пример #3
0
 def __init__(self, *args, **kwargs):
     if "label" not in kwargs.keys():
         kwargs["label"] = "variable"
     self.impose_default("value", 1.0, **kwargs)
     self.brand_new = True
     parameter_space_templates = [
         lgeo.interface_template_p_space_axis(
             instance=self, p_sp_bounds=["-10e64", "10e64"], parent=self, key="value"
         )
     ]
     modular_object.__init__(self, *args, parameter_space_templates=parameter_space_templates, **kwargs)
Пример #4
0
	def __init__(self, *args, **kwargs):
		if 'label' not in kwargs.keys(): kwargs['label'] = 'variable'
		self.impose_default('value', 1.0, **kwargs)
		self.brand_new = True
		parameter_space_templates =\
			[lgeo.interface_template_p_space_axis(instance = self, 
								p_sp_bounds = ['-10e64', '10e64'], 
									parent = self, key = 'value')]
		modular_object.__init__(self, *args, 
			parameter_space_templates =\
				parameter_space_templates, **kwargs)
Пример #5
0
    def set_settables(self, *args, **kwargs):
        ensem = args[1]
        self.parent = ensem
        window = args[0]
        if self.brand_new:
            ensem.run_params["plot_targets"].append(self.label)
            plan = ensem.run_params["output_plans"]["Simulation"]
            plan.targeted.append(self.label)
            plan.rewidget(True)
            for subtargeted in plan.outputs:
                subtargeted.append(self.label)

            self.brand_new = not self.brand_new

            # dictionary_support = lgm.dictionary_support_mason(window)
        where_reference = ensem.run_params["variables"]
        cartographer_support = lgm.cartographer_mason(window)
        self.handle_widget_inheritance(*args, **kwargs)
        self.parameter_space_templates = [
            lgeo.interface_template_p_space_axis(
                parent=self, p_sp_bounds=self._p_sp_bounds_[0], instance=self, key="value"
            )
        ]
        self.parameter_space_templates[0].set_settables(*args, **kwargs)
        self.widg_templates.append(
            lgm.interface_template_gui(
                widgets=["spin"],
                doubles=[[True]],
                initials=[[float(self.value)]],
                instances=[[self]],
                keys=[["value"]],
                box_labels=["Variable Value"],
                mason=cartographer_support,
                parameter_space_templates=[self.parameter_space_templates[0]],
            )
        )
        self.widg_templates.append(
            lgm.interface_template_gui(
                widgets=["text"],
                # mason = dictionary_support,
                # wheres = [[where_reference]],
                keys=[["label"]],
                instances=[[self]],
                initials=[[self.label]],
                box_labels=["Variable Name"],
            )
        )
        modular_object.set_settables(self, *args, from_sub=True)
Пример #6
0
	def __init__(self, label = 'another species', initial_count = 0, 
						current_count = None, visible_attributes = \
						['label', 'initial_count'], parent = None):
		self.system = None
		self.initial_count = initial_count
		if current_count == None: self.current_count = initial_count
		else: self.current_count = current_count
		self.brand_new = True
		parameter_space_templates =\
			[lgeo.interface_template_p_space_axis(instance = self, 
				key = 'initial_count', p_sp_bounds = [0, 1000000], 
					p_sp_increment = 1, p_sp_continuous = False, 
									parent = self)]
		modular_object.__init__(self, label = label, 
						visible_attributes = visible_attributes, 
			parameter_space_templates = parameter_space_templates)
Пример #7
0
 def __init__(self, label = 'another species', initial_count = 0,
      current_count = None, visible_attributes = \
      ['label', 'initial_count'], parent = None):
     self.system = None
     self.initial_count = initial_count
     if current_count == None: self.current_count = initial_count
     else: self.current_count = current_count
     self.brand_new = True
     parameter_space_templates =\
      [lgeo.interface_template_p_space_axis(instance = self,
       key = 'initial_count', p_sp_bounds = [0, 1000000],
        p_sp_increment = 1, p_sp_continuous = False,
            parent = self)]
     modular_object.__init__(
         self,
         label=label,
         visible_attributes=visible_attributes,
         parameter_space_templates=parameter_space_templates)
Пример #8
0
    def set_settables(self, *args, **kwargs):
        ensem = args[1]
        self.parent = ensem
        window = args[0]
        if self.brand_new:
            ensem.run_params['plot_targets'].append(self.label)
            plan = ensem.run_params['output_plans']['Simulation']
            plan.targeted.append(self.label)
            plan.rewidget(True)
            for subtargeted in plan.outputs:
                subtargeted.append(self.label)

            self.brand_new = not self.brand_new

        #dictionary_support = lgm.dictionary_support_mason(window)
        where_reference = ensem.run_params['variables']
        cartographer_support = lgm.cartographer_mason(window)
        self.handle_widget_inheritance(*args, **kwargs)
        self.parameter_space_templates =\
         [lgeo.interface_template_p_space_axis(parent = self,
             p_sp_bounds = self._p_sp_bounds_[0],
              instance = self, key = 'value')]
        self.parameter_space_templates[0].set_settables(*args, **kwargs)
        self.widg_templates.append(
         lgm.interface_template_gui(
          widgets = ['spin'],
          doubles = [[True]],
          initials = [[float(self.value)]],
          instances = [[self]],
          keys = [['value']],
          box_labels = ['Variable Value'],
          mason = cartographer_support,
          parameter_space_templates =\
           [self.parameter_space_templates[0]]))
        self.widg_templates.append(
            lgm.interface_template_gui(
                widgets=['text'],
                #mason = dictionary_support,
                #wheres = [[where_reference]],
                keys=[['label']],
                instances=[[self]],
                initials=[[self.label]],
                box_labels=['Variable Name']))
        lfu.modular_object_qt.set_settables(self, *args, from_sub=True)
Пример #9
0
 def set_settables(self, *args, **kwargs):
     ensem = args[1]
     window = args[0]
     spec_list = ensem.run_params['species'].keys()
     cartographer_support = lgm.cartographer_mason(window)
     self.handle_widget_inheritance(*args, **kwargs)
     self.parameter_space_templates =\
      [lgeo.interface_template_p_space_axis(parent = self,
          p_sp_bounds = self._p_sp_bounds_[0],
           instance = self, key = 'rate')]
     self.parameter_space_templates[0].set_settables(*args, **kwargs)
     left_template = lgm.interface_template_gui(
         panel_position=(0, 2),
         mason=cartographer_support,
         layout='vertical',
         keys=[['label'], ['rate']],
         instances=[[self], [self]],
         widgets=['text', 'text'],
         minimum_sizes=[[(400, 100)], [(100, 100)]],
         box_labels=['Reaction Name', 'Reaction Rate'],
         initials=[[self.label], [self.rate]],
         parameter_space_templates=[
             None, self.parameter_space_templates[0]
         ])
     self.verify_agents(spec_list)
     agents_template = lgm.interface_template_gui(
         panel_position=(0, 0),
         layout='horizontal',
         widgets=['check_spin_list', 'check_spin_list'],
         keys=[['used'], ['produced']],
         instances=[[self], [self]],
         labels=[spec_list, spec_list],
         box_labels=['Reagents', 'Products'])
     self.widg_templates.append(
         lgm.interface_template_gui(
             widgets=['splitter'],
             orientations=[['horizontal']],
             templates=[[left_template, agents_template]]))
     modular_object.set_settables(self, *args, from_sub=True)
Пример #10
0
	def set_settables(self, *args, **kwargs):
		ensem = args[1]
		window = args[0]
		spec_list = ensem.run_params['species'].keys()
		cartographer_support = lgm.cartographer_mason(window)
		self.handle_widget_inheritance(*args, **kwargs)
		self.parameter_space_templates =\
			[lgeo.interface_template_p_space_axis(parent = self, 
							p_sp_bounds = self._p_sp_bounds_[0], 
								instance = self, key = 'rate')]
		self.parameter_space_templates[0].set_settables(*args, **kwargs)
		left_template = lgm.interface_template_gui(
				panel_position = (0, 2), 
				mason = cartographer_support, 
				layout = 'vertical', 
				keys = [['label'], ['rate']], 
				instances = [[self], [self]], 
				widgets = ['text', 'text'], 
				minimum_sizes = [[(400, 100)], [(100, 100)]], 
				box_labels = ['Reaction Name', 'Reaction Rate'], 
				initials = [[self.label], [self.rate]], 
				parameter_space_templates = [None, 
					self.parameter_space_templates[0]])
		self.verify_agents(spec_list)
		agents_template = lgm.interface_template_gui(
				panel_position = (0, 0), 
				layout = 'horizontal', 
				widgets = ['check_spin_list', 'check_spin_list'], 
				keys = [['used'], ['produced']], 
				instances = [[self], [self]], 
				labels = [spec_list, spec_list],
				box_labels = ['Reagents', 'Products'])
		self.widg_templates.append(
			lgm.interface_template_gui(
				widgets = ['splitter'], 
				orientations = [['horizontal']], 
				templates = [[left_template, agents_template]]))
		modular_object.set_settables(self, *args, from_sub = True)
Пример #11
0
 def __init__(self,
              label='another reaction',
              rate=float(10.0),
              propensity_scheme='classic',
              propensity_function_maker=None,
              parent=None,
              occurrences=[],
              used=None,
              produced=None,
              visible_attributes=[
                  'label', 'propensity_scheme', 'rate', 'used', 'produced'
              ]):
     self.system = None
     self.rate = rate
     if occurrences is None: self.occurrences = []
     else: self.occurrences = occurrences
     #instances of these are somehow coupled unless a
     #	used and produced list is passed to init,
     #	EVEN an empty list will do (used = [] does not!)
     if used is None: self.used = []
     else: self.used = used
     if produced is None: self.produced = []
     else: self.produced = produced
     self.propensity = 1.0
     self.propensity_minimum = 1e-30
     self.propensity_scheme = propensity_scheme
     parameter_space_templates =\
      [lgeo.interface_template_p_space_axis(parent = self,
          p_sp_bounds = [0.0000001, 1000.0],
          instance = self, key = 'rate')]
     modular_object.__init__(
         self,
         label=label,
         parent=parent,
         visible_attributes=visible_attributes,
         parameter_space_templates=parameter_space_templates)
Пример #12
0
	def set_settables(self, *args, **kwargs):
		window = args[0]
		self.parent = args[1]
		ensem = self.parent
		cartographer_support = lgm.cartographer_mason(window)
		self.handle_widget_inheritance(*args, **kwargs)
		if self.brand_new:
			ensem.run_params['plot_targets'].append(self.label)
			plan = ensem.run_params['output_plans']['Simulation']
			plan.targeted.append(self.label)
			plan.rewidget(True)
			for subtargeted in plan.outputs:
				subtargeted.append(self.label)

			self.brand_new = not self.brand_new

		label_data_links = [lfu.interface_template_dependance(
								(self, 'label', self.label), 
								linkages = [(ensem.run_params, 
										'plot_targets', True, 
											'append_list')])]
		#this will cause a bug if a propensity_function_maker class
		# with a .key attribute which should not be linked to the
		# species name exists - so do not use one with this module
		#on the other hand, a subclass which uses .key exploits this
		#	this bug can be fixed with name mangling on the base class!!

		label_data_links.extend([lfu.interface_template_dependance(
			(self, 'label', self.label), linkages =\
				[(ensem.run_params['output_plans']['Simulation'], 
							'targeted', True, 'append_list')])])
		[label_data_links.extend([lfu.interface_template_dependance(
			(self, 'label', self.label), linkages =\
				[(ensem.run_params['output_plans']['Simulation'], 
					'outputs', True, 'append_list_nested', dex)])]) 
											for dex in range(4)]
		label_data_links.extend(
			[lfu.interface_template_dependance(
				(self, 'label', self.label), 
				linkages = [(rxn, 'used', True, 
					'append_tuples_list', 0, 0)]) 
					for rxn in ensem.run_params['reactions']])
		label_data_links.extend(
			[lfu.interface_template_dependance(
				(self, 'label', self.label), 
				linkages = [(rxn, 'produced', True, 
					'append_tuples_list', 0, 0)]) 
					for rxn in ensem.run_params['reactions']])		
		window = args[1]
		self.handle_widget_inheritance(*args, **kwargs)
		self.parameter_space_templates =\
			[lgeo.interface_template_p_space_axis(instance = self, 
							key = 'initial_count', parent = self, 
							p_sp_bounds = self._p_sp_bounds_[0], 
							p_sp_increment = self._p_sp_increments_[0], 
											p_sp_continuous = False)]
		self.parameter_space_templates[0].set_settables(*args, **kwargs)
		self.widg_templates.append(
			lgm.interface_template_gui(
				mason = cartographer_support, 
				widgets = ['spin'], 
				instances = [[self]], 
				keys = [['initial_count']], 
				minimum_values = [[0]], 
				maximum_values = [[sys.maxint]], 
				initials = [[self.initial_count]], 
				box_labels = ['Initial Count'], 
				parameter_space_templates =\
					[self.parameter_space_templates[0]]))
		self.widg_templates.append(
			lgm.interface_template_gui(
				keys = [['label']], 
				minimum_sizes = [[(150, 50)]], 
				instances = [[self]], 
				widgets = ['text'], 
				box_labels = ['Species Name']))
		modular_object.set_settables(self, *args, from_sub = True)
Пример #13
0
    def set_settables(self, *args, **kwargs):
        window = args[0]
        self.parent = args[1]
        ensem = self.parent
        cartographer_support = lgm.cartographer_mason(window)
        self.handle_widget_inheritance(*args, **kwargs)
        if self.brand_new:
            ensem.run_params['plot_targets'].append(self.label)
            plan = ensem.run_params['output_plans']['Simulation']
            plan.targeted.append(self.label)
            plan.rewidget(True)
            for subtargeted in plan.outputs:
                subtargeted.append(self.label)

            self.brand_new = not self.brand_new

        label_data_links = [
            lfu.interface_template_dependance(
                (self, 'label', self.label),
                linkages=[(ensem.run_params, 'plot_targets', True,
                           'append_list')])
        ]
        #this will cause a bug if a propensity_function_maker class
        # with a .key attribute which should not be linked to the
        # species name exists - so do not use one with this module
        #on the other hand, a subclass which uses .key exploits this
        #	this bug can be fixed with name mangling on the base class!!

        label_data_links.extend([lfu.interface_template_dependance(
         (self, 'label', self.label), linkages =\
          [(ensem.run_params['output_plans']['Simulation'],
             'targeted', True, 'append_list')])])
        [label_data_links.extend([lfu.interface_template_dependance(
         (self, 'label', self.label), linkages =\
          [(ensem.run_params['output_plans']['Simulation'],
           'outputs', True, 'append_list_nested', dex)])])
                 for dex in range(4)]
        label_data_links.extend([
            lfu.interface_template_dependance(
                (self, 'label', self.label),
                linkages=[(rxn, 'used', True, 'append_tuples_list', 0, 0)])
            for rxn in ensem.run_params['reactions']
        ])
        label_data_links.extend([
            lfu.interface_template_dependance(
                (self, 'label', self.label),
                linkages=[(rxn, 'produced', True, 'append_tuples_list', 0, 0)])
            for rxn in ensem.run_params['reactions']
        ])
        window = args[1]
        self.handle_widget_inheritance(*args, **kwargs)
        self.parameter_space_templates =\
         [lgeo.interface_template_p_space_axis(instance = self,
             key = 'initial_count', parent = self,
             p_sp_bounds = self._p_sp_bounds_[0],
             p_sp_increment = self._p_sp_increments_[0],
                 p_sp_continuous = False)]
        self.parameter_space_templates[0].set_settables(*args, **kwargs)
        self.widg_templates.append(
         lgm.interface_template_gui(
          mason = cartographer_support,
          widgets = ['spin'],
          instances = [[self]],
          keys = [['initial_count']],
          minimum_values = [[0]],
          maximum_values = [[sys.maxint]],
          initials = [[self.initial_count]],
          box_labels = ['Initial Count'],
          parameter_space_templates =\
           [self.parameter_space_templates[0]]))
        self.widg_templates.append(
            lgm.interface_template_gui(keys=[['label']],
                                       minimum_sizes=[[(150, 50)]],
                                       instances=[[self]],
                                       widgets=['text'],
                                       box_labels=['Species Name']))
        modular_object.set_settables(self, *args, from_sub=True)