Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
1f5e206
DriftCorrection updates 01
cophus Jun 13, 2025
10e01e1
Merge remote-tracking branch 'origin/dev' into dev
cophus Aug 13, 2025
991c59f
Adding fourier resampling to Dataset class
cophus Sep 2, 2025
bd09789
updating naming
cophus Sep 2, 2025
cb42626
Update bin method, add transpose and astype methods
cophus Sep 3, 2025
123781b
Merge branch 'dev' into drift
cophus Sep 3, 2025
eb52625
Adding origin shifting to fourier_resample
cophus Sep 3, 2025
4058b79
Adding tests, fixing bin and fourier_resample to pass
cophus Sep 3, 2025
be96a78
update bin to use sum or mean
cophus Sep 3, 2025
9f1ab34
modify edge blending, add inset axes
cophus Sep 5, 2025
a240323
modifying tight_layout call
cophus Sep 6, 2025
ba69b85
Fixing masking bug
cophus Sep 17, 2025
b8c1dcc
Merge remote-tracking branch 'origin/dev' into drift
cophus Nov 13, 2025
5aa4d29
adding imports to dataset.py
cophus Nov 13, 2025
28f3559
Merge remote-tracking branch 'cophus/drift' into drift
cophus Nov 13, 2025
8e3ef37
Updating dataset methods to pass tests
cophus Nov 13, 2025
1eff2ed
fixing show_2d to return proper axes handle
cophus Nov 13, 2025
980b736
Merge pull request #128 from electronmicroscopy/main
Nov 20, 2025
1f5101c
re-adding object_models accumulate constraints to fix logging
arthurmccray Nov 20, 2025
b91c911
fixing bug in object tv constraints
arthurmccray Nov 21, 2025
d670029
bugfix
smribet Nov 21, 2025
dc094ad
removing torchsummary
Nov 26, 2025
9f47118
Merge pull request #129 from electronmicroscopy/torchsummary-patch
quantem-bot Nov 26, 2025
ce62471
adding dense NN and cnn_dense NN
arthurmccray Dec 2, 2025
8040e45
fixing a dtype and adding comment about memory management in preproce…
arthurmccray Dec 13, 2025
267775d
refactoring and adding docstrings to core ml code
arthurmccray Dec 17, 2025
f1f8529
offset fix
smribet Dec 19, 2025
f665609
allow optimizing with fixed parameters
Dec 20, 2025
63459d3
unify API with fit and grid_search
Dec 20, 2025
f0e0235
Merge remote-tracking branch 'origin/dev' into drift
cophus Dec 21, 2025
5420d11
cleaning up dataset
cophus Dec 21, 2025
f8174a5
fixing tight_layout in show_2d
cophus Dec 21, 2025
3541154
switch to flat deconv_kernel_api, add obf and mf
Dec 21, 2025
a39ef2a
some tightening
Dec 21, 2025
aac4add
updating permutations utility
Dec 21, 2025
abb8215
two passes only when necessary
Dec 21, 2025
00fff32
mf typo
Dec 21, 2025
8185385
adding acbf as an alias
Dec 21, 2025
fcbf78d
add mf_epsilon parameter
Dec 21, 2025
8141dd0
add parallax flip_phase back
Dec 21, 2025
2c3151a
Merge remote-tracking branch 'origin/dev' into diffractive_imaging
Dec 22, 2025
e7ba042
add first streaming parallax implementation
Dec 22, 2025
d2cccb2
add StreamingParallax to init file
Dec 22, 2025
1492abc
Merge pull request #100 from electronmicroscopy/drift
cophus Jan 1, 2026
7ef8ced
various typing tweaks
gvarnavi Jan 4, 2026
f59399d
adding halfsets ssnr
gvarnavi Jan 4, 2026
97a4320
Merge remote-tracking branch 'origin/dev' into diffractive_imaging
gvarnavi Jan 4, 2026
982927c
ssnr scaling bugs
Jan 4, 2026
89929c3
changing setting device to cpu resets to gpu0 as well
arthurmccray Jan 5, 2026
5c1750b
adding torchinfo for summaries of models. also changing denseNN to no…
arthurmccray Jan 6, 2026
7f58cce
fixing the activation function caching for CNNs
arthurmccray Jan 6, 2026
64fb316
cleaning up HSiren and CNNDense networks
arthurmccray Jan 6, 2026
b7906eb
reconstruct w/o attributes, cleaned up halfsets and fit
gvarnavi Jan 7, 2026
2060cfc
optuna bugfix
gvarnavi Jan 7, 2026
84399e8
adding scaled ssnrs -- i think this is correct now
gvarnavi Jan 7, 2026
02d7242
minor changes to autoencoder formatting
arthurmccray Jan 8, 2026
0d3cc1c
clean up docstrings
gvarnavi Jan 8, 2026
c7e8463
minor fixed aberrations bugfix
gvarnavi Jan 8, 2026
c49994a
bugfix that was causing torch to be initialized to gpu by default. re…
arthurmccray Jan 9, 2026
d63aef3
typealias | fixed to support py313
bobleesj Jan 9, 2026
6404701
remove comment
bobleesj Jan 9, 2026
3b21c1d
i think you want to use the hyperparameters here
smribet Jan 9, 2026
8ab5ebd
im not sure if this is better since it still could lead to some confu…
smribet Jan 9, 2026
2511f14
least_squares_fit skeleton -- pushing to pull stephs changes
gvarnavi Jan 10, 2026
b6d3849
Merge branch 'diffractive_imaging' of https://github.com/electronmicr…
gvarnavi Jan 10, 2026
31fc543
clean up HyperparameterState
gvarnavi Jan 10, 2026
3045d22
chore: add __version__ in init via importlib
bobleesj Jan 10, 2026
f33cce6
Merge pull request #139 from bobleesj/__version__
Jan 10, 2026
7772b62
more explicit cleanup
gvarnavi Jan 10, 2026
a464d60
explicit printing
gvarnavi Jan 10, 2026
5879253
verbosity cleanup
gvarnavi Jan 10, 2026
cb3bc06
Add quantem.widget namespace package structure
bobleesj Jan 11, 2026
e1c85a7
Configure uv workspace for quantem.widget
bobleesj Jan 11, 2026
58ca10b
Update docs and gitignore for widget
bobleesj Jan 11, 2026
b8bb6f6
Update uv.lock for widget workspace
bobleesj Jan 11, 2026
57109fb
add phase-unwrapping utils
gvarnavi Jan 11, 2026
51fb690
Merge pull request #137 from bobleesj/3.13
Jan 11, 2026
62c973e
upgrading lock file
gvarnavi Jan 11, 2026
bd414d7
all --locked flag
gvarnavi Jan 11, 2026
e751c32
check uv.lock is up to date before deployment
gvarnavi Jan 11, 2026
16ba8d2
adding automated lockfile upgrade
gvarnavi Jan 11, 2026
05257ac
expanding matrix coverage, os only on pr to main
gvarnavi Jan 11, 2026
0047e4d
working phase-unwrap
gvarnavi Jan 11, 2026
d632653
phase unwrap improvements -- torch native
gvarnavi Jan 11, 2026
ed08a98
Add React/Vite setup for widget development
bobleesj Jan 11, 2026
2cdebc5
Add CounterWidget with anywidget integration
bobleesj Jan 11, 2026
754b2e5
Update docs and lockfile for widget dev
bobleesj Jan 11, 2026
6cc4614
least_squares fitting take 2
gvarnavi Jan 12, 2026
49eb104
adding recursive fit
gvarnavi Jan 12, 2026
3a5c6c5
various fitting api improvements and logging
gvarnavi Jan 12, 2026
769a1b0
clean up output
gvarnavi Jan 12, 2026
514a413
add bf cropping
gvarnavi Jan 12, 2026
dfeb99d
final tweak to make cropping optional
gvarnavi Jan 12, 2026
8c9206d
Add optional dependency, add all files recursively
bobleesj Jan 12, 2026
073f689
Merge pull request #142 from electronmicroscopy/uv-actions
quantem-bot Jan 12, 2026
8326ce9
Update uv.lock for widgets extra
bobleesj Jan 12, 2026
6491e20
Merge remote-tracking branch 'origin/dev' into diffractive_imaging
gvarnavi Jan 12, 2026
0173c24
chore: update lock file
quantem-bot Jan 12, 2026
2a3501f
Merge pull request #144 from electronmicroscopy/chore/update-lockfile…
Jan 12, 2026
9f7660b
Merge remote-tracking branch 'origin/dev' into diffractive_imaging
gvarnavi Jan 12, 2026
64c4b46
Merge pull request #141 from bobleesj/quantem.widget
Jan 12, 2026
0274ed3
Merge remote-tracking branch 'origin/dev' into diffractive_imaging
gvarnavi Jan 12, 2026
a8630aa
Merge branch 'dev' into ml
arthurmccray Jan 12, 2026
470a81e
small bug in optimize_hyperparameters and adding option to manually a…
smribet Jan 12, 2026
f2f6364
more idiomatic bugfix
gvarnavi Jan 13, 2026
42a8f50
use_optimized_state=True -> use_initial_state=False
gvarnavi Jan 13, 2026
dd7f29a
cuda does not support gelsd
gvarnavi Jan 13, 2026
881162f
Merge pull request #132 from electronmicroscopy/diffractive_imaging
smribet Jan 13, 2026
cd7f661
Merge branch 'dev' into ml
arthurmccray Jan 15, 2026
9559139
Add grid visualization to Dataset3d.show() with ncols and returnfig o…
bobleesj Jan 17, 2026
0cb23cb
Add NumPy-style docstrings and enhance Dataset3d.show()
bobleesj Jan 17, 2026
82119ff
center grid prior to rotating
gvarnavi Jan 18, 2026
9c25168
chore: update lock file
quantem-bot Jan 19, 2026
849a96e
updating config str handling
arthurmccray Jan 20, 2026
5d9a785
refactoring "block" to "layer" for DenseNN
arthurmccray Jan 20, 2026
7813b54
Merge pull request #131 from electronmicroscopy/ml
cedriclim1 Jan 20, 2026
8b1c8bd
add radial averaging on different bins
gvarnavi Jan 20, 2026
c967d41
Merge remote-tracking branch 'origin/dev' into diffractive_imaging
gvarnavi Jan 20, 2026
5be78df
Merge pull request #152 from electronmicroscopy/chore/update-lockfile…
Jan 20, 2026
ce3ec69
Merge remote-tracking branch 'origin/dev' into diffractive_imaging
gvarnavi Jan 20, 2026
fdca2dc
fixing "gpu" bug in config and adding pytest
arthurmccray Jan 20, 2026
c8743cf
adding flag to prevent pytest warnings for test_autoserialize
arthurmccray Jan 20, 2026
8f6a6b4
adding mps fallback for selecting device of "gpu"
arthurmccray Jan 20, 2026
5be5642
minor typing changes, before removing streaming parallax
gvarnavi Jan 21, 2026
c829286
remove streaming parallax
gvarnavi Jan 21, 2026
1d17127
test mps-cuda bug
gvarnavi Jan 21, 2026
f96f2c6
Merge pull request #153 from electronmicroscopy/hotfix-config
Jan 21, 2026
eafb601
Refactor: move show_2d import to module level
bobleesj Jan 22, 2026
c1f1451
adding pytest-cov to test deps
gvarnavi Jan 22, 2026
2fd0201
reverting rotation bug
gvarnavi Jan 22, 2026
faa9680
dataset3d show - support min, max, step, negative step
bobleesj Jan 23, 2026
540e373
consistent suptitle spacing for show() in dataset3d
bobleesj Jan 23, 2026
33597e5
simply padding logic for grid
bobleesj Jan 23, 2026
a3f463e
Merge pull request #154 from electronmicroscopy/diffractive_imaging
smribet Jan 23, 2026
fc1c30f
add tests - show function in dataset3d
bobleesj Jan 23, 2026
2686710
Merge pull request #150 from bobleesj/show3d
arthurmccray Jan 23, 2026
8ba1e92
adding workflow to regenerate lock on PR into main
gvarnavi Jan 23, 2026
f7a79fd
no need for widget
gvarnavi Jan 23, 2026
748c8ff
perhaps --no-workspace was wrong
gvarnavi Jan 23, 2026
a8455db
Merge pull request #156 from electronmicroscopy/actions-fix
quantem-bot Jan 23, 2026
b4f685d
Bump version to 0.1.8
quantem-bot Jan 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/check-pr-main-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@ jobs:

