def set_parameters(ensem): ensem.run_params['plot_targets'] = ['iteration', 'time', 'total population', 'vertex counts'] output_plan = ensem.run_params['output_plans']['Simulation'] output_plan.targeted = ['iteration', 'time', 'total population', 'vertex counts'] for dex in range(len(output_plan.outputs)): output_plan.outputs[dex] = ['iteration', 'time', 'total population', 'vertex counts'] ensem.run_params['bool_expressions'] = lfu.dictionary() ensem.run_params['bool_expressions']['end'] = '' ensem.run_params['bool_expressions']['capt'] = '' ensem.run_params.create_partition('system', [ 'end_criteria', 'capture_criteria', 'plot_targets', 'bool_expressions' ]) ensem.cartographer_plan.parameter_space_mobjs =\ ensem.run_params.partition['system'] ensem.run_params.create_partition('template owners', [])
def __init__(self, *args, **kwargs): #self.impose_default('current_tab_index', 0, **kwargs) #self.current_tab_index = 0 self.aborted = False self.data_pool = lfu.data_container( data = [], postproc_data = []) self.data_scheme = None self.__dict__ = lfu.dictionary() if 'parent' in kwargs.keys(): self.parent = kwargs['parent'] self.cancel_make = False self.skip_simulation = False self.mcfg_path = '' #self.num_trajectories = 1 num_traj = lset.get_setting('trajectory_count') if num_traj: self.num_trajectories = num_traj else: self.num_trajectories = 1 self.data_pool_descr = '' self.treebook_memory = [0, [], []] self._module_memory_ = [] self.simulation_plan = simulation_plan(parent = self) self.output_plan = lo.output_plan( label = 'Simulation', parent = self) self.fitting_plan = lfr.fit_routine_plan(parent = self) self.cartographer_plan = lgeo.cartographer_plan( label = 'Parameter Scan', parent = self) self.postprocess_plan = lpp.post_process_plan( label = 'Post Process Plan', parent = self, _always_sourceable_ = ['simulation']) self.multiprocess_plan = lmp.multiprocess_plan(parent = self) self.run_params = lfu.dictionary(parent = self) self.run_params['end_criteria'] = \ self.simulation_plan.end_criteria self.run_params['capture_criteria'] = \ self.simulation_plan.capture_criteria self.run_params['plot_targets'] = \ self.simulation_plan.plot_targets self.run_params['output_plans'] = { 'Simulation' : self.output_plan} self.run_params['fit_routines'] = \ self.fitting_plan.routines self.run_params['post_processes'] = \ self.postprocess_plan.post_processes self.run_params['p_space_map'] = None self.run_params['multiprocessing'] = None self.__dict__.create_partition('template owners', ['output_plan', 'fitting_plan', 'cartographer_plan', 'postprocess_plan', 'multiprocess_plan', 'run_params', 'simulation_plan']) if 'label' not in kwargs.keys(): kwargs['label'] = 'ensemble' if 'module_options' in kwargs.keys(): opts = kwargs['module_options'] else: print 'no modules detected; requesting from manager' opts = self.parent.find_module_options() if len(opts) == 0: lgd.message_dialog(None, 'No module options detected!', 'Problem') self.cancel_make = True return elif len(opts) == 1: module = opts[0] else: module_choice_container = lfu.data_container(data = opts[0]) module_options_templates = [lgm.interface_template_gui( layout = 'horizontal', widgets = ['radio'], verbosities = [0], labels = [opts], initials = [[module_choice_container.data]], instances = [[module_choice_container]], keys = [['data']], box_labels = ['Ensemble Module'], minimum_sizes = [[(250, 50)]])] mod_dlg = lgd.create_dialog(title = 'Choose Ensemble Module', templates = module_options_templates, variety = 'templated') module = mod_dlg() if module: module = module_choice_container.data else: self.cancel_make = True return self.impose_default('module', module, **kwargs) self._children_ = [self.simulation_plan, self.output_plan, self.fitting_plan, self.cartographer_plan, self.postprocess_plan, self.multiprocess_plan] self.load_module(reset_params = True) self.mcfg_dir = os.path.join(os.getcwd(), self.module) if not os.path.isdir(self.mcfg_dir): self.mcfg_dir = os.getcwd() lfu.modular_object_qt.__init__(self, *args, **kwargs) self.data_pool_id = lfu.get_new_pool_id() self.data_pool_pkl = os.path.join(os.getcwd(), 'data_pools', '.'.join(['data_pool', self.data_pool_id, 'pkl']))
def __init__(self, label='another output plan', use_plan=True, visible_attributes=[ 'label', 'use_plan', 'output_vtk', 'output_pkl', 'output_txt', 'output_plt', 'save_directory', 'save_filename', 'filenames', 'directories', 'targeted' ], save_directory='', save_filename='', parent=None): self.__dict__ = lfu.dictionary() self.writers = [ writer_vtk(parent=self), writer_pkl(parent=self), writer_txt(parent=self), writer_plt(parent=self) ] self.flat_data = True #if label is not 'another output plan': one_of_a_kind = True self.targeted = [] #lists of strings to list of scalars self.outputs = [[], [], [], []] #strings pointing to targeted scalars self.save_directory = save_directory self.save_filename = save_filename self.filenames = { 'vtk filename': '', 'pkl filename': '', 'txt filename': '', 'plt filename': '' } self.directories = { 'vtk directory': '', 'pkl directory': '', 'txt directory': '', 'plt directory': '' } op_vtk = lset.get_setting('output_vtk') op_pkl = lset.get_setting('output_pkl') op_txt = lset.get_setting('output_txt') op_plt = lset.get_setting('output_plt') if not op_vtk is None: self.output_vtk = op_vtk else: self.output_vtk = False if not op_pkl is None: self.output_pkl = op_pkl else: self.output_pkl = False if not op_txt is None: self.output_txt = op_txt else: self.output_txt = False if not op_plt is None: self.output_plt = op_plt else: self.output_plt = False self.default_targets_vtk = True self.default_targets_pkl = True self.default_targets_txt = True self.default_targets_plt = True self.default_paths_vtk = True self.default_paths_pkl = True self.default_paths_txt = True self.default_paths_plt = True lfu.plan.__init__(self, label=label, use_plan=True, visible_attributes=visible_attributes, parent=parent) self._children_ = self.writers self.__dict__.create_partition('template owners', ['writers'])