SpotWave#

class waveline.spotwave.SpotWave(port)[source]#

Interface for spotWave devices.

The spotWave device is connected via USB and exposes a virtual serial port for communication.

__init__(port)[source]#

Initialize device.

Parameters:

port (Union[str, Serial]) – Either the serial port id (e.g. “COM6”) or a serial.Serial port instance. Use the method discover to get a list of ports with connected spotWave devices.

Returns:

Instance of SpotWave

Example

There are two ways constructing and using the SpotWave class:

  1. Without context manager and manually calling the close method afterwards:

    >>> sw = waveline.SpotWave("COM6")
    >>> print(sw.get_setup())
    >>> ...
    >>> sw.close()
    
  2. Using the context manager:

    >>> with waveline.SpotWave("COM6") as sw:
    >>>     print(sw.get_setup())
    >>>     ...
    

Methods

__init__(port)

Initialize device.

acquire([raw, poll_interval_seconds])

High-level method to continuously acquire data.

clear_buffer()

Clear input and output buffer.

clear_data_log()

Clear logged data from internal memory.

close()

Close serial connection to the device.

connect()

Open serial connection to the device.

discover()

Discover connected spotWave devices.

get_ae_data()

Get AE data records.

get_data(samples[, raw])

Read snapshot of transient data.

get_data_log()

Get logged AE data records data from internal memory

get_info()

Get device information.

get_setup()

Get setup.

get_status()

Get status.

get_tr_data([raw])

Get transient data records.

get_tr_snapshot(samples[, raw])

Read snapshot of transient data.

identify()

Blink LED to identify device.

set_cct(interval_seconds)

Set coupling check ransmitter (CCT) / pulser interval.

set_continuous_mode(enabled)

Enable/disable continuous mode.

set_datetime([timestamp])

Set current date and time.

set_ddt(microseconds)

Set duration discrimination time (DDT).

set_filter([highpass, lowpass, order])

Set IIR filter frequencies and order.

set_logging_mode(enabled)

Enable/disable data log mode.

set_status_interval(seconds)

Set status interval.

set_threshold(microvolts)

Set threshold for hit-based acquisition.

set_tr_decimation(factor)

Set decimation factor of transient data.

set_tr_enabled(enabled)

Enable/disable recording of transient data.

set_tr_postduration(samples)

Set post-duration samples for transient data.

set_tr_pretrigger(samples)

Set pre-trigger samples for transient data.

start_acquisition()

Start acquisition.

start_pulsing([interval, count])

Start pulsing.

stop_acquisition()

Stop acquisition.

stop_pulsing()

Stop pulsing.

stream(*args, **kwargs)

Alias for SpotWave.acquire method.

Attributes

CLOCK

Internal clock in Hz

PRODUCT_ID

USB product id of SpotWave device

VENDOR_ID

USB vendor id of Vallen Systeme GmbH

connected

Check if the connection to the device is open.

VENDOR_ID = 8849#

USB vendor id of Vallen Systeme GmbH

PRODUCT_ID = 272#

USB product id of SpotWave device

CLOCK = 2000000#

Internal clock in Hz

connect()[source]#

Open serial connection to the device.

The connect method is automatically called in the constructor. You only need to call the method to reopen the connection after calling close.

close()[source]#

Close serial connection to the device.

property connected: bool#

Check if the connection to the device is open.

classmethod discover()[source]#

Discover connected spotWave devices.

Return type:

List[str]

Returns:

List of port names

identify()[source]#

Blink LED to identify device.

Note

Available since firmware version 00.2D.

clear_buffer()[source]#

Clear input and output buffer.

get_info()[source]#

Get device information.

Return type:

Info

Returns:

Dataclass with device information

get_setup()[source]#

Get setup.

Return type:

Setup

Returns:

Dataclass with setup information

get_status()[source]#

Get status.

Return type:

Status

Returns:

Dataclass with status information

set_continuous_mode(enabled)[source]#

Enable/disable continuous mode.

Threshold will be ignored in continous mode. The length of the records is determined by ddt with set_ddt.

Note

The parameters for continuous mode with transient recording enabled (set_tr_enabled) have to be chosen with care - mainly the decimation factor (set_tr_decimation) and ddt (set_ddt). The internal buffer of the device can store up to ~200.000 samples.

If the buffer is full, data records are lost. Small latencies in data polling can cause overflows and therefore data loss. One record should not exceed half the buffer size (~100.000 samples). 25% of the buffer size (~50.000 samples) is a good starting point. The number of samples in a record is determined by ddt and the decimation factor d: \(n = ddt_{\mu s} \cdot f_s / d = ddt_{\mu s} \cdot 2 / d\) \(\implies ddt_{\mu s} \approx 50.000 \cdot d / 2\)

