[docs]classLIgOSimulationHTMLBuilder:""" A class that will make a HTML file(s) out of SimulationState object to show what analysis took place in the LIgOSimulationInstruction. """CSS_PATH=EnvironmentSettings.html_templates_path/"css/custom.css"
[docs]@staticmethoddefbuild(state:LigoSimState)->str:""" Function that builds the HTML files based on the Simulation state. Arguments: state: SimulationState object including all details of the Simulation instruction Returns: path to the main HTML file (which is located under state.result_path) """base_path=PathBuilder.build(state.result_path/"../HTML_output/")html_map=LIgOSimulationHTMLBuilder.make_html_map(state,base_path)result_file=base_path/f"Simulation_{state.name}.html"TemplateParser.parse(template_path=EnvironmentSettings.html_templates_path/"Simulation.html",template_map=html_map,result_path=result_file)returnresult_file
[docs]defbuild_html(d):html_output='<ul>'forkey,valueind.items():ifisinstance(value,dict):# If the value is a dictionary, recursively build the HTML for ithtml_output+=f'<li>{key}: {build_html(value)}</li>'else:# If the value is not a dictionary, display it as a simple list itemhtml_output+=f'<li>{key}: {value}</li>'html_output+='</ul>'returnhtml_output