def show(self, type="Image"): """ Shows the generated image inline within an ipython notebook. Parameters ---------- type: str Type of visualisation to display ('Image' or 'WebGL'). If IPython is installed, displays the result image or WebGL content inline If IPython is not installed, this method will call the default image/web output routines to save the result with a default filename in the current directory """ try: if type.lower() != "webgl" and lavavu.is_notebook(): self._generate_DB() if uw.mpi.rank > 0: return from IPython.display import display, Image, HTML #Return inline image result filename = self._generate_image() display(HTML("<img src='%s'>" % filename)) else: #Fallback to export image or call viewer webgl export self.save(filename=self.name, type=type) except RuntimeError as e: print("Error creating image: ", e) pass except: raise
def show(self, type="Image"): """ Shows the generated image inline within an ipython notebook. Parameters ---------- type: str Type of visualisation to display ('Image' or 'WebGL'). If IPython is installed, displays the result image or WebGL content inline If IPython is not installed, this method will call the default image/web output routines to save the result with a default filename in the current directory """ try: if type.lower() != "webgl" and lavavu.is_notebook(): self._generate_DB() if uw.rank() > 0: return from IPython.display import display,Image,HTML #Return inline image result filename = self._generate_image() display(HTML("<img src='%s'>" % filename)) else: #Fallback to export image or call viewer webgl export self.save(filename=self.name, type=type) except RuntimeError as e: print("Error creating image: ", e) pass except: raise