Skip to content

Commit 26f7d2e

Browse files
authored
Merge branch 'dev' into dev-create-release
2 parents 8026986 + 03ef468 commit 26f7d2e

File tree

8 files changed

+720
-20
lines changed

8 files changed

+720
-20
lines changed

.coveragerc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ omit =
55

66
[paths]
77
source =
8-
src/
8+
# running from pytribeam root on an offline machine
9+
src
10+
# full path to 'pytribeam/src' on a laser system
911
C:/Users/User/Desktop/Polonsky/____SOFTWARE/pytribeam/src
12+
# full path to `pytribeam/src` on a different laser system
1013
C:/Users/User/Documents/pytribeam/src
14+
C:/Users/apolon/Codebases/pytribeam/src

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Triggers when push/merge to the 'main' branch
7+
tags:
8+
- 'v*' # Triggers whenever you push a tag starting with 'v' (e.g., v0.0.2)
9+
10+
jobs:
11+
build-and-publish:
12+
name: Build and publish Python distribution
13+
runs-on: ubuntu-latest
14+
permissions:
15+
# This permission is REQUIRED for Trusted Publishing
16+
id-token: write
17+
contents: read
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install build
31+
32+
- name: Build binary wheel and source tarball
33+
run: python -m build
34+
35+
- name: Publish to PyPI
36+
uses: pypa/gh-action-pypi-publish@release/v1

CITATION.cff

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This CITATION.cff file was generated with cffinit.
2+
# Visit https://bit.ly/cffinit to generate yours today!
3+
4+
cff-version: 1.2.0
5+
title: pyTriBeam
6+
message: >-
7+
If you use this software, please cite it using these
8+
metadata.
9+
type: software
10+
authors:
11+
- given-names: Andrew
12+
family-names: Polonsky
13+
email: apolon@sandia.gov
14+
affiliation: Sandia National Laboratories
15+
orcid: 'https://orcid.org/0000-0003-4515-9827'
16+
- given-names: James
17+
family-names: Lamb
18+
email: jdlamb@sandia.gov
19+
affiliation: Sandia National Laboratories
20+
orcid: 'https://orcid.org/0000-0002-1409-9799'
21+
- given-names: Chad
22+
family-names: Hovey
23+
affiliation: Sandia National Laboratories
24+
email: chovey@sandia.gov
25+
orcid: 'https://orcid.org/0000-0003-0915-5765'
26+
identifiers:
27+
- type: doi
28+
value: 10.1007/s40192-026-00449-2
29+
description: Paper on software development and use
30+
repository-code: 'https://github.com/sandialabs/pytribeam'
31+
url: 'https://sandialabs.github.io/pytribeam/'
32+
abstract: Automated data collection for the TriBeam microscope
33+
keywords:
34+
- 3D materials science
35+
- serial sectioning
36+
- tomography
37+
- automation
38+
license: MIT

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,26 @@
1414

