def save_html(self, file_stem, output_folder): v, f, facet_colors = self.load_data(file_stem) if v is None: print(f"The data for {file_stem} could not be loaded. Skipping") return output_pathname = output_folder / (file_stem + ".html") mp.website() p = mp.plot(v, f, c=facet_colors) p.save(str(output_pathname))
from fieldopt import geolib as gl from fieldopt.objective import FieldFunc import meshplot as mp HEAD_ENTITIES = [(2, 5), (2, 1005)] GM_ENTITIES = [(2, 2), (2, 1002)] SurfaceMesh = namedtuple("SurfaceMesh", ["nodes", "coords", "triangles"]) DistResult = namedtuple("DistResult", ["source", "target", "distance"]) logging.basicConfig(format="%(asctime)s [BOONSTIM CORTEX2SCALP]: %(message)s", datefmt="%Y-%m-%d %I:%M:%S %p", level=logging.INFO) mp.website() def decompose_gmsh(f_mesh, entity): ''' Given a path to a mesh file load the: nodes coordinates triangles For the specified surface. Arguments: f_mesh Path to GMSH mesh file entity Tuple describing gmsh (dim, tag) '''
import meshplot import json #import plotly.offline as plotly #import plotly.graph_objects as go first = True meshplot.website() def mp_to_md(self): global first if first: first = False res = self.to_html(imports=True, html_frame=False) else: res = self.to_html(imports=False, html_frame=False) return res #def plotly_to_md(self): # print("PLOTLING") # html = '<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>' # html += "<div>" # html += plotly.plot(self, output_type='div', include_plotlyjs=first, show_link=False) # html += "</div>" # return html def sp_to_md(self):