示例#1
0
    def __init__(self,
                 parent=None,
                 verify_pass_func=None,
                 base_class=None,
                 bRelevant=True,
                 label='criterion',
                 valid_base_classes=None,
                 visible_attributes=['label', 'base_class', 'bRelevant'],
                 **kwargs):
        if valid_base_classes is None:
            global valid_criterion_base_classes
            valid_base_classes = valid_criterion_base_classes

        if base_class is None:
            base_class = lfu.interface_template_class(object,
                                                      'criterion abstract')

        if verify_pass_func is not None:
            self.verify_pass = verify_pass_func

        self.bRelevant = bRelevant  #checking relevance is the
        #responsibility of the owner of the criterion!!
        lfu.modular_object_qt.__init__(self,
                                       parent=parent,
                                       label=label,
                                       visible_attributes=visible_attributes,
                                       valid_base_classes=valid_base_classes,
                                       base_class=base_class)
        self._children_ = []
示例#2
0
	def __init__(self, parent = None, max_captures = 100.0, base_class =\
		lfu.interface_template_class(object, 'capture limit'), 
			label = 'capture limit criterion', visible_attributes =\
			['label', 'base_class', 'bRelevant', 'max_captures']):
		criterion.__init__(self, parent = parent, label = label, 
										base_class = base_class)
		self.max_captures = max_captures
示例#3
0
 def __init__(self, *args, **kwargs):
     if not 'base_class' in kwargs.keys():
         kwargs['base_class'] = lfu.interface_template_class(
             trajectory_criterion_ceiling, 'ceiling limit')
     self.impose_default('ceiling', 2500, **kwargs)
     trajectory_criterion.__init__(self, *args, **kwargs)
     self._children_ = []
示例#4
0
	def __init__(self, *args, **kwargs):
		if not 'base_class' in kwargs.keys():
			kwargs['base_class'] = lfu.interface_template_class(
				trajectory_criterion_ceiling, 'ceiling limit')
		self.impose_default('ceiling', 2500, **kwargs)
		trajectory_criterion.__init__(self, *args, **kwargs)
		self._children_ = []
示例#5
0
 def __init__(self, parent = None, max_captures = 100.0, base_class =\
  lfu.interface_template_class(object, 'capture limit'),
   label = 'capture limit criterion', visible_attributes =\
   ['label', 'base_class', 'bRelevant', 'max_captures']):
     criterion.__init__(self,
                        parent=parent,
                        label=label,
                        base_class=base_class)
     self.max_captures = max_captures
示例#6
0
	def __init__(self, parent = None, max_iterations = 1000, base_class = None, 
			label = 'iteration criterion', visible_attributes =\
			['label', 'base_class', 'bRelevant', 'max_iterations'], **kwargs):
		if base_class is None:
			base_class = lfu.interface_template_class(
				criterion_iteration, 'iteration limit')
		criterion.__init__(self, parent = parent, label = label, 
										base_class = base_class)
		self.max_iterations = max_iterations
		self._children_ = []
示例#7
0
 def __init__(self, *args, **kwargs):
     if not 'base_class' in kwargs.keys():
         kwargs['base_class'] =\
          lfu.interface_template_class(
           object, 'trajectory criterion abstract')
     if not 'label' in kwargs.keys():
         kwargs['label'] = 'trajectory criterion'
     global valid_trajectory_criterion_base_classes
     kwargs['valid_base_classes'] =\
      valid_trajectory_criterion_base_classes
     criterion.__init__(self, *args, **kwargs)
示例#8
0
	def __init__(self, *args, **kwargs):
		if not 'label' in kwargs.keys():
			kwargs['label'] = 'timeout criterion'

		if not 'base_class' in kwargs.keys():
			kwargs['base_class'] = lfu.interface_template_class(
							criterion_impatient, 'timeout limit')

		self.impose_default('max_timeouts', 100, **kwargs)
		self.impose_default('max_last_best', 100, **kwargs)
		lc.criterion.__init__(self, *args, **kwargs)
