Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Ho-Ro/Hantek6022API
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
  • Loading branch information
Ho-Ro committed Feb 20, 2024
2 parents d1ad1a0 + cde80ef commit c8cee4c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
@@ -1,4 +1,8 @@
2024-02-20: Merge branch 'main' of github.com:Ho-Ro/Hantek6022API [bf181c0]
2024-02-20: add warning to dangerous example program reset_eeprom_6022.py [d1ad1a0]
2023-11-05: Merge pull request #22 from BMecke/main [cde80ef]
2023-10-26: doc update; fix debug tool [ff6c527]
2023-09-20: Numpy functions are now used in functions "scale_read_data" and "convert_sampling_rate_to_measurement_times" to improve performance. [cebf107]
2023-07-27: Update version; update github runner (ubuntu-20.04 -> ubuntu-22.04) [c692226]
2023-07-27: Merge pull request #21 from f1rmb/fix_python_version_usage [8021a1a]
2023-07-27: Make it work when 'python' is not available, but python3 is (like Ubuntu/Mint). [a36eade]
Expand Down
17 changes: 11 additions & 6 deletions PyHT6022/LibUsbScope.py
@@ -1,13 +1,15 @@
__author__ = 'Robert Cope', 'Jochen Hoenicke'

import array
import libusb1
import os
import sys
import threading
import time
import usb1
import array
import select
import libusb1
import threading

import numpy as np

from struct import pack

from PyHT6022.Firmware import dso6021_firmware,dso6022be_firmware, dso6022bl_firmware, fx2_ihex_to_control_packets
Expand Down Expand Up @@ -746,7 +748,8 @@ def scale_read_data( self, read_data, voltage_range=1, channel=1, probe=1, offse
off = offset + self.offset2[ voltage_range ]

scale_factor = ( 5.12 * mul ) / ( voltage_range << 7 )
return [ ( datum - 128 - off ) * scale_factor for datum in read_data ]
data = (np.array(read_data, dtype=float) - 128 - off) * scale_factor
return data.tolist()


def voltage_to_adc( self, voltage, voltage_range=1, channel=1, probe=1, offset=0 ):
Expand Down Expand Up @@ -841,7 +844,9 @@ def convert_sampling_rate_to_measurement_times(self, num_points, rate_index):
:return: A list of times in seconds from beginning of data collection, and the nice human readable rate label.
"""
rate_label, rate = self.SAMPLE_RATES.get(rate_index, ("? MS/s", 1.0))
return [i/rate for i in range(num_points)], rate_label
timing_data = np.arange(0, num_points)
timing_data = (timing_data / rate).tolist()
return timing_data, rate_label


def set_num_channels(self, nchannels, timeout=0):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -39,7 +39,7 @@
version=__version__,
license='GPLv2',
# the required python packages
install_requires=['libusb1', 'matplotlib'],
install_requires=['libusb1', 'matplotlib', 'numpy'],
url='https://github.com/Ho-Ro/Hantek6022API',
packages=[ 'PyHT6022', 'PyHT6022.Firmware' ],
package_data={
Expand Down

0 comments on commit c8cee4c

Please sign in to comment.