steps:
- name: Checkout PR branch (head)
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v7

- name: Ensure uv.lock is up to date
run: |
if ! uv lock --check; then
echo "❌ uv.lock is out of date."
echo "Please update uv.lock before versioning can proceed."
exit 1
fi

- name: Install the project
run: uv sync --all-extras --dev --no-editable
run: uv sync --locked --group test

- name: Get PR branch version
id: pr_version
Expand Down Expand Up @@ -86,7 +94,7 @@ jobs:
echo "Version matches — bumping version and creating new release branch"

uv version --bump patch
uv sync
uv sync --locked --group test
NEXT_VERSION=$(uv version --short)

if [[ "$NEXT_VERSION" == "$PR_VERSION" ]]; then
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/check-uv-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Check uv.lock is up to date

on:
pull_request:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
check-uv-lock:
runs-on: ubuntu-latest

steps:
- name: Checkout PR branch
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Check lock file
id: lockcheck
run: |
if uv lock --check; then
echo "up_to_date=true" >> $GITHUB_OUTPUT
else
echo "up_to_date=false" >> $GITHUB_OUTPUT
fi

- name: Exit early if lock is up to date
if: steps.lockcheck.outputs.up_to_date == 'true'
run: echo "uv.lock is up to date ✔"

- name: Regenerate lock file
if: steps.lockcheck.outputs.up_to_date == 'false'
run: |
if [[ "${GITHUB_HEAD_REF}" == release/* ]]; then
echo "❌ Release branch — uv.lock must already be up to date."
exit 1
fi

uv lock

- name: Commit updated lock file
if: steps.lockcheck.outputs.up_to_date == 'false'
run: |
SAFE_REF=$(echo "${GITHUB_HEAD_REF}" | tr '/' '-')

git config user.name "quantem-bot"
git config user.email "[email protected]"

git checkout -b lockfix/${SAFE_REF}
git commit -am "Update uv.lock"
git push origin lockfix/${SAFE_REF}

- name: Create PR for updated lock file
if: steps.lockcheck.outputs.up_to_date == 'false'
env:
GH_TOKEN: ${{ secrets.QUANTEM_BOT_PAT }}
run: |
SAFE_REF=$(echo "${GITHUB_HEAD_REF}" | tr '/' '-')

if gh pr list --head "lockfix/${SAFE_REF}" --json number --jq 'length > 0'; then
echo "Lockfix PR already exists — skipping."
exit 1
fi

gh pr create \
--base "${{ github.base_ref }}" \
--head "lockfix/${SAFE_REF}" \
--title "Update uv.lock" \
--body "This PR updates \`uv.lock\` to match the current dependency specification."

- name: Fail original PR
if: steps.lockcheck.outputs.up_to_date == 'false'
run: |
echo "❌ uv.lock was out of date — a fix PR has been opened."
exit 1
7 changes: 5 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ jobs:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v7

- name: Verify lock file is up to date
run: uv lock --check

- name: Build the project
run: uv build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-dev-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Open PR from main to dev
env:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/update-lock-file-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Update dependencies
on:
schedule:
# Run weekly on Mondays at 9 AM UTC
- cron: '0 9 * * 1'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: dev

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Update dependencies
env:
GH_TOKEN: ${{ secrets.QUANTEM_BOT_PAT }}
REPO: ${{ github.repository }}
run: |
set -e

git config user.name "quantem-bot"
git config user.email "[email protected]"

# Update the lock file
uv lock --upgrade

# Check if there are changes
if git diff --quiet uv.lock; then
echo "No dependency updates available"
exit 0
fi

# Create branch and commit
BRANCH="chore/update-lockfile-$(date +%Y%m%d)"
git checkout -b "$BRANCH"
git add uv.lock
git commit -m "chore: update lock file"
git push origin "$BRANCH"

# Create PR
PR_BODY=$(printf "Automated dependency update via \`uv lock --upgrade\`.\n\nPlease review the changes and run tests before merging.")
gh pr create \
--repo "$REPO" \
--head "$BRANCH" \
--base dev \
--title "chore: Update dependencies" \
--body "$PR_BODY"
14 changes: 9 additions & 5 deletions .github/workflows/uv-pytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,32 @@ on:
pull_request:
branches:
- dev
- main

jobs:
uv-pytests:
name: python
runs-on: ubuntu-latest
name: ${{ matrix.os }} / python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Test other OSs main branch PRs
os: ${{ github.base_ref == 'main' && fromJSON('["ubuntu-latest", "windows-latest", "macos-latest", "macos-15-intel"]') || fromJSON('["ubuntu-latest"]') }}
python-version:
- "3.11"
- "3.12"
- "3.13"
- "3.14"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install uv and set python version
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}

- name: Install the project
run: uv sync --locked --all-extras --group test
run: uv sync --locked --group test

- name: Run pytests
run: uv run pytest tests
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,7 @@ ipynb-playground/

# cursor
.cursor

# widget (JS build artifacts)
node_modules/
widget/src/quantem/widget/static/
7 changes: 7 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Getting started:
- [install uv](https://docs.astral.sh/uv/getting-started/installation/)
- `git clone` the repo and `cd` into the directory
- run `uv sync` to install all the dependencies in an editable environment
- run `uv sync --all-packages` to also install `quantem.widget` (optional)

For widget developers (requires [Node.js](https://nodejs.org/)):

- `cd widget && npm install` to install JS dependencies
- `npm run build` to build the widget
- `npm run dev` to watch for changes during development

The following will set up the pre-commit and [ruff](https://github.com/astral-sh/ruff) for linting and formatting. These commands only need to be run once when first setting up your dev environment:

Expand Down
18 changes: 15 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
addopts = [
"--import-mode=importlib",
]
testpaths = "tests"
testpaths = ["tests", "widget/tests"]

[tool.ruff.lint]
select = ["E4","E7","E9","F","I"]
Expand All @@ -21,9 +21,15 @@ line-length = 99
[tool.uv]
config-settings = { editable_mode = "compat" }

[tool.uv.workspace]
members = ["widget"]

[tool.uv.sources]
"quantem.widget" = { workspace = true }

[project]
name = "quantem"
version = "0.1.7"
version = "0.1.8"
description = "quantitative electron microscopy analysis toolkit."
keywords = ["EM","TEM","STEM","4DSTEM"]
readme = "README.md"
Expand All @@ -45,9 +51,14 @@ dependencies = [
"torchvision>=0.22.1",
"tensorboard>=2.19.0",
"torchmetrics>=1.7.3",
"torchsummary>=1.5.1",
"optuna>=4.5.0",
"hdf5plugin>=6.0.0",
"torchinfo>=1.8.0",
]

[project.optional-dependencies]
widgets = [
"quantem.widget",
]

[tool.hatch.build.targets.sdist]
Expand All @@ -62,6 +73,7 @@ only-include = [
[dependency-groups]
test = [
"pytest>=8.3.5",
"pytest-cov>=7.0.0",
]
dev = [
{ include-group = "test" },
Expand Down
7 changes: 7 additions & 0 deletions src/quantem/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

from importlib.metadata import version

from quantem.core import io as io
from quantem.core import datastructures as datastructures
from quantem.core import visualization as visualization

from quantem import imaging as imaging
from quantem import diffractive_imaging as diffractive_imaging

__version__ = version("quantem")
Loading
Loading