示例#9
0
 def __init__(self,
              parent=None,
              filenames=[],
              label='another csv output writer',
              base_class=lfu.interface_template_class(
                  object, 'txt writer object')):
     self.filenames = filenames
     writer.__init__(self,
                     label=label,
                     parent=parent,
                     base_class=base_class)
示例#10
0
	def __init__(self, *args, **kwargs):
		if not 'base_class' in kwargs.keys():
			kwargs['base_class'] =\
				lfu.interface_template_class(
					object, 'trajectory criterion abstract')
		if not 'label' in kwargs.keys():
			kwargs['label'] = 'trajectory criterion'
		global valid_trajectory_criterion_base_classes
		kwargs['valid_base_classes'] =\
			valid_trajectory_criterion_base_classes
		criterion.__init__(self, *args, **kwargs)
示例#11
0
 def __init__(self, parent = None, max_iterations = 1000, base_class = None,
   label = 'iteration criterion', visible_attributes =\
   ['label', 'base_class', 'bRelevant', 'max_iterations'], **kwargs):
     if base_class is None:
         base_class = lfu.interface_template_class(criterion_iteration,
                                                   'iteration limit')
     criterion.__init__(self,
                        parent=parent,
                        label=label,
                        base_class=base_class)
     self.max_iterations = max_iterations
     self._children_ = []
示例#12
0
	def __init__(self, parent = None, increment = 10.0, key = 'time', 
			keys = ['iteration', 'time'], 
			base_class = lfu.interface_template_class(
							object, 'scalar increment'), 
			label = 'scalar increment criterion', visible_attributes =\
			['label', 'base_class', 'bRelevant', 'key', 'increment']):
		criterion.__init__(self, parent = parent, label = label, 
										base_class = base_class)
		#self.key expected to match dater.label
		self.key = key
		self.keys = keys
		self.increment = increment
示例#13
0
	def __init__(self, *args, **kwargs):
		if not 'label' in kwargs.keys():
			kwargs['label'] = 'simulated annealing routine'

		if not 'base_class' in kwargs.keys():
			kwargs['base_class'] = lfu.interface_template_class(
								object, 'simulated annealing')

		self.impose_default('cooling_curve', None, **kwargs)
		self.impose_default('max_temperature', 1000, **kwargs)
		self.impose_default('temperature', None, **kwargs)
		fit_routine.__init__(self, *args, **kwargs)
示例#14
0
    def __init__(self, parent = None, filenames = [],
     label = 'another output writer',
     base_class = lfu.interface_template_class(
         object, 'writer object'),
     valid_base_classes = None, visible_attributes =\
        ['label', 'base_class', 'filenames']):
        global valid_writers_base_classes
        if valid_base_classes is None:
            valid_base_classes = valid_writers_base_classes

        if base_class is None:
            base_class = lfu.interface_template_class(object, 'writer')

        self.filenames = filenames
        #lfu.modular_object_qt.__init__(self, label = label,
        lfu.modular_object_qt.__init__(self,
                                       visible_attributes=visible_attributes,
                                       valid_base_classes=valid_base_classes,
                                       parent=parent,
                                       base_class=base_class)
        self.axes_manager = plot_axes_manager(parent=self)
        self._children_ = [self.axes_manager]
示例#15
0
 def __init__(self,
              parent=None,
              filenames=[],
              iteration_resolution=1,
              label='another plt output writer',
              base_class=lfu.interface_template_class(
                  object, 'plt writer object')):
     self.filenames = filenames
     self.iteration_resolution = iteration_resolution
     writer.__init__(self,
                     label=label,
                     parent=parent,
                     base_class=base_class)
