hotopy 0.21__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 (65) hide show
  1. hotopy-0.21/.gitignore +147 -0
  2. hotopy-0.21/.gitlab-ci.yml +137 -0
  3. hotopy-0.21/.pre-commit-config.yaml +11 -0
  4. hotopy-0.21/CONTRIBUTE.md +44 -0
  5. hotopy-0.21/LICENSE +674 -0
  6. hotopy-0.21/PKG-INFO +89 -0
  7. hotopy-0.21/README.md +48 -0
  8. hotopy-0.21/conda/recipe.yaml +58 -0
  9. hotopy-0.21/doc/.gitignore +2 -0
  10. hotopy-0.21/doc/Makefile +20 -0
  11. hotopy-0.21/doc/check-doc.sh +14 -0
  12. hotopy-0.21/doc/source/conf.py +86 -0
  13. hotopy-0.21/doc/source/doi_role.py +51 -0
  14. hotopy-0.21/doc/source/index.rst +22 -0
  15. hotopy-0.21/doc/source/notebooks/chapter1_images.ipynb +53 -0
  16. hotopy-0.21/doc/source/reference/index.rst +10 -0
  17. hotopy-0.21/helpers/repack_mat_dataset.py +64 -0
  18. hotopy-0.21/pyproject.toml +77 -0
  19. hotopy-0.21/src/hotopy/__init__.py +42 -0
  20. hotopy-0.21/src/hotopy/datasets/__init__.py +76 -0
  21. hotopy-0.21/src/hotopy/datasets/_fetcher.py +37 -0
  22. hotopy-0.21/src/hotopy/datasets/_holograms.py +54 -0
  23. hotopy-0.21/src/hotopy/datasets/_phantoms.py +120 -0
  24. hotopy-0.21/src/hotopy/datasets/registry.txt +9 -0
  25. hotopy-0.21/src/hotopy/holo/__init__.py +124 -0
  26. hotopy-0.21/src/hotopy/holo/_ap.py +103 -0
  27. hotopy-0.21/src/hotopy/holo/_ctf.py +455 -0
  28. hotopy-0.21/src/hotopy/holo/_pbi.py +94 -0
  29. hotopy-0.21/src/hotopy/holo/_pca.py +92 -0
  30. hotopy-0.21/src/hotopy/holo/_tieregime.py +344 -0
  31. hotopy-0.21/src/hotopy/holo/_tikhonov.py +424 -0
  32. hotopy-0.21/src/hotopy/holo/_util.py +496 -0
  33. hotopy-0.21/src/hotopy/holo/constraints.py +239 -0
  34. hotopy-0.21/src/hotopy/holo/propagation.py +387 -0
  35. hotopy-0.21/src/hotopy/holo/regularization.py +202 -0
  36. hotopy-0.21/src/hotopy/image/__init__.py +114 -0
  37. hotopy-0.21/src/hotopy/image/_filter.py +607 -0
  38. hotopy-0.21/src/hotopy/image/_generators.py +100 -0
  39. hotopy-0.21/src/hotopy/image/_inpainting.py +103 -0
  40. hotopy-0.21/src/hotopy/image/_registration.py +118 -0
  41. hotopy-0.21/src/hotopy/image/_stats.py +223 -0
  42. hotopy-0.21/src/hotopy/image/_transforms.py +328 -0
  43. hotopy-0.21/src/hotopy/optimize.py +649 -0
  44. hotopy-0.21/src/hotopy/tomo/__init__.py +184 -0
  45. hotopy-0.21/src/hotopy/tomo/_alignment.py +150 -0
  46. hotopy-0.21/src/hotopy/tomo/_astra.py +763 -0
  47. hotopy-0.21/src/hotopy/tomo/_operators.py +104 -0
  48. hotopy-0.21/src/hotopy/tomo/_reprojection_alignment.py +345 -0
  49. hotopy-0.21/src/hotopy/tomo/_ringremove.py +164 -0
  50. hotopy-0.21/src/hotopy/utils/__init__.py +72 -0
  51. hotopy-0.21/src/hotopy/utils/_io.py +110 -0
  52. hotopy-0.21/src/hotopy/utils/_misc.py +90 -0
  53. hotopy-0.21/src/hotopy/utils/_padding.py +206 -0
  54. hotopy-0.21/src/hotopy/utils/_xray.py +59 -0
  55. hotopy-0.21/src/hotopy/utils/fourier.py +342 -0
  56. hotopy-0.21/tests/affine_transform2D.py +71 -0
  57. hotopy-0.21/tests/image_registration.py +139 -0
  58. hotopy-0.21/tests/median_filter.py +25 -0
  59. hotopy-0.21/tests/phantoms.py +32 -0
  60. hotopy-0.21/tests/remove_outliers.py +29 -0
  61. hotopy-0.21/tests/tomo.py +150 -0
  62. hotopy-0.21/tests/tomo_angles.py +52 -0
  63. hotopy-0.21/tests/tomo_linking.py +63 -0
  64. hotopy-0.21/tests/tomo_orientation.py +135 -0
  65. hotopy-0.21/tests/tomo_reprojection_alignment.py +153 -0
