Skip to main content

Lab device base classes

This repository supplies some abstract base classes for various device families that are used as basis for specific implementations. Those base classes provide the frontend used by experimental scripts - the implementations are then done in a device specific way by other packages.

This package emerged from re-implementing different interfaces for different devices from time to time to provide some kind of common base structure for different devices.

The base classes just implement basic parameter validation and provide a calling convention. Changes should never break existing libraries.

Currently implemented base classes:

TEM architecture

The TEM abstraction is intentionally split into two layers:

  • TransmissionElectronMicroscope is the frontend entry point used by client code
  • TEMStack stores the ordered composition of the microscope
  • Individual subsystems are represented by classes derived from TEMComponent
  • Optical modes such as TEM and STEM are separate from runtime modes that store semantic parameter sets for intermediate operating points

This keeps client code independent of hardware specific details such as registers, message IDs or TCP commands. A backend implementation can later translate semantic operations onto a concrete microscope while still exposing the same class structure.

Example:

from labdevices.tem import TransmissionElectronMicroscope
from labdevices.tem import TEMStack, TEMOpticalMode, TEMDetectorMode, TEMColumnRegion
from labdevices.tem import ElectronSource, Monochromator, Lens, Stigmator, BeamBlanker
from labdevices.tem import ScanGenerator, SampleStage, AberrationCorrector
from labdevices.tem import Spectrometer, HighAngleAnnularDarkFieldDetector

stack = TEMStack([
    ElectronSource("x_feg", emission_type = "cold_field_emission"),
    Monochromator("monochromator"),
    Lens("c1", lens_family = "condenser", region = TEMColumnRegion.ILLUMINATION),
    Lens("c2", lens_family = "condenser", region = TEMColumnRegion.ILLUMINATION),
    Stigmator("condenser_stig", region = TEMColumnRegion.ILLUMINATION),
    BeamBlanker("blanker", region = TEMColumnRegion.ILLUMINATION),
    ScanGenerator("scan_generator", supported_modes = [TEMOpticalMode.STEM]),
    SampleStage("eucentric_stage"),
    Spectrometer("eels", supported_modes = [TEMOpticalMode.SPECTROSCOPY]),
    AberrationCorrector("probe_corrector", region = TEMColumnRegion.POST_SPECIMEN),
    HighAngleAnnularDarkFieldDetector(
        "haadf",
        supported_modes = [TEMOpticalMode.STEM]
    )
])

tem = TransmissionElectronMicroscope(
    stack = stack,
    supported_modes = [TEMOpticalMode.TEM, TEMOpticalMode.STEM]
)

detectors = tem.get_detectors(TEMDetectorMode.HIGH_ANGLE_ANNULAR_DARK_FIELD)

Runtime adjustments and intermediate operating points are supported without exposing registers to client code:

from labdevices.tem import TEMRuntimeMode

tem.set_optical_mode(TEMOpticalMode.STEM)
tem.stack["c2"].set_current(0.83)
tem.stack["c2"].set_focal_length(1.2e-3)
tem.stack["condenser_stig"].set_x(-0.02)
tem.stack["condenser_stig"].set_y(0.01)

tem.add_runtime_mode(TEMRuntimeMode(
    "probe_search",
    optical_mode = TEMOpticalMode.STEM,
    component_parameters = {
        "c2": {
            "current": 0.78,
            "focal_length": 1.4e-3
        },
        "condenser_stig": {
            "x": -0.03,
            "y": 0.015
        }
    }
))

tem.activate_runtime_mode("probe_search")

Metadata

Release files for pylabdevs-tspspi 0.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylabdevs-tspspi 0.0.19
File Size Uploaded
pylabdevs_tspspi-0.0.19.tar.gz 27.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylabdevs-tspspi 0.0.19
File Interpreter ABI Platform
pylabdevs_tspspi-0.0.19-py3-none-any.whl Python 3 none any Details

Total release size: 57.2 kB

Release files / pylabdevs_tspspi-0.0.19.tar.gz

Download URL pylabdevs_tspspi-0.0.19.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9af75b44911c9a47d3a46f66101d93ae543b2372b278755e53185bdea0673c68
BLAKE2b-256 checksum
How to use checksums
48cb64cb0a81389d878c505f0b4b34142f58b618bd1dad999c39c1c00e490255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / pylabdevs_tspspi-0.0.19-py3-none-any.whl

Download URL pylabdevs_tspspi-0.0.19-py3-none-any.whl
Size 29.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
748b2b9a26c19f582f0b44b42ee2177f5d4f94ab499b047bcc9f26513fa67368
BLAKE2b-256 checksum
How to use checksums
66937dd061422c6efc2df38afabc2f9fd4647b870858a43f51a91dfa65e74ad1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.0.19 This release

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page