示例#16
0
	def __init__(self, *args, **kwargs):
		if not 'base_class' in kwargs.keys():
			kwargs['base_class'] = lfu.interface_template_class(
									object, 'layout reduction')
		if not 'label' in kwargs.keys():
			kwargs['label'] = 'layout reduction'
		if not 'valid_regimes' in kwargs.keys():
			kwargs['valid_regimes'] = ['all trajectories']
		if not 'regime' in kwargs.keys():
			kwargs['regime'] = 'all trajectories'

		#self.impose_default('function_of', None, **kwargs)
		post_process_plate_reader.__init__(self, *args, **kwargs)
示例#17
0
    def __init__(self, *args, **kwargs):
        if not 'base_class' in kwargs.keys():
            kwargs['base_class'] = lfu.interface_template_class(
                object, 'layout reduction')
        if not 'label' in kwargs.keys():
            kwargs['label'] = 'layout reduction'
        if not 'valid_regimes' in kwargs.keys():
            kwargs['valid_regimes'] = ['all trajectories']
        if not 'regime' in kwargs.keys():
            kwargs['regime'] = 'all trajectories'

        #self.impose_default('function_of', None, **kwargs)
        post_process_plate_reader.__init__(self, *args, **kwargs)
示例#18
0
 def __init__(self, parent = None, increment = 10.0, key = 'time',
   keys = ['iteration', 'time'],
   base_class = lfu.interface_template_class(
       object, 'scalar increment'),
   label = 'scalar increment criterion', visible_attributes =\
   ['label', 'base_class', 'bRelevant', 'key', 'increment']):
     criterion.__init__(self,
                        parent=parent,
                        label=label,
                        base_class=base_class)
     #self.key expected to match dater.label
     self.key = key
     self.keys = keys
     self.increment = increment
示例#19
0
	def __init__(self, *args, **kwargs):
		if not 'valid_base_classes' in kwargs.keys():
			global valid_metric_base_classes
			kwargs['valid_base_classes'] = valid_metric_base_classes

		if not 'base_class' in kwargs.keys():
			kwargs['base_class'] = lfu.interface_template_class(
									object, 'abstract metric')

		self.impose_default('best_measure', 0, **kwargs)
		self.impose_default('display_threshold', 0, **kwargs)
		self.impose_default('display_time', 1.0, **kwargs)
		self.impose_default('acceptance_weight', 1.0, **kwargs)
		self.impose_default('best_advantage', 2.0, **kwargs)
		self.impose_default('best_flag', False, **kwargs)
		self.impose_default('is_heaviest', False, **kwargs)
		lfu.modular_object_qt.__init__(self, *args, **kwargs)
		self._children_ = []
示例#20
0
	def __init__(	self, parent = None, verify_pass_func = None, 
					base_class = None, bRelevant = True, 
					label = 'criterion', 
					valid_base_classes = None, 
					visible_attributes = ['label', 
						'base_class', 'bRelevant'], **kwargs	):
		if valid_base_classes is None:
			global valid_criterion_base_classes
			valid_base_classes = valid_criterion_base_classes

		if base_class is None:
			base_class = lfu.interface_template_class(
							object, 'criterion abstract')

		if verify_pass_func is not None:
			self.verify_pass = verify_pass_func

		self.bRelevant = bRelevant	#checking relevance is the
				#responsibility of the owner of the criterion!!
		lfu.modular_object_qt.__init__(self, parent= parent, 
			label = label, visible_attributes = visible_attributes, 
							valid_base_classes = valid_base_classes, 
											base_class = base_class)
		self._children_ = []
示例#21
0
	npts = xdim*ydim*zdim
	flat = ['0']*npts
	for j in range(len(Q)):
		try:
			flat[int(z[j])*xdim*ydim + int(y[j])*xdim + int(x[j])]=str(Q[j])

		except IndexError:
			print 'Youve got an indexing problem'
			pdb.set_trace()

	string = array_to_string(flat)
	return string

