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 aserial.Serial
port instance. Use the methoddiscover
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:Without context manager and manually calling the
close
method afterwards:>>> sw = waveline.SpotWave("COM6") >>> print(sw.get_setup()) >>> ... >>> sw.close()
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 input and output buffer.
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 records.
get_data
(samples[, raw])Read snapshot of transient data.
Get logged AE data records data from internal memory
get_info
()Get device information.
Get setup.
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_pulsing
([interval, count])Start pulsing.
Stop acquisition.
Stop pulsing.
stream
(*args, **kwargs)Alias for
SpotWave.acquire
method.Attributes
Internal clock in Hz
USB product id of SpotWave device
USB vendor id of Vallen Systeme GmbH
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 callingclose
.
- 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 theget_tr_snapshot
command.
- 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_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.
- 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.
- 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.
- acquire(raw=False, poll_interval_seconds=0.01)[source]#
High-level method to continuously acquire data.
- Parameters:
- Yields:
AE and TR data records
- Return type:
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.