pylab_ml.scope.lecroy.base_lecroy.LecroyGenericScope
- class LecroyGenericScope(**kwargs)[source]
Bases:
LecroyInterface to LeCroy Oscilloscopes.
The Lecroy ‘wavesurfer’ & ‘HBO with SENT option’ Oscilloscopes can be driven over the network TCP/IP with this interface.
- Initialisation arguments:
host : hostname, should by LeCroy serial number addr : IP_address, should hostname not be available port : scope TCP/IP port (1861 by default)
Example: Initialization
>>> scope = hwlib.lecroy.Scope("lcry4066n50407")
>>> scope.trig_channel = 1 >>> scope.trig_level = 1.5 >>> scope.trig_slope = "POS" >>> scope.trig_mode = "norm"
>>> scope.tdiv = 1e-3 >>> scope.tdelay = -3e-3
>>> scope.channel = 1 >>> scope.trace = True >>> scope.vdiv = 1.0 >>> scope.offs = 0
Example: Coherent waveform grabbing
>>> try: >>> scope.trig_oneshot (0.5); >>> except scope.TriggerTimeout as err: >>> print (err) >>> w1 = scope.get_waveform(2) >>> w2 = scope.get_waveform(2) >>> scope.trig_mode = scope.mode_before_oneshot
- reset() reset
- identify() instrument message, reflect address & interfade
- message("") instrument message ("string") or ()
- close() terminate interface
- get_waveform(n) get waveform data from channel n
- trig_oneshot(t) single measurement trigger to waveform or timeout after t s
- Properties:
memsize id tdiv tdelay trig_slope trig_level trig_mode trig_channel channel trace vdiv offs waveform
Methods
__init__(**kwargs)Initialize the LecroyGenericScope interface.
close([force])Close connection to instrument.
find_names() returns list of identifiers strings, lhs of = assignments
Issue on LeCroy-wavesurfer, once active channel changed & used, trigger.
get_waveform([channel])Get the waveform data from the specified channel and return the time and voltage arrays.
help()Print the docstring of the instrument class.
identify([showInstName])Identify message.
init([identify])Optional init for interlock startup after identification.
message([message])Send a message to the Lecroy scope.
mqtt_add(client, instrument[, liste, qos])Add the instrument to mqtt.
Remove the instrument from mqtt.
publish(topic, value)Publish topic as type='cmd' with payload=value.
publish_get(function_name, value)Publish function_name as type='get' with paylad=value.
publish_set(function_name, value)Publish function_name as type='set' with paylad=value.
reset()Reset the Lecroy scope.
Set up the Lecroy scope with initial settings.
trig_oneshot([timeout])Trigger a single measurement and wait until it is complete or timeout.
wait_until_idle([delay_ms])Wait until the Lecroy scope is idle.
Attributes
Get the current channel of the Lecroy scope.
commandGet the identification string of the Lecroy scope.
Abstract for static class variable interchoices, to list interfaces statically.
Get the memory size of the Lecroy scope.
mqtt_enablemqtt_listGetter for the mqtt_status.
Get the offset of the current channel.
Get the trigger delay of the Lecroy scope.
Get the time division of the Lecroy scope.
Get the trace state of the current channel.
Get the trigger channel of the Lecroy scope.
Get the trigger level of the Lecroy scope.
Get the trigger mode of the Lecroy scope.
Get the trigger slope of the Lecroy scope.
Get the voltage division of the current channel.
Get the waveform data from the current channel and return the time and voltage arrays.
Get the waveform data from the current channel and return the voltage, time interval, and time offset.
- exception TriggerTimeout[source]
Bases:
Exception- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- property channel
Get the current channel of the Lecroy scope.
- close(force=False)
Close connection to instrument.
- find_names()
find_names() returns list of identifiers strings, lhs of = assignments
- Returns:
obj_names – List of identifier strings
- Return type:
list of str
- fix_lecroy_trig()[source]
Issue on LeCroy-wavesurfer, once active channel changed & used, trigger.
Channel attribute (level & slope) changes are ignored!
- get_waveform(channel=None)[source]
Get the waveform data from the specified channel and return the time and voltage arrays.
- Parameters:
channel (int or str, optional) – The channel to retrieve the waveform from. If None, uses the current channel (default is None).
- Returns:
t (np.ndarray) – The time values of the waveform.
voltage (np.ndarray) – The voltage values of the waveform.
- help()
Print the docstring of the instrument class.
- property id
Get the identification string of the Lecroy scope.
- identify(showInstName=False)
Identify message.
- init(identify=False)
Optional init for interlock startup after identification.
- abstract property interchoices
Abstract for static class variable interchoices, to list interfaces statically.
- json = <module 'json' from '/home/runner/miniconda3/envs/test/lib/python3.9/json/__init__.py'>
- property memsize
Get the memory size of the Lecroy scope.
- message(message=None)
Send a message to the Lecroy scope.
- mqtt_add(client, instrument, liste='#', qos=0)
Add the instrument to mqtt. Calling from base_instrument, after the instrument (device) has been create. Normally you have not to use this function, only base_instrument use it.
- Parameters:
client (mqtt_init) – The MQTT client instance to which the instrument should be added.
instrument (object) – The instrument to be added to the MQTT client.
liste (list or str) – A list of attributes for which MQTT messages should be sent. If set to “#”, all attributes will be included (default: “#”).
qos (int) – The Quality of Service level for MQTT messages (default: 0).
- Return type:
None
- mqtt_disconnect()
Remove the instrument from mqtt. Calling from base_instrument, if the instrument are closing. Normally you have not to use this function, only base_instrument use it.
- property mqtt_status
Getter for the mqtt_status.
- property offs
Get the offset of the current channel.
- publish(topic, value)
Publish topic as type=’cmd’ with payload=value.
- Parameters:
topic (str) – The name of the topic to publish.
value (any) – The value to be published.
- Return type:
None
- publish_get(function_name, value)
Publish function_name as type=’get’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘get’ command.
value (any) – The value to be published as the payload of the ‘get’ command.
- Return type:
None
- publish_set(function_name, value)
Publish function_name as type=’set’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘set’ command.
value (any) – The value to be published as the payload of the ‘set’ command.
- Return type:
None
- reset()
Reset the Lecroy scope.
- property tdelay
Get the trigger delay of the Lecroy scope.
- property tdiv
Get the time division of the Lecroy scope.
- property trace
Get the trace state of the current channel.
- property trig_channel
Get the trigger channel of the Lecroy scope.
- property trig_level
Get the trigger level of the Lecroy scope.
- property trig_mode
Get the trigger mode of the Lecroy scope. Trigger mode is one of {‘AUTO’, ‘NORM’, ‘SINGLE’, ‘STOP’}
- trig_oneshot(timeout=1.0)[source]
Trigger a single measurement and wait until it is complete or timeout.
- Parameters:
timeout (float) – The maximum time to wait for the measurement to complete, in seconds.
- Raises:
TriggerTimeout – If the measurement does not complete within the specified timeout.
- property trig_slope
Get the trigger slope of the Lecroy scope.
- property vdiv
Get the voltage division of the current channel.
- wait_until_idle(delay_ms=5)[source]
Wait until the Lecroy scope is idle.
- Parameters:
delay_ms (int) – The delay in milliseconds to wait between checks (default is 5 ms).
- Returns:
value – The response from the scope indicating its idle status.
- Return type:
str
- property waveform
Get the waveform data from the current channel and return the time and voltage arrays.
- Returns:
t (np.ndarray) – The time values of the waveform.
voltage (np.ndarray) – The voltage values of the waveform.
- property waveform_dt
Get the waveform data from the current channel and return the voltage, time interval, and time offset.
- Returns:
voltage (np.ndarray) – The voltage values of the waveform.
tdelta (float) – The time interval between samples.
toffs (float) – The time offset of the waveform.