Python SDK
EDS Capabilities
Use an EdsDevice to acquire EDS spectra and (where supported) collect EDS maps.
Attach the device to a session, then call acquire_spectrum() or collect_maps(). Each call blocks until the device completes (or reports failure).
Overview
EDS (Energy Dispersive Spectroscopy) devices are represented by EdsDevice. High-level capabilities include:
- acquire_spectrum — Collect a spectrum for a fixed live time; the file is uploaded to the server and can be downloaded via
spectrum_id. - collect_maps — Collect EDS maps (implementation-dependent; some devices may return "not implemented").
For point analysis, fix the SEM beam first (see Fix beam for EDS in Imaging), then attach the EDS device and run acquire_spectrum().
Device and session
Construct an EdsDevice with either device_slug or device_id. Attach it to a session before calling any capability.
from semphony.systems import EdsDevice
eds = EdsDevice(client, device_slug="edax-eds-001")
run = semphony.run("my_run", client=client, resume=True)
session = run.session().start()
eds.attach(session)
acquire_spectrum
Acquire an EDS spectrum with EDSSpectrumConfig: target_path (file path or name for the saved spectrum) and time_sec (live time in seconds). The call blocks until the device has collected and uploaded the file. The result’s spectrum_id is the file id on the server; use it to download the spectrum with client.download_file(spectrum_id, target_path=...) or by passing download=True and optional target_path to acquire_spectrum().
Ensure the beam is fixed on the SEM side (e.g. imaging.fix_beam_at(x, y)) before acquiring, and call imaging.stop_scan() when done (see Fix beam for EDS).
from semphony.models import EDSSpectrumConfig
result = eds.acquire_spectrum(
EDSSpectrumConfig(target_path="spot_1.msa", time_sec=30),
download=True,
target_path="downloaded_spectrum.msa",
)
# result.spectrum_id, result.local_path
collect_maps
Collect EDS maps with EDSMapsCollectionConfig (target_path, optional time_per_pixel_ms, elements). Returns EDSMapsResult with map_ids and metadata. Not all EDS implementations support this; some devices (e.g. EDAX GUI automation) may return a "not implemented" error.
from semphony.models import EDSMapsCollectionConfig
result = eds.collect_maps(
EDSMapsCollectionConfig(target_path="map.msa", time_per_pixel_ms=10),
)
# result.map_ids, result.metadata
Combined SEM + EDS workflow
Typical workflow: attach the imaging device, fix the beam at the point of interest, attach the EDS device, acquire the spectrum, then stop the scan. See the Fix beam for EDS section and the EDS examples.
# 1. Attach SEM, fix beam
tescan.attach(session)
tescan.imaging.fix_beam_at(512, 512)
# 2. Attach EDS, acquire spectrum
eds.attach(session)
result = eds.acquire_spectrum(EDSSpectrumConfig(target_path="spot.msa", time_sec=20))
# 3. Stop scan
tescan.imaging.stop_scan()