diff --git a/README.rst b/README.rst index 77d92d7..c68823b 100644 --- a/README.rst +++ b/README.rst @@ -18,7 +18,7 @@ cryoSBI - Simulation-based Inference for Cryo-EM Summary ------- cryoSBI is a Python module for simulation-based inference in cryo-electron microscopy. The module provides tools for simulating cryo-EM particles, training an amortized posterior model, and sampling from the posterior distribution. -The code is based on the SBI libary `Lampe `_, which is a using Pytorch. +The code is based on the SBI libary `Lampe `_, which is using Pytorch. Installing ---------- @@ -45,7 +45,7 @@ Download this repository ------------------------ .. code:: bash - git clone `https://github.com/DSilva27/cryo_em_SBI.git` + git clone https://github.com/flatironinstitute/cryoSBI.git Navigate to the cloned repository and install the module -------------------------------------------------------- diff --git a/src/cryo_sbi/utils/image_utils.py b/src/cryo_sbi/utils/image_utils.py index b16595e..dc8ca14 100644 --- a/src/cryo_sbi/utils/image_utils.py +++ b/src/cryo_sbi/utils/image_utils.py @@ -423,7 +423,9 @@ def load_index_map(self, path: str): path (str): Path to load the index map. """ index_map = np.load(path) - assert self.paths == index_map["paths"], "Paths do not match the index map." + assert len(self.paths) == len(index_map["paths"]), "Number of paths do not match the index map." + for path1, path2 in zip(self.paths, index_map["paths"]): + assert path1 == path2, "Paths do not match the index map." self._path_index = index_map["path_index"] self._file_index = index_map["file_index"] self._index_map = True diff --git a/tutorials/tutorial.ipynb b/tutorials/tutorial.ipynb index cc2a5bf..494bec6 100644 --- a/tutorials/tutorial.ipynb +++ b/tutorials/tutorial.ipynb @@ -11,7 +11,6 @@ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from scipy.spatial.transform import Rotation\n", - "import umap\n", "\n", "from cryo_sbi import CryoEmSimulator\n", "import cryo_sbi.inference.train_npe_model as train_npe_model\n", @@ -20,6 +19,24 @@ "from cryo_sbi.utils.visualize_models import plot_model" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### If you want to run the latent space analysis with UMAP, you need to install the following package:\n", + "You can find the installation instructions [here](https://umap-learn.readthedocs.io/en/latest/). \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# If you installed umap you can import it here \n", + "import umap" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -363,7 +380,7 @@ "plt.scatter(\n", " latent_vecs_transformed[:, 0],\n", " latent_vecs_transformed[:, 1],\n", - " c=dist,\n", + " c=side_length,\n", " cmap=\"viridis\",\n", " s=10,\n", ")\n", @@ -389,13 +406,6 @@ "plt.xlabel(\"UMAP 1\")\n", "plt.ylabel(\"UMAP 2\")" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {