Oscilloscopes#

Keysight#

This module contains the instrument classes for keysight oscilloscopes. It uses the methods created in the base class for the data parsing and saving, but the communication is handled by the methods defined here.

Pieces salvaged from InfiniiVision_SegmentedMemory_Waveform.py

class techconnect.oscilloscopes.keysight.Keysight3000T[source]#

Class representing the Keysight 3000T series oscilloscope.

Attributes:
query_delayfloat

The delay between query and read in seconds.

Methods

__init__()

Initializes the Keysight3000T object.

segmented_initialization(channel)

Perform segmented initialization for a specific channel.

calculate_segment_number(acquistion_time)

Calculate the number of segments based on the acquisition time.

setup_time_window(time_window)

Set up the time window for each segment.

setup_triggering()

Set up the triggering mode for the oscilloscope.

segmented_acquistion_setup(segment_count, acquistion_type=’NORMAL’, sample_rate=’AUTO’)

Set up the segmented acquisition mode.

manual_channel_setup(channel, vertical_scale, vertical_range, vertical_offset, bw_limit, coupling)

Perform manual setup for a specific channel.

auto_scale()

Perform automatic scale of the oscilloscope.

single_acquisition()

Perform a single acquisition.

digitize_acquisition(channels)

Digitize the acquisition for the specified channels.

retrieve_channel_info(channel)

Retrieve information about a specific channel.

data_export_setup(channel)

Set up data export for a specific channel.

get_number_of_points(channel)

Get the number of points for a specific channel.

generate_x_data(channel_info)

Generate the x-axis data based on the channel information.

stitch_multiseg_x_data(x_data, time_tags)

Stitch together the x-axis data for multi-segment acquisition.

scale_y_data(y_data, channel_info)

Scale the y-axis data based on the channel information.

collect_single_segment_data(segment_index, channel, channel_info)

Collect data for a single segment and channel.

collect_multi_segment_data(number_of_segments, channel, stitched)

Collect data for multiple segments and a specific channel.

parse_and_save(save_directory, save_dict, acquisition_info)

Parse and save the acquired data.

stitched_data_acquisition(acquisition_time, channels, segment_number=1000, save_directory=None, acquisition_type=’HRESOLUTION’)

Perform stitched data acquisition.

unstitched_data_acquisition(time_window, segment_number, channels, save_directory=None, acquisition_type=’HRESOLUTION’)

Perform unstitched data acquisition.

acquire_single_data(channels, acq_type='HRESOLUTION', acq_time_delay=1, force_trigger=True, auto_scale=True, save_directory=None, add_to_md=None)#

Performs a single acquisition.

auto_scale()[source]#

Automatically sets up the instrument by sending the SCPI command “:AUTOSCALE”.

calculate_segment_number(acquisition_time)[source]#

Calculate the segment number based on the acquisition time.

Parameters:
acquisition_timefloat

The acquisition time in seconds.

Returns:
segment_numberint

The calculated segment number.

check_errors()#

Check for errors by querying the SCPI and handling the returned error.

close_device()#

Closes the device.

This function clears the instrument and then closes the connection to the device.

collect_multi_segment_data(number_of_segments, channel, stitched: bool)#

Collects multi-segment data for a given number of segments, channel, and stitched flag.

Parameters:
number_of_segmentsint

The number of segments to collect data from.

channelstr

The channel to collect data from.

stitchedbool

Flag indicating whether the data should be stitched.

Returns:
tuple

A tuple containing the following: x_data : ndarray

The x-axis data.

y_datandarray

The y-axis data.

time_tagsndarray

The time tags.

channel_infostr

The channel information.

collect_single_segment_data(segment_index, channel, channel_info)[source]#

Collects data for a single segment in the waveform.

Parameters:
segment_indexint

The index of the segment to collect data from.

channelstr

The channel to collect data from.

channel_infodict

A dictionary containing information about the channel.

Returns:
tuple

A tuple containing the segment time tag (float) and the collected data (ndarray).

connect(address)#

Connects to an instrument at the specified address.

data_export_setup(channel)[source]#

Set up the data export for a specific channel.

Parameters:
channelint

The channel number.

Returns:
None

This function does not return anything.

digitize_acquisition(channels)[source]#

Digitize the acquisition for the given channels.

Parameters:
channelslist of int

A list of channel numbers to digitize.

Returns:
None

This function does not return anything.

generate_x_data(channel_info)#

Generate the x data based on the channel information.

get_number_of_points(channel)[source]#

Get the number of points in a waveform for a given channel.

Parameters:
channelstr

The channel number.

Returns:
int

The number of points in the waveform.

initialise_device()#

Initializes the device.

This function is responsible for initializing the device. It clears any existing data on the instrument.

list_connections(verbose=True)#

List connections and print the resource information if verbose is True. Otherwise, print only the resource names.

manual_channel_setup(channel: int, vertical_scale, vertical_range, vertical_offset, bw_limit, coupling)[source]#

Sets up the manual configuration for a specific channel.

Parameters:
channelint

The channel number.

vertical_scale

The vertical scale.

vertical_range

The vertical range.

vertical_offset

The vertical offset.

bw_limit

The bandwidth limit.

coupling

The coupling type.

Returns:
None

This function does not return anything.

parse_and_save(save_directory, save_dict, acquisition_info=None, add_to_md=None)#

Parses the data and saves it to a specified directory.

Parameters:
save_directorystr

A string representing the directory where the data will be saved.

save_dictdict

A dictionary containing the data to be saved.

acquisition_infodict, optional

An optional dictionary containing acquisition information.

add_to_mddict, optional

An optional dictionary containing additional metadata.

Returns:
None
query_SCPI(query: str)#

Execute a SCPI query command and return the response.

scale_y_data(y_data, channel_info)#

Scales the given y data based on the channel information.

Parameters:
y_dataarray-like

The y data to be scaled.

channel_infodict

A dictionary containing channel information, including ‘yreference’, ‘yincrement’, and ‘yorigin’.

Returns:
array-like

The scaled y data.

segmented_acquistion_setup(segment_count: int, acquistion_type='NORMAL', sample_rate='AUTO')[source]#

Set up the segmented acquisition mode for the oscilloscope.

Parameters:
segment_countint

The number of segments to acquire.

acquistion_typestr, optional

The type of acquisition. Defaults to ‘NORMAL’.

sample_ratestr, optional

The sample rate. Defaults to ‘AUTO’.

Returns:
None
segmented_initialization(channel)[source]#

Initializes the given channel by turning on the display, enabling automatic sample rate selection, and enabling automatic points selection.

Parameters:
channelint

The channel number to be initialized.

Returns:
None
setup_time_window(time_window)[source]#

Sets up the time window for the instrument.

Parameters:
time_windowfloat

The time window value to be set.

Returns:
None

This function does not return anything.

setup_triggering()[source]#

Sets up triggering for the device. It will be edge triggered externally, and on a positive slope

single_acquisition()[source]#

Sends a command to the SCPI instrument to perform a single acquisition.

stitch_multiseg_x_data(x_data, time_tags)#

Concatenates the given x_data with each element in time_tags, constructing a stitched single array for the x data.

stitched_data_acquisition(acquisition_time, channels, segment_number=1000, save_directory=None, acquisition_type='HRESOLUTION', add_to_md=None)#

Perform stitched data acquisition.

Parameters:
acquisition_timefloat

The total acquisition time in seconds.

channelslist

A list of channels to acquire.

segment_numberint, optional

The number of segments to divide the acquisition into. Defaults to 1000.

save_directorystr, optional

The directory to save the acquired data. None will not save, otherwise will create and save to given directory. Defaults to None.

acquisition_typestr, optional

The acquisition type. Defaults to ‘HRESOLUTION’.

add_to_mddict, optional

An optional dictionary containing additional metadata.

Returns:
tuple

A tuple containing the acquired x data, y data, time tags, and channel info.

unstitched_data_acquisition(time_window, segment_number, channels, save_directory=None, acquisition_type='HRESOLUTION', add_to_md=None)#

Perform unstitched data acquisition for a given time window, segment number, and channels.

Parameters:
time_windowfloat

The time window for each segment in seconds.

segment_numberint

The number of segments to acquire.

channelslist

A list of channels to acquire data from.

save_directorystr, optional

The directory to save the acquired data. Default is None.

acquisition_typestr, optional

The type of acquisition. Default is ‘HRESOLUTION’.

add_to_mddict, optional

An optional dictionary containing additional metadata.

Returns:
tuple

A tuple containing the acquired x_data, y_data, time_tags, and channel_info.

write_SCPI(command: str)#

Writes an SCPI command to the instrument.

write_lines(lines)#

Writes a list of lines to the device.