Metadata-Version: 2.4
Name: zebsdsolve
Version: 0.1.0
Summary: EBSD pattern-centre fitting and indexing on the GPU (Zig + WGSL over WebGPU), with its web app
Author: Zachary Varley
License-Expression: MIT
License-File: LICENSE
License-File: wgpu-native-LICENSE.MIT
Project-URL: Source, https://github.com/ZacharyVarley/zebsdsolve
Project-URL: Issues, https://github.com/ZacharyVarley/zebsdsolve/issues
Keywords: EBSD,electron backscatter diffraction,indexing,pattern center,spherical harmonics,webgpu,gpu,microscopy
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Requires-Dist: numpy
Description-Content-Type: text/markdown

# zebsdsolve

EBSD pattern-centre fitting and indexing on the GPU, in the browser or from Python.

**[Open the web app](https://zacharyvarley.github.io/zebsdsolve/)**: it runs on your GPU inside the page (Chrome or Edge 137+). Scans are read in place, in pieces, so a 100 GB file is neither uploaded nor loaded into memory. Click **Example** for a small nickel scan, or **Make toy scan** to simulate one from a master pattern.

## What it does

- **Indexes** by spherical cross-correlation over all orientations, refined on the detector: about 23 000 patterns per second on a desktop GPU, 67 000 in two sweeps. Dictionary indexing is there too.
- **Fits the geometry**: the pattern centre by a vote of a few patterns, then the detector's whole pose (position, rotation and, optionally, pixel size) together with the patterns' orientations.
- **Prepares patterns**: binning, neighbour averaging (NLPAR), static and dynamic background, CLAHE, band pass, mask.
- **Handles several phases**, and writes `.ang` and `.ctf`.
- **Reads** h5ebsd (kikuchipy, Bruker, EDAX, Oxford `.h5oina`), EDAX `.up1` / `.up2`, Oxford `.ebsp`, NORDIF `Pattern.dat`. Master patterns: [ebsdsim](https://github.com/ZacharyVarley/ebsdsim) `.npz` and EMsoft `.h5`.

One engine (Zig and WGSL) runs natively through wgpu-native and as WebAssembly on WebGPU, so the app and the Python package do the same thing.

## Python

```bash
pip install zebsdsolve
python -m zebsdsolve          # the same app, served locally
```

```python
import zebsdsolve as ze

res = ze.index("scan.h5", ["Ni.npz"], fit="pose")    # vote, pose fit, then index
res.quaternions, res.ncc, res.phase                  # per map cell
res.geometry                                         # what the fits found
```

Every option is a keyword ([src/settings.zig](https://github.com/ZacharyVarley/zebsdsolve/blob/main/src/settings.zig)); `ze.Solver` drives the steps one at a time. Two tutorials are in [examples/](https://github.com/ZacharyVarley/zebsdsolve/blob/main/examples/).

## More

- [How it works, and what was measured](https://github.com/ZacharyVarley/zebsdsolve/blob/main/docs/how-it-works.md): each method, the numbers behind the defaults, and what is not verified.
- [CONTRIBUTING.md](https://github.com/ZacharyVarley/zebsdsolve/blob/main/CONTRIBUTING.md): building, testing, conventions.

MIT ([LICENSE](https://github.com/ZacharyVarley/zebsdsolve/blob/main/LICENSE)). The wheels bundle [wgpu-native](https://github.com/gfx-rs/wgpu-native) (MIT / Apache-2.0); the example scan is kikuchipy's `nickel_ebsd_large`, CC BY 4.0 ([sources](https://github.com/ZacharyVarley/zebsdsolve/blob/main/testdata/README.md)).
