def add_scatter_plot(self, component_x, component_y, caption, width, special_tag=None, create_kwargs=None, write_unique=False): """ wraps TeXWriter.add_figure and the AxialVortex.scatter_plot functions to add a contour plot figure to the TeXRunFigurePage with all the bells and whistles taken care of automatically. This is used to generate all the contour plots of interest for a given experiment run. :param component_x: x axis component to plot :param component_y: y axis component to plot :param caption: Tex caption to add to figure :param width: the width of the plot on the page such as '5in' :param special_tag: extra tag to place inside the filename for unique id of something with unique kwargs. :param create_kwargs: manual kwargs for the scatter_plot function :param write_unique: set True to write a tex file for this individual figure. """ if create_kwargs is None: create_kwargs = {} if special_tag is None: special_tag = "" if 'title' not in create_kwargs.keys(): create_kwargs["title"] = "{0} vs {1}".format( shorthand_to_tex(component_y), shorthand_to_tex(component_x)) create_kwargs['component_x'] = component_x create_kwargs['component_y'] = component_y create_from_function = self.axial_vortex.scatter_plot name_keys = [x for x in [self.tex_title, component_y, "vs", component_x, special_tag] if x != ""] figure_filename = "{0}scatter.jpg".format("_".join(map(str, name_keys))) figure_path = os.path.join(self.figure_dir, figure_filename) self._write_or_log(figure_path, caption, width, create_from_function, create_kwargs, write_unique)
def add_contour_plot(self, component, caption, width, special_tag=None, create_kwargs=None, write_unique=False): """ wraps TeXWriter.add_figure and the AxialVortex.contour_plot functions to add a contour plot figure to the TeXRunFigurePage with all the bells and whistles taken care of automatically. This is used to generate all the contour plots of interest for a given experiment run. :param component: shorthand component to add contour plot :param caption: Tex caption to add to figure :param width: the width of the plot on the page such as '5in' :param create_kwargs: manual kwargs for the contour_plot function :param write_unique: set to True to immediately save a tex file with just this figure within it """ if create_kwargs is None: create_kwargs = {} if special_tag is None: special_tag = "" if 'title' not in create_kwargs.keys(): create_kwargs["title"] = shorthand_to_tex(component) create_kwargs["component"] = component create_from_function = self.axial_vortex.contour_plot figure_filename = "{0}contour.jpg".format("_".join(map(str, [self.tex_title, component, special_tag]))) figure_path = os.path.join(self.figure_dir, figure_filename) self._write_or_log(figure_path, caption, width, create_from_function, create_kwargs, write_unique)
def add_dynamic_plot(self, component_y, caption, width, special_tag=None, create_kwargs=None, write_unique=False): """ wraps TeXWriter.add_figure and the AxialVortex.dynamic functions to add a dynamic plot to the page :param component_y: y axis component to plot :param caption: Tex caption to add to figure :param width: the width of the plot on the page such as '5in' :param special_tag: extra tag to place inside the filename for unique id of something with unique kwargs. :param create_kwargs: manual kwargs for the scatter_plot function :param write_unique: set True to write a tex file for this individual figure. """ if create_kwargs is None: create_kwargs = {} if special_tag is None: special_tag = "" if 'title' not in create_kwargs.keys(): create_kwargs["title"] = "{0} over time".format(shorthand_to_tex(component_y)) create_kwargs['component_y'] = component_y create_from_function = self.axial_vortex.dynamic_plot figure_filename = "{0}dynamic.jpg".format("_".join(map(str, [self.tex_title, component_y, special_tag]))) figure_path = os.path.join(self.figure_dir, figure_filename) self._write_or_log(figure_path, caption, width, create_from_function, create_kwargs, write_unique)