def do(self): print self.ident+'.do' net = self.get_scenario().net projparams_target = net.get_projparams() if projparams_target in ("", "!"): projparams_target = "" for filepath in self.nxnetworkpaths: graphx = cm.load_obj(filepath) import_nx(graphx, net, projparams=projparams_target) projparams_target = net.get_projparams() # OxNodesImporter(self.nodeshapefilepath, self, # projparams_target = projparams_target, # is_guess_targetproj = is_guess_targetproj, # logger = self.get_logger(), # ).do() # ShapefileImporter( self.nodeshapefilepath, # self.parent.net.nodes.coords, # map_attrconfig2shapeattr = {}, # projparams_target = projparams_target, # is_guess_targetproj = is_guess_targetproj, # logger = self.get_logger(), # ).do() return True
def load_scenario(filepath, logger=None): scenario = cm.load_obj(filepath, parent=None) # scenario.set_workdirpath(os.path.dirname(filepath)) # this will set rootname and workdir scenario.set_filepath(filepath) if logger != None: scenario.set_logger(logger) return scenario
def load_scenario(filepath, logger=None): scenario = cm.load_obj(filepath, parent=None) # scenario.set_workdirpath(os.path.dirname(filepath)) # this will set rootname and workdir scenario.set_filepath(filepath) if logger != None: scenario.set_logger(logger) return scenario
def load_scenario(filepath, logger=None): scenario = cm.load_obj(filepath, parent=None) # scenario.set_workdirpath(os.path.dirname(filepath)) # this will set rootname and workdir scenario.set_filepath(filepath) # print 'load_scenario', scenario.get_rootfilepath(),'workdirpath',scenario.workdirpath if logger is not None: scenario.set_logger(logger) return scenario
def on_open_iterationresults(self, event=None): """ Load results from virtual population iteration simulation script_vp_iter.py """ wildcards_all = "All files (*.*)|*.*" wildcards_obj = "VP iterate result files (*.vpiterres.obj)|*.vpiterres.obj|Python binary files (*.obj)|*.obj" wildcards = wildcards_obj + "|" + wildcards_all # Finally, if the directory is changed in the process of getting files, this # dialog is set up to change the current working directory to the path chosen. dlg = wx.FileDialog( self._mainframe, message="Open VP iteration results file", defaultDir=self.get_scenario().get_workdirpath(), #defaultFile = self.get_scenario().get_rootfilepath()+'.vpiterres.obj', wildcard=wildcards, style=wx.OPEN | wx.CHANGE_DIR) # Show the dialog and retrieve the user response. If it is the OK response, # process the data. is_newresults = False if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. filepath = dlg.GetPath() if len(filepath) > 0: simresults = self._demand.parent.simulation.results if simresults is not None: # delete old object, if any vpiterstats = simresults.get_resultobj('vpiterstats') if vpiterstats is not None: simresults.delete('vpiterstats') del vpiterstats vpiterstats = cm.load_obj(filepath) simresults.add_resultobj(vpiterstats) is_newresults = True # Destroy the dialog. Don't do this until you are done with it! # BAD things can happen otherwise! dlg.Destroy() if is_newresults: # this should update all widgets for the new scenario!! #print 'call self._mainframe.refresh_moduleguis()' self._mainframe.browse_obj(simresults)
def load_results(filepath, parent=None, logger=None): # typically parent is the scenario results = cm.load_obj(filepath, parent=parent) if logger != None: results.set_logger(logger) return results
def load_results(filepath, parent=None, logger=None): # typically parent is the scenario results = cm.load_obj(filepath, parent=parent) if logger is not None: results.set_logger(logger) return results
) ############################################################################## virtualpop = myscenario.demand.virtualpop ids_pers = virtualpop.get_ids() if is_not_first_iter: # load previous results, if cmlfilepath is present print ' importing and procerroessing previous results' # store plans before reselection ids_plan_before = virtualpop.ids_plan[ids_pers].copy() # load previous results simstats = cm.load_obj(filepath_simstats) #number of iteration n_iter = len(simstats) n_iter+=1 # decrease c_probit and fraction for the nex iteration c_probit = c_probit/(decrease+1)**n_iter fraction = fraction/(decrease+1)**n_iter print 'n_iter:', n_iter, 'c_probit:', c_probit, 'fraction:', fraction # select plans according to last simulation results sim.import_results() # will update plan travel times virtualpop.select_plans_min_time_exec_est( fraction = fraction, c_probit = c_probit) # get plans after selection ids_plan_after = virtualpop.ids_plan[ids_pers] #print ' simstats before adding results ',len(simstats) simstats.add_results(myscenario, ids_plan_before, ids_plan_after)
def load_mapmatching(filepath, demand, logger=None): # typically parent is the scenario mapmatching = cm.load_obj(filepath, parent=demand) if logger is not None: mapmatching.set_logger(logger) return mapmatching
def load_mapmatching(filepath, demand, logger=None): # typically parent is the scenario mapmatching = cm.load_obj(filepath, parent=demand) if logger is not None: mapmatching.set_logger(logger) return mapmatching