Beispiel #1
0
 def make_plots(self):
     """Generate cosym cluster analysis plot data."""
     d = OrderedDict()
     d.update(plot_rij_histogram(self.data["rij_matrix"]))
     d.update(plot_coords(self.data["coordinates"], self.data["labels"]))
     graphs = {"cosym_graphs": d}
     return graphs
    def cluster_analysis(self):
        from xia2.Modules.MultiCrystal import multi_crystal_analysis

        labels = self._data_manager.experiments.identifiers()
        mca = multi_crystal_analysis(self._intensities_separate[0],
                                     labels=labels,
                                     prefix=None)

        self._cc_cluster_json = mca.to_plotly_json(mca.cc_matrix,
                                                   mca.cc_linkage_matrix,
                                                   labels=labels)
        self._cc_cluster_table = mca.as_table(mca.cc_clusters)

        self._cos_angle_cluster_json = mca.to_plotly_json(
            mca.cos_angle_matrix,
            mca.cos_angle_linkage_matrix,
            labels=labels,
            matrix_type="cos_angle",
        )
        self._cos_angle_cluster_table = mca.as_table(mca.cos_angle_clusters)

        self._cosym_graphs = OrderedDict()
        self._cosym_graphs.update(
            plot_rij_histogram(mca.cosym.target.rij_matrix,
                               key="cosym_rij_histogram_sg"))
        self._cosym_graphs.update(
            plot_coords(mca.cosym.coords,
                        mca.cosym.cluster_labels,
                        key="cosym_coordinates_sg"))

        self._cluster_analysis = mca
        return self._cluster_analysis
Beispiel #3
0
def test_plot_rij_histogram():
    rij_matrix = np.random.rand(16)
    d = plots.plot_rij_histogram(rij_matrix)
    assert "cosym_rij_histogram" in d
    assert sum(d["cosym_rij_histogram"]["data"][0]["y"]) == 16