Package: pydho800
Rigol DHOxxx oscilloscope Python library (unofficial)Based completely onhttps://github.com/tspspi/pymso5000/tree/masterby tspspiA simple Python library and utility to control and query data from
Rigol DHOxxx oscilloscopes. This library implements theOscilloscopeclass from
thepylabdevspackage which
exposes the public interface.When retrieving sample point data from the scope, the number of points retrieved is set by the scope's memory depth.The default memory depth of the scope is set to 10k points.
This can be changed through the set_memory_depth() functionAlternatively this can be changed by accessing the following menus on the scope:Click on any channel and click "Acquisition":Change the memory depth:InstallingThere is a PyPi package that can be installed usingpip install pydho800Simple example to fetch waveforms:frompydho800.pydho800importPYDHO800withDHO800(address="10.0.0.123")asdho:print(f"Identify:{dho.identify()}")dho.set_channel_enable(0,True)dho.set_channel_enable(1,True)dho.set_channel_scale(0,.1)# 100 mV/divdho.set_timebase_scale(100e-6)# 100 us/div# Set memory depth to 10 million samplestx_depth=dho.memory_depth_t.M_10Mdho.set_memory_depth(tx_depth)# DHO914S/DHO924S specific for the signal generatorsignal_gen_waveform=dho.signal_gen_waveform_t.SINEdho.set_signal_gen_waveform(signal_gen_waveform)dho.set_signal_gen_amp(3.5)# 3.5 Vppdho.set_signal_gen_freq(1*10**6)# 1 MHz# Back to the oscilloscopedho.set_run_mode(OscilloscopeRunMode.RUN)dho.set_run_mode(OscilloscopeRunMode.STOP)data=dho.query_waveform((0,1))print(data)importmatplotlib.pyplotaspltplt.plot(data['x'],data['y0'],label="Ch1")plt.plot(data['x'],data['y1'],label="Ch2")# Note if only one channel were enabled, it would be accessed by:# plt.plot(data['x'], data['y'], label = "Ch1")plt.show()Note thatnumpyusage is optional for this implementation.
One can enable numpy support usinguseNumpy = Truein the
constructor.Querying additional statisticsThis module allows - via thepylabdevsbase class to query
additional statistics:meanCalculates the mean values and standard deviationsA single value for each channels mean at["means"]["yN_avg"]and a single value for each standard deviation at["means"]["yN_std"]whereNis the channel numberfftruns Fourier transform on all queried tracesThe result is stored in["fft"]["yN"](complex values) and
in["fft"]["yN_real"]for the real valued Fourier transform.
AgainNis the channel numberifftruns inverse Fourier transform on all queried tracesWorks asfftbut runs the inverse Fourier transform and stores
its result inifftinstead offftcorrelatecalculates the correlation between all queried
waveform pairs.The result of the correlations are stored in["correlation"]["yNyM"]for the correlation between channelsMandNautocorrelateperforms calculation of the autocorrelation of each
queried channel.The result of the autocorrelation is stored in["autocorrelation"]["yN"]for channelNTo request calculation of statistics pass the string for the
desired statistic or a list of statistics to thestatsparameter ofquery_waveform:withDHO800(address="10.0.0.123")asdho:data=dho.query_waveform((1,2),stats=['mean','fft'])Get Measurement DataThe DHO800/900 has in-built measurement functions.
This package release supports the 10 most common used functions:VPP: indicates the voltage value from the highest point to the lowest point of the waveform.RRPH: indicates the phase deviation between the threshold middle values of the rising edge of Source A and that of Source B.FFPH: indicates the phase deviation between the threshold middle values of the falling edge of Source A and that of Source B.VMIN: indicates the voltage value from the lowest point of the waveform to the GND.VMAX: indicates the voltage value from the highest point of the waveform to the GND.VRMS: indicates the root mean square value on the whole waveform or in the gating area.VAVG: indicates the root-mean-square value of the waveforms, with the DC component removed.OVER: indicates the ratio of the difference between the maximum value and the top value of the waveform to the amplitude value.FREQ: defined as the reciprocal of period.PER: defined as the time between the middle threshold points of two consecutive, like-polarity edges.For more detailed information about:MEASure CommandsseeDHO Progamming Guide (Jul 2023)section 3.17withDHO800(address="10.0.0.123")asdho:# gets voltage peak to peakvolt=float(dho.get_channel_measurement(type='VPP',channel=0))# gets phase from rising edge refchannel to rising edge channelphase_riserise=float(dho.get_channel_measurement(type='RRPH',channel=1,refchannel=0))Supported methodsMore documentation in progress ...identify()Connection management (when not usingwithcontext management):connect()disconnect()set_channel_enable(channel, enabled)is_channel_enabled(channel)set_sweep_mode(mode)get_sweep_mode()set_trigger_mode(mode)get_trigger_mode()force_trigger()set_timebase_mode(mode)get_timebase_mode()set_run_mode(mode)get_run_mode()set_timebase_scale(secondsPerDivision)get_timebase_scale()set_channel_coupling(channel, couplingMode)get_channel_coupling(channel)set_channel_probe_ratio(channel, ratio)get_channel_probe_ratio(channel)set_channel_scale(channel, scale)get_channel_scale(channel)set_channel_bandwidth(channel, scale)get_channel_bandwidth(channel)get_channel_measurement(type, channel[, refchannel])query_waveform(channel, stats = None)off()