temgym-core 0.1.0__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.
- temgym_core-0.1.0/.flake8 +4 -0
- temgym_core-0.1.0/.github/dependabot.yml +8 -0
- temgym_core-0.1.0/.github/workflows/ci.yml +75 -0
- temgym_core-0.1.0/.github/workflows/release.yml +82 -0
- temgym_core-0.1.0/.gitignore +41 -0
- temgym_core-0.1.0/.pre-commit-config.yaml +28 -0
- temgym_core-0.1.0/.readthedocs.yaml +17 -0
- temgym_core-0.1.0/CITATION.cff +55 -0
- temgym_core-0.1.0/LICENSE.md +674 -0
- temgym_core-0.1.0/PKG-INFO +321 -0
- temgym_core-0.1.0/README.md +296 -0
- temgym_core-0.1.0/codecov.yml +5 -0
- temgym_core-0.1.0/conftest.py +4 -0
- temgym_core-0.1.0/examples/aberrated_probe.ipynb +598 -0
- temgym_core-0.1.0/examples/aperture_diffraction.ipynb +452 -0
- temgym_core-0.1.0/examples/aperture_image.ipynb +399 -0
- temgym_core-0.1.0/examples/biprism.ipynb +603 -0
- temgym_core-0.1.0/examples/decompose_image_into_gaussians.ipynb +314 -0
- temgym_core-0.1.0/examples/fit_three_gaussians.ipynb +389 -0
- temgym_core-0.1.0/examples/single_gaussian_example.ipynb +250 -0
- temgym_core-0.1.0/examples/two_beam_interference.ipynb +507 -0
- temgym_core-0.1.0/pyproject.toml +48 -0
- temgym_core-0.1.0/pytest.ini +8 -0
- temgym_core-0.1.0/src/temgym_core/__init__.py +133 -0
- temgym_core-0.1.0/src/temgym_core/aberrations.py +108 -0
- temgym_core-0.1.0/src/temgym_core/components.py +591 -0
- temgym_core-0.1.0/src/temgym_core/coordinate_transforms.py +140 -0
- temgym_core-0.1.0/src/temgym_core/gaussian.py +427 -0
- temgym_core-0.1.0/src/temgym_core/grid.py +280 -0
- temgym_core-0.1.0/src/temgym_core/plotting.py +360 -0
- temgym_core-0.1.0/src/temgym_core/propagator.py +116 -0
- temgym_core-0.1.0/src/temgym_core/ray.py +166 -0
- temgym_core-0.1.0/src/temgym_core/run.py +267 -0
- temgym_core-0.1.0/src/temgym_core/source.py +188 -0
- temgym_core-0.1.0/src/temgym_core/transfer.py +183 -0
- temgym_core-0.1.0/src/temgym_core/tree_utils.py +181 -0
- temgym_core-0.1.0/src/temgym_core/utils.py +325 -0
- temgym_core-0.1.0/test_requirements.txt +5 -0
- temgym_core-0.1.0/tests/gaussian_sanity_notebook.ipynb +319 -0
- temgym_core-0.1.0/tests/test_component.py +465 -0
- temgym_core-0.1.0/tests/test_coordinates.py +40 -0
- temgym_core-0.1.0/tests/test_gaussians.py +997 -0
- temgym_core-0.1.0/tests/test_rays.py +114 -0
- temgym_core-0.1.0/tests/test_run.py +92 -0
- temgym_core-0.1.0/tests/test_transfer.py +153 -0
- temgym_core-0.1.0/tests/transfer_matrices.py +304 -0
- temgym_core-0.1.0/tox.ini +13 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- 'v[0-9]*'
|
|
8
|
+
tags:
|
|
9
|
+
- 'v[0-9]*'
|
|
10
|
+
pull_request:
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
tests:
|
|
18
|
+
strategy:
|
|
19
|
+
matrix:
|
|
20
|
+
python:
|
|
21
|
+
- version: "3.11"
|
|
22
|
+
toxenv: py311
|
|
23
|
+
- version: "3.12"
|
|
24
|
+
toxenv: py312
|
|
25
|
+
- version: "3.13"
|
|
26
|
+
toxenv: py313
|
|
27
|
+
- version: "3.14"
|
|
28
|
+
toxenv: py314
|
|
29
|
+
# - version: "3.15"
|
|
30
|
+
# toxenv: py315
|
|
31
|
+
os: [ubuntu-latest, windows-latest]
|
|
32
|
+
runs-on: ${{ matrix.os }}
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v7
|
|
35
|
+
with:
|
|
36
|
+
persist-credentials: false
|
|
37
|
+
- name: Choose Python version ${{ matrix.python.version }}
|
|
38
|
+
uses: actions/setup-python@v7
|
|
39
|
+
with:
|
|
40
|
+
python-version: '${{ matrix.python.version }}'
|
|
41
|
+
cache: 'pip'
|
|
42
|
+
- name: install tox
|
|
43
|
+
run: python3 -m pip install tox tox-uv
|
|
44
|
+
- name: run tox
|
|
45
|
+
run: tox -e '${{ matrix.python.toxenv }}'
|
|
46
|
+
# - name: submit code coverage
|
|
47
|
+
# uses: codecov/codecov-action@v4
|
|
48
|
+
# env:
|
|
49
|
+
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
50
|
+
mc-tests:
|
|
51
|
+
strategy:
|
|
52
|
+
matrix:
|
|
53
|
+
python_version: ["3.14"]
|
|
54
|
+
os: [ubuntu-latest]
|
|
55
|
+
runs-on: ${{ matrix.os }}
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v7
|
|
58
|
+
with:
|
|
59
|
+
persist-credentials: false
|
|
60
|
+
- name: Choose Python version ${{ matrix.python_version }}
|
|
61
|
+
uses: actions/setup-python@v7
|
|
62
|
+
with:
|
|
63
|
+
python-version: '${{ matrix.python_version }}'
|
|
64
|
+
cache: 'pip'
|
|
65
|
+
- name: install uv
|
|
66
|
+
run: python3 -m pip install uv
|
|
67
|
+
- name: install core
|
|
68
|
+
run: uv pip install --system .
|
|
69
|
+
- name: checkout mc
|
|
70
|
+
run: git clone -b main --single-branch https://github.com/LiberTEM/Microscope-Calibration.git
|
|
71
|
+
- name: install mc + test
|
|
72
|
+
working-directory: ./Microscope-Calibration
|
|
73
|
+
run: |
|
|
74
|
+
uv pip install --system .[test,common,diffraction,gui]
|
|
75
|
+
pytest tests/
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [released] # stable releases only (not drafts or pre-releases)
|
|
6
|
+
|
|
7
|
+
permissions: {} # deny by default; each job opts in below
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Build and verify distributions
|
|
12
|
+
runs-on: ubuntu-24.04
|
|
13
|
+
timeout-minutes: 15
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0 # hatch-vcs needs the tags
|
|
20
|
+
persist-credentials: false
|
|
21
|
+
|
|
22
|
+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
|
|
23
|
+
with:
|
|
24
|
+
enable-cache: false # no cache in a publishing workflow
|
|
25
|
+
|
|
26
|
+
- name: Build sdist and wheel
|
|
27
|
+
run: uv build # builds the wheel from the sdist
|
|
28
|
+
|
|
29
|
+
- name: Check package metadata
|
|
30
|
+
run: uvx twine check --strict dist/*
|
|
31
|
+
|
|
32
|
+
- name: Smoke-test wheel and compare version with tag
|
|
33
|
+
env:
|
|
34
|
+
TAG: ${{ github.event.release.tag_name }}
|
|
35
|
+
run: |
|
|
36
|
+
VERSION=$(uv run --isolated --no-project --with dist/*.whl \
|
|
37
|
+
python -c "import importlib.metadata as m, temgym_core; print(m.version('temgym-core'))")
|
|
38
|
+
echo "Built version: $VERSION / release tag: $TAG"
|
|
39
|
+
test "v$VERSION" = "$TAG" # assumes tags look like v0.1.0
|
|
40
|
+
|
|
41
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
if-no-files-found: error
|
|
46
|
+
|
|
47
|
+
publish-pypi:
|
|
48
|
+
name: Publish to PyPI
|
|
49
|
+
needs: build
|
|
50
|
+
runs-on: ubuntu-24.04
|
|
51
|
+
timeout-minutes: 10
|
|
52
|
+
environment:
|
|
53
|
+
name: pypi # must match the PyPI trusted-publisher entry
|
|
54
|
+
url: https://pypi.org/project/temgym-core/
|
|
55
|
+
permissions:
|
|
56
|
+
id-token: write # OIDC for Trusted Publishing; nothing else
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
59
|
+
with:
|
|
60
|
+
name: dist
|
|
61
|
+
path: dist/
|
|
62
|
+
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
63
|
+
# attestations (PEP 740) are generated automatically with Trusted Publishing
|
|
64
|
+
|
|
65
|
+
attach-to-release: # optional
|
|
66
|
+
name: Attach distributions to the GitHub release
|
|
67
|
+
needs: publish-pypi
|
|
68
|
+
runs-on: ubuntu-24.04
|
|
69
|
+
timeout-minutes: 10
|
|
70
|
+
permissions:
|
|
71
|
+
contents: write
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
74
|
+
with:
|
|
75
|
+
name: dist
|
|
76
|
+
path: dist/
|
|
77
|
+
- name: Upload assets
|
|
78
|
+
env:
|
|
79
|
+
GH_TOKEN: ${{ github.token }}
|
|
80
|
+
TAG: ${{ github.event.release.tag_name }}
|
|
81
|
+
run: gh release upload "$TAG" dist/* --repo "$GITHUB_REPOSITORY"
|
|
82
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
*.swp
|
|
2
|
+
*.pyc
|
|
3
|
+
*.bib.bak
|
|
4
|
+
*.bib.sav
|
|
5
|
+
__pycache__
|
|
6
|
+
.tox
|
|
7
|
+
docs/build/
|
|
8
|
+
.ipynb_checkpoints/
|
|
9
|
+
*.egg-info
|
|
10
|
+
htmlcov
|
|
11
|
+
coverage.xml
|
|
12
|
+
.coverage*
|
|
13
|
+
.pytest_cache
|
|
14
|
+
node_modules
|
|
15
|
+
build
|
|
16
|
+
dist
|
|
17
|
+
*.AppImage
|
|
18
|
+
dask-worker-space
|
|
19
|
+
AppDir
|
|
20
|
+
Miniconda3-latest-Linux-x86_64.sh
|
|
21
|
+
MANIFEST
|
|
22
|
+
.vscode
|
|
23
|
+
pip-wheel-metadata
|
|
24
|
+
data
|
|
25
|
+
*Thumbs.db
|
|
26
|
+
*.DS_Store
|
|
27
|
+
*.idea
|
|
28
|
+
.mypy_cache/
|
|
29
|
+
.benchmarks
|
|
30
|
+
junit.xml
|
|
31
|
+
.vscode-server
|
|
32
|
+
*.sif
|
|
33
|
+
examples/generated/
|
|
34
|
+
dist/
|
|
35
|
+
*.lprof
|
|
36
|
+
*.png
|
|
37
|
+
*nsys-rep
|
|
38
|
+
*.npy
|
|
39
|
+
examples/fourdstem_example/fourdstem_array.npy
|
|
40
|
+
.ruff_cache/
|
|
41
|
+
*.cfg
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# See https://pre-commit.com for more information
|
|
2
|
+
# See https://pre-commit.com/hooks.html for more hooks
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v5.0.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
files: ^src/
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
files: ^src/
|
|
11
|
+
- id: check-yaml
|
|
12
|
+
- id: check-added-large-files
|
|
13
|
+
- repo: https://github.com/pycqa/flake8
|
|
14
|
+
rev: 7.1.1
|
|
15
|
+
hooks:
|
|
16
|
+
- id: flake8
|
|
17
|
+
files: ^src/
|
|
18
|
+
# - repo: https://github.com/regebro/pyroma
|
|
19
|
+
# rev: "4.2"
|
|
20
|
+
# hooks:
|
|
21
|
+
# - id: pyroma
|
|
22
|
+
# exclude: ^examples/
|
|
23
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
24
|
+
rev: v3.19.0
|
|
25
|
+
hooks:
|
|
26
|
+
- id: pyupgrade
|
|
27
|
+
args: ["--py37-plus"]
|
|
28
|
+
exclude: ^examples/
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it using the metadata from this file."
|
|
3
|
+
type: software
|
|
4
|
+
title: "TemGymCore"
|
|
5
|
+
abstract: >-
|
|
6
|
+
A differentiable ray tracing package for transmission electron microscopy
|
|
7
|
+
built on JAX. Optical systems are described through the Jacobian (ABCD ray
|
|
8
|
+
transfer matrices) or Taylor-expansion coefficients of the ray coordinates
|
|
9
|
+
through the system, enabling, for example, the verification of coordinate
|
|
10
|
+
systems and descan error in 4D STEM shadow-image experiments.
|
|
11
|
+
authors:
|
|
12
|
+
- family-names: Landers
|
|
13
|
+
given-names: David
|
|
14
|
+
email: davidlandersresearch@gmail.com
|
|
15
|
+
orcid: "https://orcid.org/0000-0002-3295-9473"
|
|
16
|
+
affiliation: "Univ. Grenoble Alpes, CEA, IRIG, MEM, LEMMA, 17 avenue des Martyrs, Grenoble, 38000, France"
|
|
17
|
+
- family-names: Bryan
|
|
18
|
+
given-names: Matthew
|
|
19
|
+
email: matthewbryan52@gmail.com
|
|
20
|
+
orcid: "https://orcid.org/0000-0001-9134-384X"
|
|
21
|
+
affiliation: "CEA LETI, France"
|
|
22
|
+
- family-names: Weber
|
|
23
|
+
given-names: Dieter
|
|
24
|
+
email: d.weber@fz-juelich.de
|
|
25
|
+
orcid: "https://orcid.org/0000-0001-6635-9567"
|
|
26
|
+
affiliation: "Ernst Ruska-Centre for Microscopy and Spectroscopy with Electrons, Forschungszentrum Jülich, 52425 Jülich, Germany"
|
|
27
|
+
repository-code: "https://github.com/TemGym/TemGymCore"
|
|
28
|
+
url: "https://github.com/TemGym/TemGymCore"
|
|
29
|
+
license: GPL-3.0-only # must match the SPDX license in pyproject.toml
|
|
30
|
+
keywords:
|
|
31
|
+
- electron microscopy
|
|
32
|
+
- virtual twin
|
|
33
|
+
- ray tracing
|
|
34
|
+
- differentiable programming
|
|
35
|
+
- JAX
|
|
36
|
+
- 4D STEM
|
|
37
|
+
references:
|
|
38
|
+
- type: article
|
|
39
|
+
authors:
|
|
40
|
+
- family-names: Landers
|
|
41
|
+
given-names: David
|
|
42
|
+
- family-names: Clancy
|
|
43
|
+
given-names: Ian
|
|
44
|
+
- family-names: Weber
|
|
45
|
+
given-names: Dieter
|
|
46
|
+
- family-names: Dunin-Borkowski
|
|
47
|
+
given-names: Rafal E.
|
|
48
|
+
- family-names: Stewart
|
|
49
|
+
given-names: Andrew
|
|
50
|
+
title: "TEMGYM Basic: transmission electron microscopy simulation software for teaching and training of microscope operation"
|
|
51
|
+
journal: "Journal of Applied Crystallography"
|
|
52
|
+
volume: 56
|
|
53
|
+
issue: 4
|
|
54
|
+
year: 2023
|
|
55
|
+
doi: "10.1107/S1600576723005174"
|