cryojax 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. cryojax-0.2.2/.gitattributes +4 -0
  2. cryojax-0.2.2/.github/dependabot.yml +6 -0
  3. cryojax-0.2.2/.github/workflows/build_docs.yml +45 -0
  4. cryojax-0.2.2/.github/workflows/release.yml +36 -0
  5. cryojax-0.2.2/.github/workflows/ruff.yml +12 -0
  6. cryojax-0.2.2/.github/workflows/testing.yml +43 -0
  7. cryojax-0.2.2/.gitignore +10 -0
  8. cryojax-0.2.2/.pre-commit-config.yaml +24 -0
  9. cryojax-0.2.2/CONTRIBUTING.md +39 -0
  10. cryojax-0.2.2/LICENSE +504 -0
  11. cryojax-0.2.2/PKG-INFO +671 -0
  12. cryojax-0.2.2/README.md +136 -0
  13. cryojax-0.2.2/docs/_static/custom_css.css +153 -0
  14. cryojax-0.2.2/docs/_static/mathjax.js +21 -0
  15. cryojax-0.2.2/docs/api/simulator/scattering_potential.md +95 -0
  16. cryojax-0.2.2/docs/examples/data/.gitkeep +0 -0
  17. cryojax-0.2.2/docs/examples/data/ribosome_4ug0_micrograph.mrc +3 -0
  18. cryojax-0.2.2/docs/examples/data/ribosome_4ug0_micrograph.mrcs +3 -0
  19. cryojax-0.2.2/docs/examples/data/ribosome_4ug0_particles.star +45 -0
  20. cryojax-0.2.2/docs/examples/data/ribosome_4ug0_scattering_potential_from_cistem.mrc +3 -0
  21. cryojax-0.2.2/docs/examples/read-dataset.ipynb +408 -0
  22. cryojax-0.2.2/docs/examples/simulate-helix.ipynb +261 -0
  23. cryojax-0.2.2/docs/examples/simulate-image.ipynb +353 -0
  24. cryojax-0.2.2/docs/examples/simulate-micrograph.ipynb +284 -0
  25. cryojax-0.2.2/docs/examples/test-multiatom.ipynb +434 -0
  26. cryojax-0.2.2/docs/index.md +114 -0
  27. cryojax-0.2.2/mkdocs.yml +68 -0
  28. cryojax-0.2.2/pyproject.toml +62 -0
  29. cryojax-0.2.2/src/cryojax/__init__.py +12 -0
  30. cryojax-0.2.2/src/cryojax/constants/__init__.py +4 -0
  31. cryojax-0.2.2/src/cryojax/constants/_load_atoms.py +57 -0
  32. cryojax-0.2.2/src/cryojax/constants/element_params.npy +0 -0
  33. cryojax-0.2.2/src/cryojax/coordinates/__init__.py +10 -0
  34. cryojax-0.2.2/src/cryojax/coordinates/_coordinates.py +287 -0
  35. cryojax-0.2.2/src/cryojax/core/__init__.py +12 -0
  36. cryojax-0.2.2/src/cryojax/core/_errors.py +35 -0
  37. cryojax-0.2.2/src/cryojax/core/_filter_specs.py +28 -0
  38. cryojax-0.2.2/src/cryojax/core/_filtered_transformations.py +105 -0
  39. cryojax-0.2.2/src/cryojax/core/_serialization.py +0 -0
  40. cryojax-0.2.2/src/cryojax/cryojax_version.py +16 -0
  41. cryojax-0.2.2/src/cryojax/data/__init__.py +11 -0
  42. cryojax-0.2.2/src/cryojax/data/_dataset.py +91 -0
  43. cryojax-0.2.2/src/cryojax/data/_particle_stack.py +36 -0
  44. cryojax-0.2.2/src/cryojax/data/_relion.py +424 -0
  45. cryojax-0.2.2/src/cryojax/image/__init__.py +26 -0
  46. cryojax-0.2.2/src/cryojax/image/_average.py +126 -0
  47. cryojax-0.2.2/src/cryojax/image/_edges.py +185 -0
  48. cryojax-0.2.2/src/cryojax/image/_fft.py +120 -0
  49. cryojax-0.2.2/src/cryojax/image/_map_coordinates.py +254 -0
  50. cryojax-0.2.2/src/cryojax/image/_normalize.py +120 -0
  51. cryojax-0.2.2/src/cryojax/image/_rescale_pixel_size.py +66 -0
  52. cryojax-0.2.2/src/cryojax/image/_spectrum.py +136 -0
  53. cryojax-0.2.2/src/cryojax/image/operators/__init__.py +36 -0
  54. cryojax-0.2.2/src/cryojax/image/operators/_filters.py +250 -0
  55. cryojax-0.2.2/src/cryojax/image/operators/_fourier_operator.py +203 -0
  56. cryojax-0.2.2/src/cryojax/image/operators/_masks.py +136 -0
  57. cryojax-0.2.2/src/cryojax/image/operators/_operator.py +194 -0
  58. cryojax-0.2.2/src/cryojax/image/operators/_real_operator.py +89 -0
  59. cryojax-0.2.2/src/cryojax/inference/__init__.py +1 -0
  60. cryojax-0.2.2/src/cryojax/inference/distributions/__init__.py +7 -0
  61. cryojax-0.2.2/src/cryojax/inference/distributions/_distribution.py +56 -0
  62. cryojax-0.2.2/src/cryojax/inference/distributions/_gaussian_distributions.py +104 -0
  63. cryojax-0.2.2/src/cryojax/inference/transforms/__init__.py +14 -0
  64. cryojax-0.2.2/src/cryojax/inference/transforms/_lie_group_transforms.py +131 -0
  65. cryojax-0.2.2/src/cryojax/inference/transforms/_transforms.py +236 -0
  66. cryojax-0.2.2/src/cryojax/io/__init__.py +20 -0
  67. cryojax-0.2.2/src/cryojax/io/_cif.py +50 -0
  68. cryojax-0.2.2/src/cryojax/io/_gemmi.py +122 -0
  69. cryojax-0.2.2/src/cryojax/io/_mdtraj.py +43 -0
  70. cryojax-0.2.2/src/cryojax/io/_mrc.py +238 -0
  71. cryojax-0.2.2/src/cryojax/io/_pdb.py +61 -0
  72. cryojax-0.2.2/src/cryojax/io/_starfile.py +28 -0
  73. cryojax-0.2.2/src/cryojax/rotations/__init__.py +6 -0
  74. cryojax-0.2.2/src/cryojax/rotations/_lie_group.py +527 -0
  75. cryojax-0.2.2/src/cryojax/rotations/_rotation.py +67 -0
  76. cryojax-0.2.2/src/cryojax/simulator/__init__.py +70 -0
  77. cryojax-0.2.2/src/cryojax/simulator/_assembly/__init__.py +6 -0
  78. cryojax-0.2.2/src/cryojax/simulator/_assembly/_assembly.py +107 -0
  79. cryojax-0.2.2/src/cryojax/simulator/_assembly/_helix.py +277 -0
  80. cryojax-0.2.2/src/cryojax/simulator/_config.py +167 -0
  81. cryojax-0.2.2/src/cryojax/simulator/_conformation.py +27 -0
  82. cryojax-0.2.2/src/cryojax/simulator/_detector.py +188 -0
  83. cryojax-0.2.2/src/cryojax/simulator/_dose.py +22 -0
  84. cryojax-0.2.2/src/cryojax/simulator/_ice.py +94 -0
  85. cryojax-0.2.2/src/cryojax/simulator/_instrument.py +138 -0
  86. cryojax-0.2.2/src/cryojax/simulator/_integrators/__init__.py +12 -0
  87. cryojax-0.2.2/src/cryojax/simulator/_integrators/_fourier_slice_extract.py +178 -0
  88. cryojax-0.2.2/src/cryojax/simulator/_integrators/_gaussian_mixture.py +120 -0
  89. cryojax-0.2.2/src/cryojax/simulator/_integrators/_nufft_project.py +113 -0
  90. cryojax-0.2.2/src/cryojax/simulator/_integrators/_potential_integrator.py +37 -0
  91. cryojax-0.2.2/src/cryojax/simulator/_optics.py +232 -0
  92. cryojax-0.2.2/src/cryojax/simulator/_pipeline.py +491 -0
  93. cryojax-0.2.2/src/cryojax/simulator/_pose.py +347 -0
  94. cryojax-0.2.2/src/cryojax/simulator/_potential/__init__.py +14 -0
  95. cryojax-0.2.2/src/cryojax/simulator/_potential/_atom_potential.py +48 -0
  96. cryojax-0.2.2/src/cryojax/simulator/_potential/_scattering_potential.py +24 -0
  97. cryojax-0.2.2/src/cryojax/simulator/_potential/_voxel_potential.py +623 -0
  98. cryojax-0.2.2/src/cryojax/simulator/_specimen.py +164 -0
  99. cryojax-0.2.2/src/cryojax/typing/__init__.py +70 -0
  100. cryojax-0.2.2/tests/__init__.py +0 -0
  101. cryojax-0.2.2/tests/conftest.py +172 -0
  102. cryojax-0.2.2/tests/data/.gitkeep +0 -0
  103. cryojax-0.2.2/tests/data/1uao.pdb +3 -0
  104. cryojax-0.2.2/tests/data/3j9g_potential_ps4_4.mrc +3 -0
  105. cryojax-0.2.2/tests/data/3j9g_subunit_potential_ps4_4.mrc +3 -0
  106. cryojax-0.2.2/tests/test_agree_with_cistem.py +167 -0
  107. cryojax-0.2.2/tests/test_atom_routines.py +111 -0
  108. cryojax-0.2.2/tests/test_detector.py +46 -0
  109. cryojax-0.2.2/tests/test_distribution.py +36 -0
  110. cryojax-0.2.2/tests/test_ensemble.py +40 -0
  111. cryojax-0.2.2/tests/test_fft.py +37 -0
  112. cryojax-0.2.2/tests/test_filters_and_masks.py +40 -0
  113. cryojax-0.2.2/tests/test_helix.py +165 -0
  114. cryojax-0.2.2/tests/test_jit.py +19 -0
  115. cryojax-0.2.2/tests/test_normalize.py +36 -0
  116. cryojax-0.2.2/tests/test_pose_agreement.py +78 -0
  117. cryojax-0.2.2/tests/test_potential.py +102 -0
  118. cryojax-0.2.2/tests/test_projection_agreement.py +32 -0
  119. cryojax-0.2.2/tests/test_shape.py +24 -0
  120. cryojax-0.2.2/tests/test_voxels_from_atoms.py +138 -0