valid_metric_base_classes = [
	lfu.interface_template_class(
		metric_slope_1st_derivative, 
			'slope-1 comparison metric'), 
	lfu.interface_template_class(
		metric_slope_2nd_derivative, 
			'slope-2 comparison metric'), 
	lfu.interface_template_class(
		metric_slope_3rd_derivative, 
			'slope-3 comparison metric'), 
	lfu.interface_template_class(
		metric_avg_ptwise_diff_on_domain, 
			'pointwise difference metric')]




示例#22
0
			means = [mean(val) for val in vals]
			data[dex + 1].scalars = means

		data[0].scalars = bins
		return data

	def set_settables(self, *args, **kwargs):
		self.valid_regimes = ['all trajectories']
		self.valid_inputs = self.get_valid_inputs(*args, **kwargs)
		self.handle_widget_inheritance(*args, from_sub = False)
		post_process_plate_reader.set_settables(
					self, *args, from_sub = True)

valid_postproc_base_classes = [
	lfu.interface_template_class(
		post_process_layout_reduction, 
					'layout reduction')]
lpp.valid_postproc_base_classes = valid_postproc_base_classes

if __name__ == 'libs.plate_reader_analyzer.libplatereaderprocesses':
	if lfu.gui_pack is None: lfu.find_gui_pack()
	lgm = lfu.gui_pack.lgm
	lgd = lfu.gui_pack.lgd
	lgb = lfu.gui_pack.lgb

if __name__ == '__main__':
	print 'this is a library!'



示例#23
0
        top_templates.append(
            lgm.interface_template_gui(
                panel_position=(0, 2),
                widgets=['check_set'],
                append_instead=[False],
                instances=[[self] * 4],
                keys=[['output_vtk', 'output_pkl', 'output_txt',
                       'output_plt']],
                labels=[[
                    'Output .vtk files', 'Output .pkl files',
                    'Output .csv files', 'Output .plt files'
                ]],
                box_labels=['Output Types']))
        top_template = lgm.interface_template_gui(widgets=['panel'],
                                                  scrollable=[True],
                                                  templates=[top_templates])
        self.widg_templates.append(
            lgm.interface_template_gui(
                widgets=['splitter'],
                orientations=[['vertical']],
                templates=[[top_template, writers_splitter_template]]))
        lfu.modular_object_qt.set_settables(self, *args, from_sub=True)


valid_writers_base_classes = [
    lfu.interface_template_class(writer_vtk, 'vtk'),
    lfu.interface_template_class(writer_pkl, 'pickle'),
    lfu.interface_template_class(writer_txt, 'text'),
    lfu.interface_template_class(writer_plt, 'plot')
]
示例#24
0
				improves.append(sca[-1] - min(sca) <=\
					(np.mean(sca[-100:]) - min(sca))/20.0)

		weights = [met.acceptance_weight for met in metrics]
		weights = [we/sum(weights) for we, imp in 
					zip(weights, improves) if imp]
		weight = sum(weights)
		if weight >= self.reject_probability:
		#if improves.count(True) > int(len(improves)/2):
		#if improves.count(True) == len(improves):
			self.accepts += 1
			return True

		self.rejects += 1
		return False



valid_fit_routine_base_classes = [
	lfu.interface_template_class(
		fit_routine_simulated_annealing, 
				'simulated annealing')]








