sample_rate, acquisition_time, pretrigger_time, sampling_mode = mso.query_timing(
    )
    channels = mso.query_enabled_analog_channels()
    channels_enabled, number_of_channels = virtualbench.collapse_channel_string(
        channels)

    # Start the acquisition.  Auto triggering is enabled to catch a misconfigured trigger condition.
    mso.run()

    # Read the data by first querying how big the data needs to be, allocating the memory, and finally performing the read.
    analog_data, analog_data_stride, analog_t0, digital_data, digital_timestamps, digital_t0, trigger_timestamp, trigger_reason = mso.read_analog_digital_u64(
    )

    # Finally, print some information about the data.
    print("Trigger Reason: %s" % trigger_reason)
    trigger_timestamp_seconds_since_1970, trigger_timestamp_fractional_seconds = virtualbench.convert_timestamp_to_values(
        trigger_timestamp)
    print("Trigger Timestamp: %s UTC\n\t%f fractional seconds" %
          (datetime.utcfromtimestamp(trigger_timestamp_seconds_since_1970),
           trigger_timestamp_fractional_seconds))

    if (len(analog_data) != 0):
        print("Analog t0 is %f seconds before trigger" %
              get_timestamp_difference(trigger_timestamp, analog_t0))

    if (len(digital_data) != 0):
        print("Digital t0 is %f seconds before trigger" %
              get_timestamp_difference(trigger_timestamp, digital_t0))

    print_analog_data(analog_data, analog_data_stride, number_of_channels,
                      sampling_mode, 10)
    print_digital_data(digital_data, digital_timestamps, 10)
from pyvirtualbench import PyVirtualBench, PyVirtualBenchException, DmmFunction
from datetime import datetime

# This examples demonstrates how to query calibration information from a
# VirtualBench device.

try:
    # You will probably need to replace "myVirtualBench" with the name of your device.
    # By default, the device name is the model number and serial number separated by a hyphen; e.g., "VB8012-309738A".
    # You can see the device's name in the VirtualBench Application under File->About
    virtualbench = PyVirtualBench('myVirtualBench')

    # Read and display calibration information.
    calibration_date, recommended_calibration_interval, calibration_interval = virtualbench.get_calibration_information()
    seconds_since_1970, fractional_seconds = virtualbench.convert_timestamp_to_values(calibration_date)
    print("Device was last calibrated: %s UTC" % datetime.utcfromtimestamp(seconds_since_1970))
    print("Recommended calibration interval: %d months, calibration interval: %d months" % (recommended_calibration_interval, calibration_interval));

    adjustment_date, adjustment_temperature = virtualbench.get_mixed_signal_oscilloscope_calibration_adjustment_information();
    seconds_since_1970, fractional_seconds = virtualbench.convert_timestamp_to_values(adjustment_date)
    print("MSO was last adjusted: %s UTC" % datetime.utcfromtimestamp(seconds_since_1970))
    print("Temperature was: %f" % adjustment_temperature);

    adjustment_date, adjustment_temperature = virtualbench.get_function_generator_calibration_adjustment_information()
    seconds_since_1970, fractional_seconds = virtualbench.convert_timestamp_to_values(adjustment_date)
    print("FGEN was last adjusted: %s UTC" % datetime.utcfromtimestamp(seconds_since_1970))
    print("Temperature was: %f" % adjustment_temperature);

    adjustment_date, adjustment_temperature = virtualbench.get_digital_multimeter_calibration_adjustment_information()
    seconds_since_1970, fractional_seconds = virtualbench.convert_timestamp_to_values(adjustment_date)
Ejemplo n.º 3
0
from pyvirtualbench import PyVirtualBench, PyVirtualBenchException, DmmFunction
from datetime import datetime

# This examples demonstrates how to query calibration information from a
# VirtualBench device.

try:
    # You will probably need to replace "myVirtualBench" with the name of your device.
    # By default, the device name is the model number and serial number separated by a hyphen; e.g., "VB8012-309738A".
    # You can see the device's name in the VirtualBench Application under File->About
    virtualbench = PyVirtualBench('myVirtualBench')

    # Read and display calibration information.
    calibration_date, recommended_calibration_interval, calibration_interval = virtualbench.get_calibration_information(
    )
    seconds_since_1970, fractional_seconds = virtualbench.convert_timestamp_to_values(
        calibration_date)
    print("Device was last calibrated: %s UTC" %
          datetime.utcfromtimestamp(seconds_since_1970))
    print(
        "Recommended calibration interval: %d months, calibration interval: %d months"
        % (recommended_calibration_interval, calibration_interval))

    adjustment_date, adjustment_temperature = virtualbench.get_mixed_signal_oscilloscope_calibration_adjustment_information(
    )
    seconds_since_1970, fractional_seconds = virtualbench.convert_timestamp_to_values(
        adjustment_date)
    print("MSO was last adjusted: %s UTC" %
          datetime.utcfromtimestamp(seconds_since_1970))
    print("Temperature was: %f" % adjustment_temperature)

    adjustment_date, adjustment_temperature = virtualbench.get_function_generator_calibration_adjustment_information(