Skip to main content

Precilaser

Python versions on PyPI Precilaser version on PyPI Code style: black

Python interface for precilaser devices

Implements a python interface using pyserial for 3 Precilaser devices:

  • Precilaser Fiber DFB
  • Precilaser Amplifier
  • Precilaser SHG Amplifier

Installation

pip install precilaser or install directly from source.

This project is managed with uv. For development, clone the repository and run uv sync to create a virtual environment with all dependencies (including the test tooling), then uv run pytest to run the tests and uv build to build the sdist/wheel.

Implemented Functionality

Precilaser Fiber DFB

  • status
    retrieve the laser status, in a dataclass (with some of the boilerplate code removed; see status.py for more detail):
      @dataclass
      class SeedStatus:
        status_bytes: bytes
        endian: str
        temperature_set: float # grating temperature setpoint [C]
        temperature_act: float # grating temperature [C]
        temperature_diode: float # [C]
        current_set: int # [mA]
        current_act : int # [mA]
        wavelength: float # [nm]
        piezo_voltage: float # [V]
        emission: bool
        power: int
        run_hours: int
        run_minutes: int
    
  • temperature_setpoint
    get or set the grating temperature in C
  • piezo_voltage
    get or set the piezo voltage, from 0 V to 5 V
  • _get_serial_wavelength_params
    retrieve the parameters required to reconstruct the wavelength from the grating temperature
  • wavelength
    calculate the wavelength from the retrieved parameters and the grating temperature

Precilaser Amplifier

  • status
    retrieve the amplifier status, in a dataclass (with some of the boilerplate code removed; see status.py for more detail):
    @dataclass
    class AmplifierStatus:
      status_bytes: bytes
      endian: str
      stable: bool
      system_status: SystemStatus
      driver_unlock: DriverUnlock
      driver_current: Tuple[float, ...]
      pd_value: Tuple[int, ...] # internal photodiode values in arb. units
      pd_status: Tuple[PDStatus, ...]
      temperatures: Tuple[float] # internal temperatures of amplifier stages etc.
    
    @dataclass
    class SystemStatus:
      status: int
      pd_protection: Tuple[bool, ...]
      temperature_protection: Tuple[bool, ...]
      fault: bool
    
    @dataclass
    class DriverUnlock:
      driver_unlock: int
      driver_enable_control: Tuple[bool, ...]
      driver_enable_flag: Tuple[bool, ...]
      interlock: bool # true if the interlock is ok
    
    @dataclass
    class PDStatus:
      status: int
      sampling_enable: bool
      hardware_protection: bool
      upper_limit_enabled: bool
      lower_limit_enabled: bool
      hardware_protection_event: bool
      upper_limit_event: bool
      lower_limit_event: bool
      fault: bool
    
  • current
    get or set the amplifier current [A]
  • enable()
    enable the amplifier
  • disable()
    disable the amplifier
  • save() save amplifier settings to ROM
  • enable_power_stabilization()
    enable power stabilization mode; varies the amplifier current to keep the output power constant
  • disable_power_stabilization() disable power stabilization mode

Precilaser Amplifier

A subclass of the Amplifier, includes all Amplifier functionality plus additionally:

  • shg_temperature get or set the shg crystal temperature [C]

Example

The devices can be used directly or as a context manager; the context manager guarantees the serial port is closed when the block exits.

from precilaser import SHGAmplifier

with SHGAmplifier("COM50", address=0) as amp:
    # change the SHG crystal temperature
    amp.shg_temperature = 73.15

Or, without the context manager, close the port explicitly when done:

from precilaser import SHGAmplifier

amp = SHGAmplifier("COM50", address=0)
amp.shg_temperature = 73.15
amp.close()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

precilaser-0.2.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

precilaser-0.2.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file precilaser-0.2.1.tar.gz.

File metadata

  • Download URL: precilaser-0.2.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for precilaser-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e820ebb3bf0a0bc2dfc29a0489f3c3e9e39bf40fc0ea170ef248fe9b02caffc0
MD5 89842f2fe439c90779b63ec2d6be865e
BLAKE2b-256 08ec2fc3348cd28f9983dfafc72eb53a4f5648fc182462eb685f137284d9ccc1

See more details on using hashes here.

Provenance

The following attestation bundles were made for precilaser-0.2.1.tar.gz:

Publisher: publish.yml on ograsdijk/precilaser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file precilaser-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: precilaser-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for precilaser-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ec1e29aaa28e051444016a9bf7bbfb4d05632b04a3798f5a64a67fcf5009fb2
MD5 201449c7624a39072bc75ef0799ecb57
BLAKE2b-256 8ff8179d88eb792489da562a983b9e7bb9c4eccccaacac99717d2a89874d71b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for precilaser-0.2.1-py3-none-any.whl:

Publisher: publish.yml on ograsdijk/precilaser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 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