示例#25
0
	def __init__(self, *args, **kwargs):
		self.impose_default('parameter_space', None, **kwargs)
		self.impose_default('many_steps', 1, **kwargs)
		self.impose_default('p_sp_trajectory', [], **kwargs)
		self.impose_default('p_sp_step_factor', 1.0, **kwargs)
		self.impose_default('capture_targets', [], **kwargs)
		self.impose_default('bAbort', False, **kwargs)
		self.impose_default('brand_new', True, **kwargs)
		self.impose_default('iteration', 0, **kwargs)
		self.impose_default('auto_overwrite_key', True, **kwargs)
		self.impose_default('initial_creep_factor', 20, **kwargs)
		self.impose_default('display_frequency', 500, **kwargs)
		self.impose_default('max_sim_wait_time', 1.0, **kwargs)
		self.impose_default('last_best', 0, **kwargs)
		self.impose_default('timeouts', 0, **kwargs)
		self.impose_default('use_time_out', True, **kwargs)
		self.impose_default('use_genetics', False, **kwargs)
		self.impose_default('use_mean_fitting', False, **kwargs)
		self.impose_default('regime', 'fine', **kwargs)
		self.impose_default('valid_regimes', 
			['fine', 'coarse-magnitude', 'coarse-decimate'], **kwargs)

		self.impose_default('metrics', [], **kwargs)
		self.metrics.append(
			lgeo.metric_avg_ptwise_diff_on_domain(
				parent = self, acceptance_weight = 1.0))
		self.metrics.append(
			lgeo.metric_slope_1st_derivative(
				parent = self, acceptance_weight = 0.9))
		self.metrics.append(
			lgeo.metric_slope_2nd_derivative(
				parent = self, acceptance_weight = 0.75))
		self.metrics.append(
			lgeo.metric_slope_3rd_derivative(
				parent = self, acceptance_weight = 0.5))
		self.impose_default('metric_weights', 
				[met.acceptance_weight for met 
					in self.metrics], **kwargs)
		self.metric_rulers = [lm.differences, 
				lm.deriv_first_differences, 
				lm.deriv_second_differences, 
				lm.deriv_third_differences]
		self.impose_default('prime_metric', 0, **kwargs)
		self.prime_metric =\
			self.metric_weights.index(max(self.metric_weights))
		self.metrics[self.prime_metric].is_heaviest = True

		self.impose_default('fitted_criteria', [], **kwargs)
		self.fitted_criteria.append(lc.criterion_iteration(
					parent = self, max_iterations = 5000))
		self.fitted_criteria.append(criterion_impatient(
					parent = self, max_timeouts = 50, 
							max_last_best = 2000))

		self.impose_default('fitter_criteria', [], **kwargs)
		self.fitter_criteria.append(
			criterion_minimize_measures(parent = self))

		self.impose_default('data_to_fit_to', None, **kwargs)
		self.impose_default('input_data_file', '', **kwargs)
		self.impose_default('input_data_domain', '', **kwargs)
		self.impose_default('input_data_codomains', [], **kwargs)
		self.impose_default('input_data_targets', [], **kwargs)
		self.impose_default('input_data_aliases', {}, **kwargs)
		self.input_data_file = os.path.join(os.getcwd(), 
			'chemicallite', 'output', 'mm_fit_input.0.pkl')
			#				'imager', 'fit_data.pkl')
		#self.input_data_domain = 'time'
		#self.input_data_codomains = ['ES_Complex', 'Product', 
		#							'Substrate', 'Enzyme']
		#self.input_data_aliases = {'time':'time', 
		#		'ES_Complex mean':'ES_Complex', 
		#		'Product mean':'Product', 
		#		'Enzyme mean':'Enzyme', 
		#		'Substrate mean':'Substrate'}
		#self.input_data_codomains = ['ES_Complex', 'Product']
		#self.input_data_codomains = ['ES_Complex']
		#self.input_data_codomains = ['lacI', 'tetR', 'cl']

		if not 'visible_attributes' in kwargs.keys():
			kwargs['visible_attributes'] = None

		if not 'valid_base_classes' in kwargs.keys():
			kwargs['valid_base_classes'] =\
				valid_fit_routine_base_classes

		if not 'base_class' in kwargs.keys():
			kwargs['base_class'] = lfu.interface_template_class(
								object, 'fit routine abstract')

		lfu.modular_object_qt.__init__(self, *args, **kwargs)
		self.output = lo.output_plan(label = ' '.join(
				[self.label, 'output']), parent = self)
		#self.output.flat_data = False
		#self._children_ = [self.output] + self.metrics +\
		#	self.fitted_criteria + self.fitter_criteria
		self._children_ = [self.output]