hotopy-0.21/.gitignore ADDED
@@ -0,0 +1,147 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ #build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+
116
+ # Spyder project settings
117
+ .spyderproject
118
+ .spyproject
119
+
120
+ # Visual Studio Code settings
121
+ .vscode/
122
+
123
+ # Rope project settings
124
+ .ropeproject
125
+
126
+ # mkdocs documentation
127
+ /site
128
+
129
+ # mypy
130
+ .mypy_cache/
131
+ .dmypy.json
132
+ dmypy.json
133
+
134
+ # Pyre type checker
135
+ .pyre/
136
+
137
+ # pytype static type analyzer
138
+ .pytype/
139
+
140
+ # Cython debug symbols
141
+ cython_debug/
142
+
143
+ # MacOS related
144
+ .DS_Store
145
+
146
+ # PyCharm files
147
+ .idea
@@ -0,0 +1,137 @@
1
+ image: python:3.12
2
+
3
+ stages:
4
+ - lint
5
+ - build
6
+ - deploy
7
+
8
+
9
+ ruff-check:
10
+ stage: lint
11
+ script:
12
+ - pip install --no-cache-dir ruff
13
+ - ruff check -o ruff-check.log src/
14
+ artifacts:
15
+ when: on_failure
16
+ paths:
17
+ - ruff-check.log
18
+ rules:
19
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
20
+
21
+
22
+ ruff-format:
23
+ stage: lint
24
+ script:
25
+ - pip install --no-cache-dir ruff
26
+ - ruff format --check src/
27
+ rules:
28
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
29
+
30
+
31
+ sphinx:
32
+ stage: lint
33
+ script:
34
+ - apt-get update -y
35
+ - apt-get install -y pandoc
36
+ - pip install --no-cache-dir sphinx pydata-sphinx-theme sphinxcontrib-bibtex
37
+ - pip install --no-cache-dir numpy scipy ipykernel nbsphinx tqdm
38
+ - cd doc
39
+ - tmp=$(mktemp -d)
40
+ - sphinx-build -b html source $tmp
41
+ - code=$?
42
+ - rm -rf $tmp
43
+ - exit $code
44
+ rules:
45
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
46
+
47
+
48
+ build_conda:
49
+ stage: build
50
+ image: mambaorg/micromamba
51
+ # image: condaforge/miniforge3
52
+ script:
53
+ - micromamba install -c conda-forge rattler-build -y --quiet
54
+ - rattler-build build --experimental --recipe conda/recipe.yaml --output-dir /tmp/rattler/
55
+ - mkdir conda-dist
56
+ - cp -r /tmp/rattler/noarch conda-dist/
57
+ artifacts:
58
+ paths:
59
+ - conda-dist/noarch/*
60
+ rules:
61
+ # run only if tag in format 'vXXX' is created
62
+ - if: $CI_COMMIT_TAG =~ /^v\S+/
63
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
64
+
65
+
66
+ build_whl:
67
+ stage: build
68
+ script:
69
+ - pip install --no-cache-dir build
70
+ - python -m build
71
+ artifacts:
72
+ paths:
73
+ - dist
74
+ rules:
75
+ - if: $CI_COMMIT_TAG =~ /^v\S+/
76
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
77
+
78
+
79
+ pages:
80
+ stage: deploy
81
+ script:
82
+ - apt-get update -y
83
+ - apt-get install -y pandoc
84
+ - pip install --no-cache-dir sphinx pydata-sphinx-theme sphinxcontrib-bibtex
85
+ - pip install --no-cache-dir numpy scipy ipykernel nbsphinx tqdm
86
+ - cd doc
87
+ - sphinx-build -b html source build
88
+ - mv build ../public
89
+ - echo 'Done'
90
+ artifacts:
91
+ paths:
92
+ - public
93
+ rules:
94
+ # run only if tag in format 'vXXX' is created
95
+ - if: $CI_COMMIT_TAG =~ /^v\S+/
96
+
97
+
98
+ upload_conda:
99
+ stage: deploy
100
+ dependencies:
101
+ - build_conda
102
+ script:
103
+ - apt-get update -q && apt-get install -q -y --no-install-recommends curl
104
+ - PKG_VERSION=${CI_COMMIT_TAG:1} # strip first character
105
+ - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file conda-dist/noarch/hotopy-*.conda "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/hotopy/${PKG_VERSION}/"'
106
+ rules:
107
+ # run only if tag in format 'vXXX' is created
108
+ - if: $CI_COMMIT_TAG =~ /^v\S+/
109
+
110
+
111
+ upload_whl:
112
+ stage: deploy
113
+ dependencies:
114
+ - build_whl
115
+ script:
116
+ - pip install --no-cache-dir twine
117
+ - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
118
+ rules:
119
+ # run only if tag in format 'vXXX' is created
120
+ - if: $CI_COMMIT_TAG =~ /^v\S+/
121
+
122
+ #
123
+ #condabuild:
124
+ # rules:
125
+ # # run only if tag in format 'vXXX' is created
126
+ # - if: $CI_COMMIT_TAG =~ /^v\S+/
127
+ # stage: release
128
+ # image: condaforge/miniforge3
129
+ # script:
130
+ # - apt-get update -q && apt-get install -q -y --no-install-recommends curl
131
+ # - conda install conda-build -y --quiet
132
+ # - mkdir /opt/target
133
+ # - conda-build --output-folder /opt/target .
134
+ # - VERS=$(sed -rn 's/version\s?=\s?"(.+)"/\1/p' pyproject.toml)
135
+ # - echo $VERS
136
+ # - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file /opt/target/noarch/hotopy-*.tar.bz2 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/conda/${VERS}/hotopy-${VERS}-${CI_COMMIT_SHORT_SHA}.tar.bz2"'
137
+
@@ -0,0 +1,11 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.10.0
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff
8
+ files: ^src
9
+ # Run the formatter.
10
+ - id: ruff-format
11
+ files: ^src
@@ -0,0 +1,44 @@
1
+ ## How to contribute
2
+
3
+ Generally checkout the [NumPy developer docs](https://numpy.org/doc/stable/dev/howto-docs.html) and setup your git first.
4
+
5
+ Clone the repository and setup pre-commit hooks
6
+ ```commandline
7
+ git clone git@gitlab.gwdg.de:irp/hotopy.git
8
+ cd hotopy
9
+ ```
10
+
11
+ (Optional) Create a venv and launch it to your current shell
12
+ ```commandline
13
+ python3 -m venv venv --prompt HoToPy
14
+ source venv/bin/activate
15
+ ```
16
+
17
+ Install `hotopy` module in editable mode (note: you may add the `--user` flag if you are not using venv's)
18
+ ```commandline
19
+ pip install -e '.[dev,docs,tomo]'
20
+ pre-commit install
21
+ ```
22
+
23
+ Make a new branch for the new feature / fix you want to develop.
24
+ ```commandline
25
+ git checkout -b <usefulandshortname>
26
+ ```
27
+
28
+ Write the code. Make sure by running pre-commit it does not raise errors or warnings. You can check this anytime
29
+ by running
30
+ ```commandline
31
+ pre-commit
32
+ ```
33
+
34
+ Push your code to the corresponding branch in the remote repository.
35
+ ```commandline
36
+ git push -u origin HEAD
37
+ ```
38
+
39
+ At this point other people can see your code, but it is not part of the master branch, so you can get feedback and help without having to worry about breaking anything.
40
+
41
+ When you are happy and think, your adjustments should be included in the master
42
+ branch, create a merge request on the Gitlab website. Someone else will then check your code and merge it into the master branch if appropriate.
43
+
44
+ Only when you know what you are doing and are certain not to break anything, small changes can also be pushed directly to the master branch.