Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Dingel321 committed Aug 27, 2024
2 parents 0c31d76 + 08c1eb8 commit d145cf2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://lampe.readthedocs.io/en/stable/>`_, which is a using Pytorch.
The code is based on the SBI libary `Lampe <https://lampe.readthedocs.io/en/stable/>`_, which is using Pytorch.

Installing
----------
Expand All @@ -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
--------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/cryo_sbi/utils/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 19 additions & 9 deletions tutorials/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {},
Expand Down Expand Up @@ -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",
Expand All @@ -389,13 +406,6 @@
"plt.xlabel(\"UMAP 1\")\n",
"plt.ylabel(\"UMAP 2\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit d145cf2

Please sign in to comment.