Low Energy Electron Microscopy data analysis toolkit
Project description
pyLEEM
A Python toolkit for Low Energy Electron Microscopy (LEEM) data analysis. pyLEEM provides readers, ROI tools, domain-specific analyzers, calibration analyzers, and workflow recording for reproducible runs.
Installation
pip install pyleem
Development installation
Clone the development branch:
git clone --branch develop https://github.com/peterhys/PyLEEM.git
cd PyLEEM
pip install -e .
Design
Overview
pyLEEM is a Python toolkit for analyzing Low Energy Electron Microscopy (LEEM) data. It provides tools for reading LEEM metadata and raw data, and for calibrating and analyzing X-ray Photoelectron Spectroscopy (XPS), Secondary Electron Energy Spectroscopy (SEES), Diffuse Elastic Scattering Pattern (DESP), and X-ray Absorption Spectroscopy (XAS).
Additional tools include stitching that can create a continuous spectrum from overlapping spectra.
The package is designed to be modular and extendable.
Reader class
The Reader class takes care of converting a LEEM file into a Python-readable format, and
parses all the metadata from the file. Currently, the only available reader is the
UViewReader class, used to read UView .dat files. Custom readers can be
easily implemented to support other file formats.
ROI class
The ROI class is used to define the region of interest (ROI) for the analysis.
ROI can either be manually defined or parsed from an ImageJ ROI file. Calibrated
ROI stores calibration parameters for the region of interest. For LEEM, the pixel per eV
and peak shift values are used to convert the pixel profile to the proper energy scale.
Analyzer class
The base unit of pyLEEM analysis is an Analyzer object.
The basic Analyzer class provides simple analysis tools for raw data.
For domain-specific analysis, Analyzer subclasses can be created. Currently, the
available subclasses are:
SEESAnalyzer: Secondary Electron Energy Spectroscopy (SEES) analyzer.DESPAnalyzer: Diffuse Elastic Scattering Pattern (DESP) analyzer.XASAnalyzer: X-ray Absorption Spectroscopy (XAS) analyzer.XPSAnalyzer: X-ray Photoelectron Spectroscopy (XPS) analyzer.
These subclasses provide domain-specific analysis tools for the raw data.
Workflow
For reproducibility, workflow can be used to build readers, ROI, and analyzer objects, and define tasks. Workflow can be loaded and saved from configuration TOML files.
Users can instantiate readers, ROI, and analyzers directly without Config or Workflow. Users use Workflow when they want standardized calibration, reproducible input, parameters, and streamlined I/O.
Examples
For detailed examples, please refer to the example notebook.
The notebook uses the external example data repository. Clone it
as example/ next to the notebook:
git clone https://github.com/peterhys/pyLEEM-example.git example
Here we show some examples of pyLEEM's capabilities.
XPS: binding energy calibration, peak fitting and stitching
from pyleem.analysis.xps import XPSAnalyzer, XPSCalibration
from pyleem.reader import UViewReader, read_files
from pyleem.roi import LineROI
readers = read_files(
["xps_0.dat", "xps_1.dat", "xps_2.dat"],
UViewReader,
metadata_list=[
{"Beam Energy": (400, "eV")},
{"Beam Energy": (400, "eV")},
{"Beam Energy": (400, "eV")},
],
)
roi = LineROI(src=[0, 0], dst=[0, 127], linewidth=1)
calibration = XPSCalibration(readers, roi)
cal_result = calibration.analyze(
baselines=[(197, 100)] * 3,
num_peaks=1,
ref_index=0,
ref_value=285.0,
)
analyzer = XPSAnalyzer(
readers,
roi,
cal_result["pixel_per_ev"],
cal_result["peak_shift"],
)
fit_result = analyzer.fit(0, num_peaks=1, baseline=(200, 100))
# Automatically stitch profiles into a single spectrum
stitched_energy, stitched_profile = analyzer.stitch_profiles([0, 1, 2])
SEES: surface potential from an onset shift
from pyleem.analysis.sees import SEESAnalyzer, SEESCalibration
from pyleem.reader import UViewReader, read_files
from pyleem.roi import LineROI
readers = read_files(["sees_0.dat", "sees_1.dat", "sees_2.dat"], UViewReader)
roi = LineROI(src=[0, 0], dst=[0, 127], linewidth=1)
calibration = SEESCalibration(readers, roi)
cal_result = calibration.analyze(sigma=0)
analyzer = SEESAnalyzer(
[readers[0]],
roi,
cal_result["pixel_per_ev"],
cal_result["peak_shift"],
sigma=10,
)
result = analyzer.analyze_profile(0)
print(result["surface_potential"])
Workflow: run and save analysis results
Workflow file can be partially filled as a template for distribution.
sees_calibration.toml
[session]
reader = "UViewReader"
roi = "LineROI"
analyzer = "SEESCalibration"
[reader]
paths = ["sees_0.dat", "sees_1.dat", "sees_2.dat"]
[roi]
src = [0, 0]
dst = [0, 127]
linewidth = 1
[task]
sigma = 0
import pyleem.analysis.sees # registers SEESCalibration class
from pyleem.config import load_config
from pyleem.workflow import Workflow
config = load_config("sees_calibration.toml")
workflow = Workflow(config)
result = workflow.run()
workflow.save("sees_calibration_run.toml")
Documentation
License
pyLEEM is distributed under the BSD 3-Clause License, see LICENSE.
Additional Brookhaven National Laboratory, U.S. Department of Energy, and U.S. Government rights notices are provided in NOTICE.
Third-party dependencies are distributed under their own licenses, see THIRD_PARTY_LICENSES.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyleem-0.3.0.tar.gz.
File metadata
- Download URL: pyleem-0.3.0.tar.gz
- Upload date:
- Size: 56.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f789345f065dde8ec807880ce5e4a78cec994d269d7fcccc3d7e5a1b32b9f646
|
|
| MD5 |
03bdd9b6a3e70a5c3082a068ed995e6a
|
|
| BLAKE2b-256 |
be9d90034575ae1e494734664251188c79bacf2001fcb223b8818417f3d25c0a
|
Provenance
The following attestation bundles were made for pyleem-0.3.0.tar.gz:
Publisher:
publish-pypi.yml on peterhys/pyLEEM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyleem-0.3.0.tar.gz -
Subject digest:
f789345f065dde8ec807880ce5e4a78cec994d269d7fcccc3d7e5a1b32b9f646 - Sigstore transparency entry: 2063494984
- Sigstore integration time:
-
Permalink:
peterhys/pyLEEM@56219cf76369044b67938e6aa4c36cb34d57843d -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/peterhys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@56219cf76369044b67938e6aa4c36cb34d57843d -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyleem-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pyleem-0.3.0-py3-none-any.whl
- Upload date:
- Size: 43.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05b6e531fa04679e18459ec82851293533556b8110eb099cc23a084e833eb121
|
|
| MD5 |
9c23c941d06e74b144a4bbb18aae223f
|
|
| BLAKE2b-256 |
930e9c58fae47ba24e7fcaf53562680ff38e8dcba7d17c1ca9c13528effe91dd
|
Provenance
The following attestation bundles were made for pyleem-0.3.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on peterhys/pyLEEM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyleem-0.3.0-py3-none-any.whl -
Subject digest:
05b6e531fa04679e18459ec82851293533556b8110eb099cc23a084e833eb121 - Sigstore transparency entry: 2063494991
- Sigstore integration time:
-
Permalink:
peterhys/pyLEEM@56219cf76369044b67938e6aa4c36cb34d57843d -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/peterhys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@56219cf76369044b67938e6aa4c36cb34d57843d -
Trigger Event:
release
-
Statement type: