qmi.instruments.yokogawa.dlm4038
Instrument driver for the Yokogawa DLM4038 Oscilloscope. The instrument can be connected over ethernet and usb.
If the instrument is connected over ethernet, use the vxi11 protocol by passing the transport description “vxi11:ip-address”. If the mass storage function (over USB) is used, the scope directory needs to be specific (default is “O:/”).
Connecting to the instrument through USB is also possible but could not be tested. The testing was done on a Windows 11 PC but the installation of the device driver to recognize the instrument correctly through USB was not successful. In principle, the transport descriptor is likely to be either “usbtmc:vendorid=0x0b21:productid=0x0038:serialnr=<serialnr>”, or with a GPIB adapter “gbip:<address>”.
Classes
|
Waveform data formats supported by the instrument. |
|
Instrument driver for the Yokogawa DLM4038 Oscilloscope. |
- class qmi.instruments.yokogawa.dlm4038.WaveformDataFormat(value)
Waveform data formats supported by the instrument.
- encode(encoding='utf-8', errors='strict')
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- replace(old, new, count=-1, /)
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- split(sep=None, maxsplit=-1)
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- rsplit(sep=None, maxsplit=-1)
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- join(iterable, /)
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- capitalize()
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()
Return a version of the string suitable for caseless comparisons.
- title()
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- center(width, fillchar=' ', /)
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- expandtabs(tabsize=8)
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- partition(sep, /)
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- index(sub[, start[, end]]) int
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- ljust(width, fillchar=' ', /)
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- rfind(sub[, start[, end]]) int
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rstrip(chars=None, /)
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- rpartition(sep, /)
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- splitlines(keepends=False)
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- strip(chars=None, /)
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- translate(table, /)
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()
Return a copy of the string converted to uppercase.
- startswith(prefix[, start[, end]]) bool
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- endswith(suffix[, start[, end]]) bool
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- removeprefix(prefix, /)
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- isascii()
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- islower()
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isupper()
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- istitle()
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isspace()
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- isdecimal()
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isnumeric()
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isalpha()
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isalnum()
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isidentifier()
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- isprintable()
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in repr() or if it is empty.
- zfill(width, /)
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- format(*args, **kwargs) str
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- static maketrans()
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- class qmi.instruments.yokogawa.dlm4038.Yokogawa_DLM4038(context: QMI_Context, name: str, transport: str, directory: str | None = 'O:/', timeout: float = 1.0)
Instrument driver for the Yokogawa DLM4038 Oscilloscope.
- Parameters:
CHANNELS – The number of signal channels in the device.
- open() None
Connect to the instrument hardware.
When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.
Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call
super().open()as a last statement.
- close() None
Close the connection to the instrument hardware and release associated resources.
When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.
Subclasses can extend this method if they have specific resources to close. If they do, they should call
super().close()as a last statement.
- get_idn() QMI_InstrumentIdentification
Read instrument type and version and return QMI_InstrumentIdentification instance.
- start() None
Start waveform acquisition.
- stop() None
Stop waveform acquisition.
- set_time_division(time_division: float) None
Set the Time/div value.
- Parameters:
time_division – The new Time/div value in seconds.
- get_time_division() float
Get the Time/div value.
- Returns:
The current Time/div value in seconds.
- Return type:
time_division
- set_high_resolution(state: bool) None
Set the High Resolution mode on or off.
- Parameters:
state – True to set High Resolution mode on, False to set it off.
- turn_channel_on(channels: int | list[int] | str) None
Turns on the display of specified channel or channels.
- Parameters:
channels – A single channel number or a list of selected channels. Use “all” for all channels.
- turn_channel_off(channels: int | list[int] | str) None
Turns off the display of specified channel or channels.
- Parameters:
channels – A single channel number or a list of selected channels. Use “all” for all channels.
- set_voltage_offset(channels: int | list[int] | str, v_offset: float | list[float]) None
Sets the voltage offset for the specified channels. Voltage offset is specified in volts.
- Parameters:
channels – A single channel number or a list of selected channels. Use “all” for all channels.
v_offset – A single voltage or a list of voltages. Can be given as one value which is then applied to all ‘channels’. Otherwise, length must match with ‘channels’.
- Raises:
QMI_UsageException – If the given input channels and v_offset parameters do not match.
- get_voltage_offset(channels: int | list[int] | str) ndarray
Returns the current voltage offset for the specified channels.
- Parameters:
channels – A single channel number or a list of selected channels. Use “all” for all channels.
- Returns:
An array of offset values, respective to the size of given input channels.
- Return type:
v_offset
- set_voltage_division(channels: int | list[int] | str, v_division: float | list[float]) None
Set the voltage division for the specified channels. Voltage division is specified in Volts.
- Parameters:
channels – A single channel number or a list of selected channels. Use “all” for all channels.
v_division – A single voltage or a list of voltages. Can be given as one value which is then applied to all ‘channels’. Otherwise, length must match with ‘channels’.
- Raises:
QMI_UsageException – If the given input channels and v_division parameters do not match.
- get_voltage_division(channels: int | list[int] | str) ndarray
Returns the current voltage per division for the specified channels.
- Parameters:
channels – A single channel number or a list of selected channels. Use “all” for all channels.
- Returns:
An array of division values, respective to the size of given input channels.
- Return type:
v_division
- get_max_waveform(channels: int | list[int] | str) ndarray
Returns the current waveform maximum for the specified channels.
WARNING: Undocumented feature.
- Parameters:
channels – A single channel number or a list of selected channels. Use “all” for all channels.
- Returns:
An array of waveform maximum voltage values, respective to the size of given input channels.
- Return type:
v_max
- set_channel_position(channels: int | list[int] | str, position: float | list[float]) None
Changes the position of the specified channels in volts.
- get_channel_position(channels: int | list[int] | str) ndarray
Returns the current position for the specified channels in volts.
- set_trigger_channel(channel: int) None
Sets the channel used to set the trigger.
- Parameters:
channel – The trigger channel number.
- set_trigger_level(voltage: float) None
Sets the level (in volts) of the trigger.
- Parameters:
voltage – The trigger voltage level.
- set_average(average: int) None
Sets the mode to average and set the average count.
- Parameters:
average – Has to be between 2 and 1024 in 2**n steps.
- set_normal() None
Sets acquisition mode to normal.
- set_number_data_points(length: int) None
Sets the scope acquire length.
- Parameters:
length – The acquire length value.
- get_number_data_points() int
Gets the number of data points that will be saved.
- set_data_format(data_format: str | WaveformDataFormat) None
Set the waveform data format to specific type.
- Parameters:
data_format – In which format to send the data in. Possible options: ‘ASCii’, ‘BYTE’, RBYTE’, ‘WORD’.
- get_data_format() WaveformDataFormat
Get the current waveform data format.
- Returns:
- In which format to send the data in. Possible options:
’ASCii’, ‘BYTE’, RBYTE’, ‘WORD’.
- Return type:
data_format
- set_waveform_trace_channel(channel: int) None
Set the waveform (channel) number to obtain the waveform trace data from.
- Parameters:
channel – Waveform (channel) number.
- get_waveform_trace_data(data_format: str | WaveformDataFormat) ndarray
Get waveform (channel) trace data from single waveform.
In ASCII format the data is in a comma-separated list of float voltage values.
In any other format, the data is as block data. Block data is signed 8-bit data in ‘BYTE’ and ‘RBYTe’ data formats. ‘RBYTe’ has also reverse order of data points. In ‘WORD’ format the data block contains signed 16-bit data in little-endian order. The block data syntax is as follows: “#N<N-digit decimal number><data byte sequence>”
The block data needs to be converted into Volts. The respective conversion formula depends on the data format. See the DLM4000 series user’s manual for details.
NOTE: This implementation does not include the use of the <NRf> parameter.
- Parameters:
data_format – One of the eligible formats - “ascii”, “byte”, “rbyte”, “word”.
- Returns:
The trace data formatted according to the given data format.
- Return type:
trace_data
- get_waveforms_trace_data(channels: list[int], data_format: str | WaveformDataFormat = WaveformDataFormat.ASCII) ndarray
Returns the on-screen traces from specified waveforms (channels) in the form of a 2D numpy array. Data is streamed via ethernet in the given format.
- Parameters:
channels – A list of the waveform numbers (waveform channels) to return data from.
data_format – Which format to send the data in. Possible formats are: ‘ascii’ | ‘byte’ | ‘rbyte’ | ‘word’. Default is ‘ascii’.
- Returns:
- An array where each row is a channel trace.
Channel order corresponds to ‘channels’ input parameter.
- Return type:
traces
- save_file(name: str, data_type: str = 'binary', waiting_time: float = 12.0) None
Saves in the internal memory the file with a name “nameXXX.csv”. Here, XXX labels the files that have the same name with numbers from 000 up to 999.
- Parameters:
name – The preposition of the file name.
data_type – Specify data type: ‘binary’ for raw data and ‘ascii’ for csv data.
waiting_time – Time to wait for saving the file. In seconds.
- find_file_name(name: str, select_files: str = 'last') list[str]
Finds the files in the oscilloscope with names ‘nameXXX.csv’. It can be chosen whether to return the last file created with that name (higher XXX) with select_files = ‘last’ or to return all of them with select_files = ‘all’.
The full name including the label numbers can be specified to find a specific file.
- Parameters:
name – Preposition of file names to find.
select_files – Optional parameter to select only the “last” file (default) or “all” the files.
- copy_file(name: str, destination: str, select_files: str = 'last') None
Copies the files in the oscilloscope with names ‘nameXXX.csv’ to the destination. It can be chosen whether to copy the last file created with that name (higher XXX) with select_files = ‘last’ or to copy all of them with select_files = ‘all’ The full name including the label numbers can be specified to copy a specific file.
- Parameters:
name – Preposition of file names to find.
destination – Target directory to copy the file or files to.
select_files – Optional parameter to select only the “last” file (default) or “all” the files.
- delete_file(name: str, select_files: str = 'last', data_type: str = 'binary') None
Deletes files in the oscilloscope with names ‘nameXXX.csv’. It can be chosen whether to delete the last file created with that name (higher XXX) with select_files = ‘last’ or to delete all of them with select_files = ‘all’.
- Parameters:
name – Preposition of file names to find.
select_files – Optional parameter to select only the “last” file (default) or “all” the files.
data_type – Specify with type: ‘binary’ for raw data and ‘ascii’ for csv data file.
- force_unlock() None
Forcefully unlock the remote object.
This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.
Use this with care.
Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.
- classmethod get_category() str | None
Return the optional name of the category this object belongs to.
A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.
- get_name() str
Return the name of this object.
- Returns:
name attribute.
- get_signals() list[SignalDescription]
Return a list of signals that can be published by this object.
- Returns:
List consisting of qmi_signals attributes.
- is_locked() bool
Query if the remote object is locked.
Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.
- is_open() bool
Return True if the instrument is open (ready for interaction).
- lock(timeout: float = 0.0, lock_token: str | None = None) bool
Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.
If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.
Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.
- release_rpc_object() None
Give a warning if the instrument is removed while still open.
- unlock(lock_token: str | None = None) bool
Unlock the remote object.
Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.
Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.