Exemplo n.º 1
0
def test_plot_screw_axes():
    """Test that the plotting function returns plots with data."""
    data = {
        "miller_axis_vals": [1, 2, 3, 4, 5, 6],
        "i_over_sigma": [0.5, 20.0, 0.2, 10.0, 0.4, 15.0],
        "intensities": [0.5, 20.0, 0.2, 10.0, 0.4, 15.0],
        "sigmas": [1.0] * 6,
    }
    plots = plot_screw_axes({"21a": data})
    for pl in plots.values():
        assert pl["data"][0]["x"]
        assert pl["data"][0]["y"]
Exemplo n.º 2
0
 def generate_html_report(self, filename):
     """Generate a html report using the data."""
     screw_axes_graphs = plot_screw_axes(self.data)
     self.data["screw_axes"] = screw_axes_graphs
     loader = ChoiceLoader([
         PackageLoader("dials", "templates"),
         PackageLoader("dials", "static", encoding="utf-8"),
     ])
     env = Environment(loader=loader)
     template = env.get_template("systematic_absences_report.html")
     html = template.render(
         page_title="DIALS systematic absences report",
         screw_axes_graphs=self.data["screw_axes"],
     )
     with open(filename, "wb") as f:
         f.write(html.encode("utf-8", "xmlcharrefreplace"))