Skip to content

GlazeClient

pyglaze.scanning.GlazeClient

Warning

Ensure that you are properly connected to the lock-in amp, have it selected, and a configuration is chosen.

Open a connection to and start continuously scanning using the Glaze device.

Parameters:

Name Type Description Default
config DeviceConfiguration

Configuration to use for scans

required
initial_phase_estimate float | None

Optional initial phase estimate in radians for lock-in detection. Use this to maintain consistent polarity across scanning sessions.

None

__enter__()

Start the scanner and return the client.

__exit__(*args)

Stop the scanner and close the connection.

get_firmware_version()

Get the firmware version of the connected device.

get_phase_estimate()

Get the current phase estimate from the lock-in phase estimator.

Can be called even after the client has been stopped, allowing phase estimates to be extracted and reused for maintaining consistent polarity across sessions.

Returns:

Type Description
float | None

float | None: The current phase estimate in radians, or None if not yet estimated.

Raises:

Type Description
SerialException

If the scanner was never started.

get_serial_number()

Get the serial number of the connected device.

read(n_pulses)

Read a number of pulses from the Glaze system.

Parameters:

Name Type Description Default
n_pulses int

The number of terahertz pulses to read from the CCS server.

required

Examples

Initialize a Scanner and perform two scans
from pyglaze.device import LeDeviceConfiguration
from pyglaze.scanning import GlazeClient


def main() -> None:
    n_pulses = 2
    device_config = LeDeviceConfiguration(
        amp_port="mock_device", delayunit="mock_delay"
    )
    with GlazeClient(device_config) as client:
        unprocessed_waveforms = client.read(n_pulses=n_pulses)


if __name__ == "__main__":
    main()
  1. The config file should be valid JSON of the DeviceConfiguration type. See a list of configuration options under "API Reference > Device".