Adaptive Milling
Adaptive milling plugins for fibsemOS. This package currently contains:
- AdaptivePolishing: a milling strategy that uses machine learning to determine when polishing is complete.
- AsymmetricFiducial: a milling pattern that adds some asymmetry to the default Fiducial pattern.
Installation
Adaptive Milling is available from PyPI and can be installed via the following steps:
-
Decide where you want to create your Python virtual environment and open a terminal in that location.
-
Follow the one of the sets of instructions below. We recommend using 'uv' as it handles installing the appropriate torch backend automatically.
-
Create a desktop shortcut for AutoLamella (fibsemOS GUI). With the virtual environment activated, run the appropriate command for you operating system:
:: Windows Command Prompt (not PowerShell): creates AutoLamella.bat echo @echo off > AutoLamella.bat & where fibsem-autolamella-ui >> AutoLamella.bat
# Linux / macOS terminal: creates AutoLamella.sh printf '#!/bin/bash\n%s' $(which fibsem-autolamella-ui) > AutoLamella.sh chmod +x AutoLamella.sh
Then create a shortcut to the script and place it on your desktop.
Install using uv (recommended)
# Create a virtual environment (Python 3.11 to match AutoScript's environment)
uv venv --python 3.11
# Activate the virtual environment (Windows)
.venv\Scripts\activate
# Install including AutoLamella from fibsemOS with the appropriate PyTorch backend for your machine
uv pip install adaptive-milling[ui] --torch-backend auto
To activate the virtual environment on Linux systems: source .venv/bin/activate
Install using miniforge
# Create a virtual environment (Python 3.11 to match AutoScript's environment)
conda create -p ./.venv python=3.11 pip
# Activate the virtual environment
conda activate ./.venv
# Install PyTorch (select appropriate compute platform, see table below)
python -m pip install torch torchvision --index-url <Index URL>
# Install including AutoLamella from fibsemOS
python -m pip install adaptive-milling[ui]
If using CUDA, the version must be below or equal to the the system CUDA version, which can be checked with the command nvidia-smi.
| Compute Platform | Index URL |
|---|---|
| CPU | https://download.pytorch.org/whl/cpu |
| CUDA 11.3 | https://download.pytorch.org/whl/cu113 |
| CUDA 11.8 | https://download.pytorch.org/whl/cu118 |
| CUDA 12.6 | https://download.pytorch.org/whl/cu126 |
| CUDA 12.8 | https://download.pytorch.org/whl/cu128 |
Usage
Please see the user guide.
Segmentation models
Models are available from zenodo: https://zenodo.org/records/21804785. We currently recommend using AM_SEM_All_V01.pth (download link).
If you wish to train your own segmentation models that are compatible with Adaptive Milling, or refine existing ones with new data, please use the package AM-model-training, also available on PyPI. We encourage you to contribute your models and training data back to the project so that others may share the benefit. To do this, please contact casper.berger@rfi.ac.uk.
Testing
You can run the package tests using pytest:
uv run pytest
Issues
Please use the GitHub issue tracker to submit bugs or request features.
Contributions
If you would like to help contribute to project, please read our contribution guide and code of conduct.
If you would like to contribute data towards training new segmentation models, please contact casper.berger@rfi.ac.uk.
License
Copyright Rosalind Franklin Institute, 2024.
Distributed under the terms of the Apache-2.0 license with "Commons Clause" License Condition v1.0, see the license for further details.
Release files for adaptive-milling 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| adaptive_milling-0.4.1.tar.gz | 14.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adaptive_milling-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 MB
Release files / adaptive_milling-0.4.1.tar.gz
| Download URL | adaptive_milling-0.4.1.tar.gz |
|---|---|
| Size | 14.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a904be3ccbb69b12d7fb8f4fcb61ea650fecec32310edce641ccdb55fbcbfa7
|
|
BLAKE2b-256 checksum How to use checksums |
0c2e97fa6062477afa559c0ecc73968831b9f73a17b667c32ae234bd622a082c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / adaptive_milling-0.4.1-py3-none-any.whl
| Download URL | adaptive_milling-0.4.1-py3-none-any.whl |
|---|---|
| Size | 49.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf46ef0a53a88603455a6c9a6afbab7de8b8a722d8d986fa30827aaa9d74c55d
|
|
BLAKE2b-256 checksum How to use checksums |
70d3decc3b48968f88fd88efed288b3c01e9636b04d35dca862ce9530451b0bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log