示例#26
0
		self.handle_widget_inheritance(*args, from_sub = False)
		self.widg_templates.append(
			lgm.interface_template_gui(
				widgets = ['spin'], 
				doubles = [[False]], 
				initials = [[int(self.ceiling)]], 
				minimum_values = [[0]], 
				maximum_values = [[sys.maxint]], 
				instances = [[self]], 
				keys = [['ceiling']], 
				box_labels = ['Ceiling Limit']))
		trajectory_criterion.set_settables(self, *args, from_sub = True)
	'''

valid_criterion_base_classes = [
		lfu.interface_template_class(
	criterion_sim_time, 'time limit'), 
		lfu.interface_template_class(
	criterion_iteration, 'iteration limit'), 
		lfu.interface_template_class(
	criterion_capture_count, 'capture limit'), 
		lfu.interface_template_class(
	criterion_scalar_increment, 'scalar increment')]

valid_trajectory_criterion_base_classes = [
		lfu.interface_template_class(
	trajectory_criterion_ceiling, 'ceiling limit')]

if __name__ == 'libs.modular_core.libcriterion':
	if lfu.gui_pack is None: lfu.find_gui_pack()
	lgm = lfu.gui_pack.lgm
	lgd = lfu.gui_pack.lgd
示例#27
0
		self.widg_templates.append(
			lgm.interface_template_gui(
				widgets = ['spin'], 
				doubles = [[False]], 
				initials = [[int(self.ceiling)]], 
				minimum_values = [[0]], 
				maximum_values = [[sys.maxint]], 
				instances = [[self]], 
				keys = [['ceiling']], 
				box_labels = ['Ceiling Limit']))
		trajectory_criterion.set_settables(self, *args, from_sub = True)
	'''


valid_criterion_base_classes = [
    lfu.interface_template_class(criterion_sim_time, 'time limit'),
    lfu.interface_template_class(criterion_iteration, 'iteration limit'),
    lfu.interface_template_class(criterion_capture_count, 'capture limit'),
    lfu.interface_template_class(criterion_scalar_increment,
                                 'scalar increment')
]

valid_trajectory_criterion_base_classes = [
    lfu.interface_template_class(trajectory_criterion_ceiling, 'ceiling limit')
]

if __name__ == 'libs.modular_core.libcriterion':
    if lfu.gui_pack is None: lfu.find_gui_pack()
    lgm = lfu.gui_pack.lgm
    lgd = lfu.gui_pack.lgd
    lgb = lfu.gui_pack.lgb
示例#28
0
                                                     mean_of)
            bins, vals = bin_scalars(bin_axes, mean_axes, self.bin_count,
                                     self.ordered)
            means = [mean(val) for val in vals]
            data[dex + 1].scalars = means

        data[0].scalars = bins
        return data

    def set_settables(self, *args, **kwargs):
        self.valid_regimes = ['all trajectories']
        self.valid_inputs = self.get_valid_inputs(*args, **kwargs)
        self.handle_widget_inheritance(*args, from_sub=False)
        post_process_plate_reader.set_settables(self, *args, from_sub=True)


valid_postproc_base_classes = [
    lfu.interface_template_class(post_process_layout_reduction,
                                 'layout reduction')
]
lpp.valid_postproc_base_classes = valid_postproc_base_classes

if __name__ == 'libs.plate_reader_analyzer.libplatereaderprocesses':
    if lfu.gui_pack is None: lfu.find_gui_pack()
    lgm = lfu.gui_pack.lgm
    lgd = lfu.gui_pack.lgd
    lgb = lfu.gui_pack.lgb

if __name__ == '__main__':
    print 'this is a library!'