def display_graph(self, graphdef, flightmode_colourmap=None): '''display a graph''' if 'mestate' in globals(): self.mestate.console.write("Expression: %s\n" % ' '.join(graphdef.expression.split())) else: self.mestate.child_pipe_send_console.send("Expression: %s\n" % ' '.join(graphdef.expression.split())) #mestate.mlog.reduce_by_flightmodes(mestate.flightmode_selections) #setup the graph, then pass to a new process and display self.mg = grapher.MavGraph(flightmode_colourmap) if self.mestate.settings.title is not None: self.mg.set_title(self.mestate.settings.title) else: self.mg.set_title(graphdef.name) self.mg.set_marker(self.mestate.settings.marker) self.mg.set_condition(self.mestate.settings.condition) self.mg.set_xaxis(self.mestate.settings.xaxis) self.mg.set_linestyle(self.mestate.settings.linestyle) self.mg.set_show_flightmode(self.mestate.settings.show_flightmode) self.mg.set_legend(self.mestate.settings.legend) self.mg.add_mav(self.mestate.mlog) for f in graphdef.expression.split(): self.mg.add_field(f) self.mg.process(self.mestate.flightmode_selections, self.mestate.mlog._flightmodes) self.lenmavlist = len(self.mg.mav_list) #Important - mg.mav_list is the full logfile and can be very large in size #To avoid slowdowns in Windows (which copies the vars to the new process) #We need to empty this var when we're finished with it self.mg.mav_list = [] child = multiproc.Process(target=self.mg.show, args=[self.lenmavlist,], kwargs={"xlim_pipe" : self.xlim_pipe}) child.start() self.xlim_pipe[1].close() self.mestate.mlog.rewind()
def display_graph(graphdef): '''display a graph''' mestate.console.write("Expression: %s\n" % ' '.join(graphdef.expression.split())) #mestate.mlog.reduce_by_flightmodes(mestate.flightmode_selections) #setup the graph, then pass to a new process and display mg = grapher.MavGraph() mg.set_marker(mestate.settings.marker) mg.set_condition(mestate.settings.condition) mg.set_xaxis(mestate.settings.xaxis) mg.set_linestyle(mestate.settings.linestyle) mg.set_show_flightmode(mestate.settings.show_flightmode) mg.set_legend(mestate.settings.legend) mg.add_mav(mestate.mlog) for f in graphdef.expression.split(): mg.add_field(f) mg.process(mestate.flightmode_selections, mestate.mlog._flightmodes) lenmavlist = len(mg.mav_list) #Important - mg.mav_list is the full logfile and can be very large in size #To avoid slowdowns in Windows (which copies the vars to the new process) #We need to empty this var when we're finished with it mg.mav_list = [] child = multiprocessing.Process(target=graph_process, args=[mg, lenmavlist]) child.start() mestate.mlog.rewind()
def display_graph(self, graphdef): '''display a graph''' if 'mestate' in globals(): self.mestate.console.write("Expression: %s\n" % ' '.join(graphdef.expression.split())) else: self.mestate.child_pipe_send_console.send( "Expression: %s\n" % ' '.join(graphdef.expression.split())) #mestate.mlog.reduce_by_flightmodes(mestate.flightmode_selections) #setup the graph, then pass to a new process and display self.mg = grapher.MavGraph() self.mg.set_marker(self.mestate.settings.marker) self.mg.set_condition(self.mestate.settings.condition) self.mg.set_xaxis(self.mestate.settings.xaxis) self.mg.set_linestyle(self.mestate.settings.linestyle) self.mg.set_show_flightmode(self.mestate.settings.show_flightmode) self.mg.set_legend(self.mestate.settings.legend) self.mg.add_mav(self.mestate.mlog) for f in graphdef.expression.split(): self.mg.add_field(f) self.mg.process(self.mestate.flightmode_selections, self.mestate.mlog._flightmodes) self.lenmavlist = len(self.mg.mav_list) if platform.system() == 'Darwin': forking_enable(False) #Important - mg.mav_list is the full logfile and can be very large in size #To avoid slowdowns in Windows (which copies the vars to the new process) #We need to empty this var when we're finished with it self.mg.mav_list = [] child = Process(target=self.mg.show, args=[ self.lenmavlist, ]) child.start() self.mestate.mlog.rewind()
def graph_process(fields, mavExpLog, mavExpFlightModeSel, mavExpSettings): '''process for a graph''' mavExpLog.reduce_by_flightmodes(mavExpFlightModeSel) mg = grapher.MavGraph() mg.set_marker(mavExpSettings.marker) mg.set_condition(mavExpSettings.condition) mg.set_xaxis(mavExpSettings.xaxis) mg.set_linestyle(mavExpSettings.linestyle) mg.set_show_flightmode(mavExpSettings.show_flightmode) mg.set_legend(mavExpSettings.legend) mg.add_mav(mavExpLog) for f in fields: mg.add_field(f) mg.process() mg.show()
def graph_process(fields): '''process for a graph''' mestate.mlog.reduce_by_flightmodes(mestate.flightmode_selections) mg = grapher.MavGraph() mg.set_marker(mestate.settings.marker) mg.set_condition(mestate.settings.condition) mg.set_xaxis(mestate.settings.xaxis) mg.set_linestyle(mestate.settings.linestyle) mg.set_flightmode(mestate.settings.flightmode) mg.set_legend(mestate.settings.legend) mg.add_mav(mestate.mlog) for f in fields: mg.add_field(f) mg.process() mg.show()