Skip to content

Scanner

pyglaze.scanning.Scanner

A synchronous scanner for Glaze terahertz devices.

Parameters:

Name Type Description Default
config TConfig

Device configuration for the scanner.

required
initial_phase_estimate float | None

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

None

config property writable

Configuration used in the scan.

disconnect()

Close serial connection.

get_firmware_version()

Get the firmware version of the connected device.

Returns:

Name Type Description
str str

The firmware version of the connected device.

get_phase_estimate()

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

Returns:

Type Description
float | None

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

get_serial_number()

Get the serial number of the connected device.

Returns:

Name Type Description
str str

The serial number of the connected device.

scan()

Perform a scan.

Returns:

Name Type Description
UnprocessedWaveform UnprocessedWaveform

A raw waveform.

update_config(new_config)

Update the DeviceConfiguration used in the scan.

Parameters:

Name Type Description Default
new_config DeviceConfiguration

New configuration for scanner

required

Examples

Initialize a Scanner and perform a scan

The config file should be valid JSON conforming to the specific DeviceConfiguration type. See e.g. a definition here. Be sure to replace mock_device and mock_delay with suitable values.

1
2
3
4
5
6
from pyglaze.device import LeDeviceConfiguration
from pyglaze.scanning import Scanner

device_config = LeDeviceConfiguration(amp_port="mock_device")
scanner = Scanner(config=device_config)
scan_result = scanner.scan()