On the other hand, if the number of samples is small, more hits are generated and the CPU load increases.

Parameters:

enabled (bool) – Set to True to enable continuous mode

set_ddt(microseconds)[source]#

Set duration discrimination time (DDT).

Parameters:

microseconds (int) – DDT in µs

set_status_interval(seconds)[source]#

Set status interval.

Parameters:

seconds (int) – Status interval in s

set_tr_enabled(enabled)[source]#

Enable/disable recording of transient data.

Parameters:

enabled (bool) – Set to True to enable transient data

set_tr_decimation(factor)[source]#

Set decimation factor of transient data.

The sampling rate of transient data will be 2 MHz / factor.

Parameters:

factor (int) – Decimation factor

set_tr_pretrigger(samples)[source]#

Set pre-trigger samples for transient data.

Parameters:

samples (int) – Pre-trigger samples

set_tr_postduration(samples)[source]#

Set post-duration samples for transient data.

Parameters:

samples (int) – Post-duration samples

set_cct(interval_seconds)[source]#

Set coupling check ransmitter (CCT) / pulser interval.

The pulser amplitude is 3.3 V.

Parameters:

interval_seconds (float) – Pulser interval in seconds. If < 0, the pulse is synchronized with the first sample of the get_tr_snapshot command.

set_filter(highpass=None, lowpass=None, order=4)[source]#

Set IIR filter frequencies and order.

Parameters:
  • highpass (Optional[float]) – Highpass frequency in Hz (None to disable highpass filter)

  • lowpass (Optional[float]) – Lowpass frequency in Hz (None to disable lowpass filter)

  • order (int) – Filter order

set_datetime(timestamp=None)[source]#

Set current date and time.

Parameters:

timestamp (Optional[datetime]) – datetime.datetime object, current time if None

set_threshold(microvolts)[source]#

Set threshold for hit-based acquisition.

Parameters:

microvolts (float) – Threshold in µV

set_logging_mode(enabled)[source]#

Enable/disable data log mode.

Parameters:

enabled (bool) – Set to True to enable logging mode

start_acquisition()[source]#

Start acquisition.

stop_acquisition()[source]#

Stop acquisition.

start_pulsing(interval=1, count=0)[source]#

Start pulsing.

The pulser amplitude is 3.3 V. The number of pulses should be even, because pulses are generated by a square-wave signal (between LOW and HIGH) and the pulse signal should end LOW.

Parameters:
  • interval (float) – Interval between pulses in seconds

  • count (int) – Number of pulses per channel (should be even), 0 for infinite pulses

stop_pulsing()[source]#

Stop pulsing.

get_ae_data()[source]#

Get AE data records.

Return type:

List[AERecord]

Returns:

List of AE data records (either status or hit data)

get_tr_data(raw=False)[source]#

Get transient data records.

Parameters:

raw (bool) – Return TR amplitudes as ADC values if True, skip conversion to volts

Return type:

List[TRRecord]

Returns:

List of transient data records

get_tr_snapshot(samples, raw=False)[source]#

Read snapshot of transient data.

The recording starts with the execution of the command. The trai and time of the returned records are always 0.

Parameters:
  • samples (int) – Number of samples to read

  • raw (bool) – Return ADC values if True, skip conversion to volts

Return type:

TRRecord

Returns:

Transient data record

get_data(samples, raw=False)[source]#

Read snapshot of transient data.

The recording starts with the execution of the command.

Deprecated: Please us the get_tr_snapshot method instead.

Parameters:
  • samples (int) – Number of samples to read

  • raw (bool) – Return ADC values if True, skip conversion to volts

Return type:

ndarray

Returns:

Array with amplitudes in volts (or ADC values if raw is True)

acquire(raw=False, poll_interval_seconds=0.01)[source]#

High-level method to continuously acquire data.

Parameters:
  • raw (bool) – Return TR amplitudes as ADC values if True, skip conversion to volts

  • poll_interval_seconds (float) – Pause between data polls in seconds

Yields:

AE and TR data records

Return type:

Iterator[Union[AERecord, TRRecord]]

Example

>>> with waveline.SpotWave("COM6") as sw:
>>>     # apply settings
>>>     sw.set_ddt(400)
>>>     for record in sw.stream():
>>>         # do something with the data depending on the type
>>>         if isinstance(record, waveline.AERecord):
>>>             ...
>>>         if isinstance(record, waveline.TRRecord):
>>>             ...
stream(*args, **kwargs)[source]#

Alias for SpotWave.acquire method.

Deprecated: Please us the acquire method instead.

get_data_log()[source]#

Get logged AE data records data from internal memory

Return type:

List[AERecord]

Returns:

List of AE data records (either status or hit data)

clear_data_log()[source]#

Clear logged data from internal memory.