@@ -0,0 +1,4 @@
1
+ *.ipynb linguist-vendored
2
+ *.mrc filter=lfs diff=lfs merge=lfs -text
3
+ *.mrcs filter=lfs diff=lfs merge=lfs -text
4
+ *.pdb filter=lfs diff=lfs merge=lfs -text
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "monthly"
@@ -0,0 +1,45 @@
1
+ name: Build docs
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ deploy:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout repository
13
+ uses: actions/checkout@v4
14
+ with:
15
+ fetch-depth: 0
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.10"
21
+
22
+ - name: Install dependencies
23
+ run: |
24
+ pip install --upgrade pip
25
+ pip install mkdocs
26
+ pip install mkdocs-gen-files
27
+ pip install mkdocs-same-dir
28
+ pip install pymdown-extensions
29
+ pip install mkdocs-pymdownx-material-extras
30
+ pip install mkdocs-autorefs
31
+ pip install mkdocs-simple-plugin
32
+ pip install mkdocstrings-python
33
+ pip install mknotebooks
34
+ pip install mkdocs-material
35
+
36
+ - name: Build
37
+ run: |
38
+ mkdocs build
39
+
40
+ # Push the site to github-pages
41
+ - name: GitHub Pages action
42
+ uses: peaceiris/actions-gh-pages@v3
43
+ with:
44
+ github_token: ${{ secrets.GITHUB_TOKEN }}
45
+ publish_dir: ./site
@@ -0,0 +1,36 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ deploy:
10
+ name: Deploy
11
+ runs-on: ubuntu-latest
12
+
13
+ permissions:
14
+ # IMPORTANT: this permission is mandatory for trusted publishing on PyPi
15
+ # see https://docs.pypi.org/trusted-publishers/
16
+ id-token: write
17
+ # This permission allows writing releases
18
+ contents: write
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - name: 🐍 Set up Python
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.11"
29
+
30
+ - name: 👷 Build
31
+ run: |
32
+ python -m pip install build
33
+ python -m build
34
+
35
+ - name: 🚢 Publish to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,12 @@
1
+ # Runs the Ruff linter and formatter.
2
+
3
+ name: Lint
4
+
5
+ on: [push, pull_request]
6
+
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: chartboost/ruff-action@v1
@@ -0,0 +1,43 @@
1
+ # GHA workflow for running tests.
2
+ #
3
+ # Largely taken from
4
+ # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
5
+ # Please check the link for more detailed instructions
6
+
7
+ name: Tests
8
+
9
+ on:
10
+ pull_request:
11
+ push:
12
+ branches:
13
+ - main
14
+
15
+ jobs:
16
+ build:
17
+
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ python-version: ["3.11"]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v5
27
+ with:
28
+ lfs: true
29
+ python-version: ${{ matrix.python-version }}
30
+ - name: Install Git LFS
31
+ run: |
32
+ sudo apt-get update
33
+ sudo apt-get install git-lfs
34
+ git lfs install
35
+ - name: Pull LFS Files
36
+ run: git lfs pull
37
+ - name: Install dependencies
38
+ run: |
39
+ python -m pip install --upgrade pip
40
+ pip install .[test]
41
+ - name: Test with pytest
42
+ run: |
43
+ pytest tests/
@@ -0,0 +1,10 @@
1
+ .vscode/settings.json
2
+ *.swp
3
+ *_version.py
4
+ **/__pycache__
5
+ **/.ipynb_checkpoints
6
+ *.egg-info/
7
+ build/
8
+ dist/
9
+ site/
10
+ __pycache__
@@ -0,0 +1,24 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ ci:
4
+ autoupdate_schedule: monthly
5
+
6
+ repos:
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v3.2.0
9
+ hooks:
10
+ - id: trailing-whitespace
11
+ - id: end-of-file-fixer
12
+ - id: check-yaml
13
+ - id: check-added-large-files
14
+ - repo: https://github.com/astral-sh/ruff-pre-commit
15
+ # Ruff version.
16
+ rev: v0.3.4
17
+ hooks:
18
+ # Run the linter.
19
+ - id: ruff
20
+ types_or: [ python, pyi, jupyter ]
21
+ args: [ --fix ]
22
+ # Run the formatter.
23
+ - id: ruff-format
24
+ types_or: [ python, pyi, jupyter ]
@@ -0,0 +1,39 @@
1
+ # Contributor Guide
2
+
3
+ Contributions to this repository are welcome and greatly appreciated! I would love
4
+ for this package to grow and be supported by a larger community.
5
+
6
+ ## Design principles
7
+
8
+ `cryojax` is built on [equinox](https://docs.kidger.site/equinox/). In short, `equinox` provides an object-oriented interface to writing parameterized functions in `jax`. The core object of these parameterized functions is called a [Module](https://docs.kidger.site/equinox/api/module/module/) (yes, this takes inspiration from pytorch). `equinox` ships with features to interact with these `Module`s, and more generally with [pytrees](https://jax.readthedocs.io/en/latest/pytrees.html) in `jax`. One of the most useful of these features, not found in `jax` itself, is a means of performing out-of-place updates on pytrees through `equinox.tree_at`.
9
+
10
+ Equinox also provides a recommended pattern for writing `Module`s: https://docs.kidger.site/equinox/pattern/. We think this is a good template for code readability, so `cryojax` tries to adhere to these principles as much as possible.
11
+
12
+ ## Running tests and building the documentation
13
+
14
+ Both the tests and documentation use files stored remotely with git [LFS](https://git-lfs.com/). You will need to install `git lfs` locally in order to get these files.
15
+
16
+ ## How to report a bug
17
+
18
+ Report bugs on the [Issue Tracker](https://github.com/mjo22/cryojax/issues).
19
+
20
+ When filing an issue, make sure to answer these questions:
21
+
22
+ - Which operating system and Python version are you using?
23
+ - Which version of this project are you using?
24
+ - What did you do?
25
+ - What did you expect to see?
26
+ - What did you see instead?
27
+
28
+ The best way to get your bug fixed is to provide a test case, and/or steps to
29
+ reproduce the issue. In particular, please include a [Minimal, Reproducible
30
+ Example](https://stackoverflow.com/help/minimal-reproducible-example).
31
+
32
+ ## How to request a feature
33
+
34
+ Feel free to request features on the [Issue
35
+ Tracker](https://github.com/mjo22/cryojax/issues).
36
+
37
+ ## How to submit changes
38
+
39
+ Open a [Pull Request](https://github.com/mjo22/cryojax/pulls).