def main(): plot_all_heatmaps() OUTPUT_DIR.mkdir(parents=True, exist_ok=True) print('Graphing results...', end='') sys.stdout.flush() df = load_results() df = format_results(df) fig = horserace_plot(df) path = os.path.join(PAPER_DIR, 'figures', 'horserace.png') fig.savefig(path) fig.savefig(path.replace('.png', '.pdf')) print(' done.')
def on_open(self, event=None): wildcards_all = "All files (*.*)|*.*" wildcards_obj = "Python binary result files (*.res.obj)|*.res.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 results file", defaultDir=self.get_scenario().get_workdirpath(), #defaultFile = os.path.join(scenario.get_workdirpath(), scenario.format_ident()+'.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: if self._results is not None: # browse away from results # self._mainframe.browse_obj(self._results.get_scenario()) del self._results self._results = results.load_results( filepath, parent=self.get_scenario(), logger=self._mainframe.get_logger()) 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(self._results) self._mainframe.select_view(1) # !!!!!!!!tricky, crashes without self.refresh_widgets()
def on_open(self, event=None): wildcards_all = "All files (*.*)|*.*" wildcards_obj = "Python binary result files (*.res.obj)|*.res.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 results file", defaultDir=self.get_scenario().get_workdirpath(), #defaultFile = os.path.join(scenario.get_workdirpath(), scenario.format_ident()+'.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: if self._simulation.results is not None: # browse away from results # self._mainframe.browse_obj(self._simulation.results.get_scenario()) del self._simulation.results self._simulation.results = results.load_results(filepath, parent=self._simulation, logger=self._mainframe.get_logger() ) 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(self._simulation.results) self._mainframe.select_view(name="Result viewer") # !!!!!!!!tricky, crashes without self.refresh_widgets()
def plot_comparison(config, filename): plt.rc('savefig', dpi=400) res = rs.load_results(config) outpath = rs.Config(config).working_dir / filename compare_multiple(res, outpath) return outpath