1515
Installation instructions and more can be found in the [User Guide](https://sandialabs.github.io/pytribeam/docs/userguide/book/index.html).
1616

17-
More info coming soon!
17+
## Citing ``pytribeam``
18+
19+
If ``pytribeam`` has been useful in your research, we invite you to cite the following paper on it's development and use:
20+
21+
Polonsky, A.T., Lamb, J.D., Hovey, C.B. et al. pyTriBeam: Open-Source Software for Enhanced 3D Data Collection in TriBeam Microscopes. Integr Mater Manuf Innov (2026). https://doi.org/10.1007/s40192-026-00449-2
22+
23+
Or using BibTeX:
24+
```bibtex
25+
@article{Polonsky2026,
26+
title = {pyTriBeam: Open-Source Software for Enhanced 3D Data Collection in TriBeam Microscopes},
27+
ISSN = {2193-9772},
28+
url = {http://dx.doi.org/10.1007/s40192-026-00449-2},
29+
DOI = {10.1007/s40192-026-00449-2},
30+
journal = {Integrating Materials and Manufacturing Innovation},
31+
publisher = {Springer Science and Business Media LLC},
32+
author = {Polonsky, Andrew T. and Lamb, James D. and Hovey, Chad B. and Schroader, Haydn and Echlin, McLean P. and Pollock, Tresa M.},
33+
year = {2026},
34+
month = feb
35+
}
36+
```
37+
38+
39+

docs/developers/gh-pages_content_guide.md

Lines changed: 101 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ curl -k -L -o badges/userguide.svg "https://img.shields.io/badge/userguide-Book-
8282

8383
## api docs
8484

85+
Run the following in a git bash terminal on Windows:
86+
8587
```sh
8688
pdoc ./src/pytribeam/ -o ./docs/api
8789
test -d badges/ || mkdir -p badges
@@ -111,18 +113,103 @@ anybadge -o -l api -v "$DOCSTRING_COVERAGE% coverage" -f badges/api.svg -c "$COL
111113
In order to run tests, the user must install ``pyTriBeam`` in editable mode and add their computer name to the list of machines in the ``Constants`` module. To find your hardware name, you can run the following from a python terminal:
112114

113115
```python
116+
import platform
117+
print(platform.node())
118+
```
119+
120+
### How to run test suite on simulator:
121+
Go to the root directory of `pytribeam` and run the following in a git bash terminal window. This will generate both a .xml and .html version of the coverage report.
122+
```sh
123+
pytest --cov=pytribeam --cov-report=html:coverage_reports/simulator/htmlcov/ --cov-report=xml:coverage_reports/simulator/coverage.xml --cov-report term-missing
124+
```
125+
A `.coverage` file will be generated in the root directory of `pytribeam`. Move the `.coverage` file into the `coverage_reports/simulator` folder.
126+
127+
#### TODO test improvements
128+
129+
- Stop test suite on hard ware if test fails
130+
- insert/rectract EBSD is not self contained if it fails
131+
- check for test independence
132+
- order tests in increasing complexity
133+
- some tests won't work on some systems (CBS stage restrictions)
134+
- need decorators for:
135+
- offline machines
136+
- machines with lasers
137+
- machines with CBS stage restriction locks (only the windows 7 Helios)
138+
- machine that doesn't fit into above (a fib with newer XtUI software)
139+
- auto add location of root directory to the .coveragerc?
140+
141+
142+
### How to run test suite on hardware:
143+
The microscope must first be prepared in order to safely run all tests. It is highly recommended to remove any sample and sample holder from the tool. **DO NOT run hardware tests if you are unfamiliar with the process.**
144+
145+
Prepare the microscope by doing the following:
146+
147+
- Remove CBS stage restrictions (non-Windows 7 machines)
148+
- Turn on electron beam, focus and link Z (WD of 15 mm for no sample)
149+
- For laser systems only:
150+
- Open laser app and disable laser interlock (turn the key so laser can fire)
151+
- Unlock the objective in the laser GUI
152+
- Ensure spin mill sample holder selected
153+
- Open EBSD software, enable proximity sensor and override alerts (Oxford only)
154+
- Manually check connections:
155+
- Open GUI and run "test connections" to ensure no "Error" states
156+
- Insert the EDS detector for a second and re-run "test connections", EDS detector should be "indeterminate"
157+
- Retract EDS detector
158+
- (potentially optional) Discover tests in testing tab
159+
From the root directory of `pytribeam`, run the following from command from a terminal, this will generate both a .xml and .html version of test coverage:
160+
```sh
161+
pytest -x --cov=pytribeam --cov-report=html:coverage_reports/hardware/htmlcov/ --cov-report=xml:coverage_reports/hardware/coverage.xml --cov-report term-missing
162+
```
163+
"-x" will stop suite if an error is encountered
164+
165+
A `.coverage` file will be generated in the root directory of `pytribeam`. Move the `.coverage` file into the `coverage_reports/hardware` folder.
166+
167+
### Combine test coverage
168+
169+
Combining test coverage reports allows us to account for differences in coverage for tests that can only run on specific hardware versions (e.g. systems with a laser) or that can run on a simulated microscope environment. When combining coverage reports, it is assumed to be performed on a non-microscope machine with an internet connection (with an `Offline` autoscript install). In order to combine coverage reports, the `.coveragerc` file must include the paths to all `pytribeam/src` directories used to generate `.coverage` files. A working example from 2/18/26 is given below:
170+
171+
`.coveragerc`:
172+
```
173+
[run]
174+
omit =
175+
# omit GUI files from tests
176+
src/pytribeam/GUI/*
177+
178+
[paths]
179+
source =
180+
# running from pytribeam root on an offline machine
181+
src
182+
# full path to 'pytribeam/src' on a laser system
183+
C:/Users/User/Desktop/Polonsky/____SOFTWARE/pytribeam/src
184+
# full path to `pytribeam/src` on a different laser system
185+
C:/Users/User/Documents/pytribeam/src
186+
C:/Users/apolon/Codebases/pytribeam/src
187+
188+
```
114189

190+
191+
Combine coverage reports using the generated `.coverage` files:
192+
193+
```sh
194+
coverage combine --append --keep ./coverage_reports/simulator/.coverage ./coverage_reports/hardware/.coverage
195+
```
196+
197+
Then generate a html report from the combined `.coverage` file, which should appear in the root directory of `pytribeam`:
198+
199+
```sh
200+
coverage html -d ./coverage_reports/combined/htmlcov
115201
```
116-
Run test suite on TriBeam:
117-
0. Remove CBS stage restructions
118-
1. Turn on ebeam, focus and link Z
119-
2. open laser app and disable laser interlock (turn the key so laser can fire)
120-
3. Open EBSD software, enable proximity sensor and override alerts (Oxford only)
121202

122-
combine coverage, now make badge in git-bash terminal:
203+
Alternatively (or additionally), an .xml report can be generated from the combined `.coverage` file:
123204

124205
```sh
125-
# pip install anybadge
206+
coverage xml -o ./coverage_reports/combined/coverage.xml
207+
```
208+
209+
Now make badge in git-bash terminal:
210+
211+
```sh
212+
pip install anybadge # if needed, should already be installed in local environment
126213
test -d badges/ || mkdir -p badges/
127214
LINES_COVERED=$(grep -oP 'lines-covered="\K[0-9]+' coverage_reports/combined/coverage.xml)
128215
LINES_VALID=$(grep -oP 'lines-valid="\K[0-9]+' coverage_reports/combined/coverage.xml)
@@ -140,22 +227,23 @@ else \
140227
fi
141228
```
142229

143-
combined test coverage, delete .gitignore to push these up
144-
145230
## lint logs
146231

232+
To generate a lint.log file and badge for lint score, run the following commands in a git bash terminal:
233+
147234
```sh
148235
mkdir -p logs/
149-
# pylint --output-format=text src/pytribeam | tee logs/lint.log || pylint-exit $?
150236

151-
# ignore GUI for linting
237+
# optionally ignore GUI for linting
152238
# pylint -v --ignore=GUI src/pytribeam | tee logs/lint.log || pylint-exit $?
153239

154-
pylint -v src/pytribeam | tee logs/lint.log || pylint-exit $? #ignore GUI for linting
240+
pylint -v src/pytribeam | tee logs/lint.log || pylint-exit $?
155241

156242
test -d badges/ || mkdir -p badges/
157243
PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' logs/lint.log)
158244
anybadge -o --label=lint --file=badges/lint.svg --value=${PYLINT_SCORE} 2=red 4=orange 8=yellow 10=green
159245
```
160246

161-
## versioning
247+
## versioning
248+
249+
Notes to come

0 commit comments

Comments
 (0)