Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Inspired by Patrick Carle's code at
http://www.picotech.com/support/topic11239.html
which was adapted from
http://www.picotech.com/support/topic4926.html
"""
class PS2000(_PicoscopeBase):
"""The following are low-level functions for the PS2000."""
LIBNAME = "ps2000"
NUM_CHANNELS = 2
CHANNELS = {"A": 0, "B": 1, "MaxChannels": 2}
THRESHOLD_TYPE = {"Rising": 0,
"Falling": 1}
CHANNEL_RANGE = [
{"rangeV": 20E-3, "apivalue": 1, "rangeStr": "20 mV"},
{"rangeV": 50E-3, "apivalue": 2, "rangeStr": "50 mV"},
{"rangeV": 100E-3, "apivalue": 3, "rangeStr": "100 mV"},
{"rangeV": 200E-3, "apivalue": 4, "rangeStr": "200 mV"},
{"rangeV": 500E-3, "apivalue": 5, "rangeStr": "500 mV"},
# to load the proper dll
import platform
# Do not import or use ill definied data types
# such as short int or long
# use the values specified in the h file
# float is always defined as 32 bits
# double is defined as 64 bits
from ctypes import byref, POINTER, create_string_buffer, c_float, \
c_int8, c_int16, c_int32, c_uint32, c_uint64, c_void_p
from ctypes import c_int32 as c_enum
from picoscope.picobase import _PicoscopeBase
class PS6000(_PicoscopeBase):
"""The following are low-level functions for the PS6000."""
LIBNAME = "ps6000"
MAX_VALUE = 32764
MIN_VALUE = -32764
# EXT/AUX seems to have an imput impedence of 50 ohm (PS6403B)
EXT_MAX_VALUE = 32767
EXT_MIN_VALUE = -32767
EXT_RANGE_VOLTS = 1
# I don't think that the 50V range is allowed, but I left it there anyway
# The 10V and 20V ranges are only allowed in high impedence modes
CHANNEL_RANGE = [{"rangeV": 20E-3, "apivalue": 1, "rangeStr": "20 mV"},
{"rangeV": 50E-3, "apivalue": 2, "rangeStr": "50 mV"},
# Do not import or use ill definied data types
# such as short int or long
# use the values specified in the h file
# float is always defined as 32 bits
# double is defined as 64 bits
from ctypes import byref, POINTER, create_string_buffer, c_float, \
c_int16, c_uint16, c_int32, c_uint32, c_uint64, c_void_p, c_int8
from ctypes import c_int32 as c_enum
import warnings
from picoscope.picobase import _PicoscopeBase
class PS4000a(_PicoscopeBase):
"""The following are low-level functions for the PS4000A."""
LIBNAME = "ps4000a"
MAX_VALUE = 32764
MIN_VALUE = -32764
# EXT/AUX seems to have an input impedance of 50 ohm (PS6403B)
EXT_MAX_VALUE = 32767
EXT_MIN_VALUE = -32767
EXT_RANGE_VOLTS = 1
# I don't think that the 50V range is allowed, but I left it there anyway
# The 10V and 20V ranges are only allowed in high impedence modes
CHANNEL_RANGE = [{"rangeV": 20E-3, "apivalue": 1, "rangeStr": "20 mV"},
{"rangeV": 50E-3, "apivalue": 2, "rangeStr": "50 mV"},
# to load the proper dll
import platform
# Do not import or use ill definied data types
# such as short int or long
# use the values specified in the h file
# float is always defined as 32 bits
# double is defined as 64 bits
from ctypes import byref, POINTER, create_string_buffer, c_float, \
c_int16, c_uint16, c_int32, c_uint32, c_uint64, c_void_p
from ctypes import c_int32 as c_enum
from picoscope.picobase import _PicoscopeBase
class PS4000(_PicoscopeBase):
"""The following are low-level functions for the PS4000."""
LIBNAME = "ps4000"
MAX_VALUE = 32764
MIN_VALUE = -32764
# AWG stuff here:
AWGMaxSamples = 4096
AWGDACInterval = 1 / 192000 # [s]
AWGDACFrequency = 192000 # [Hz]
AWGPhaseAccumulatorSize = 32
AWGMaxVal = 32767
AWGMinVal = -32768
# to load the proper dll
import platform
# Do not import or use ill definied data types
# such as short int or long
# use the values specified in the h file
# float is always defined as 32 bits
# double is defined as 64 bits
from ctypes import byref, POINTER, create_string_buffer, c_float, \
c_int16, c_int32, c_uint16, c_uint32, c_void_p
from ctypes import c_int32 as c_enum
from picoscope.picobase import _PicoscopeBase
class PS3000a(_PicoscopeBase):
"""The following are low-level functions for the PS3000a."""
LIBNAME = "ps3000a"
NUM_CHANNELS = 4
CHANNELS = {"A": 0, "B": 1, "C": 2, "D": 3,
"External": 4, "MaxChannels": 4, "TriggerAux": 5}
ADC_RESOLUTIONS = {"8": 0, "12": 1, "14": 2, "15": 3, "16": 4}
CHANNEL_RANGE = [{"rangeV": 10E-3, "apivalue": 0, "rangeStr": "10 mV"},
{"rangeV": 20E-3, "apivalue": 1, "rangeStr": "20 mV"},
{"rangeV": 50E-3, "apivalue": 2, "rangeStr": "50 mV"},
{"rangeV": 100E-3, "apivalue": 3, "rangeStr": "100 mV"},
{"rangeV": 200E-3, "apivalue": 4, "rangeStr": "200 mV"},
{"rangeV": 500E-3, "apivalue": 5, "rangeStr": "500 mV"},
# to load the proper dll
import platform
# Do not import or use ill definied data types
# such as short int or long
# use the values specified in the h file
# float is always defined as 32 bits
# double is defined as 64 bits
from ctypes import byref, POINTER, create_string_buffer, c_float, \
c_int16, c_int32, c_uint16, c_uint32, c_void_p
from ctypes import c_int32 as c_enum
from picoscope.picobase import _PicoscopeBase
class PS2000a(_PicoscopeBase):
"""The following are low-level functions for the PS2000a."""
LIBNAME = "ps2000a"
NUM_CHANNELS = 4
CHANNELS = {"A": 0, "B": 1, "C": 2, "D": 3,
"External": 4, "MaxChannels": 4, "TriggerAux": 5}
ADC_RESOLUTIONS = {"8": 0, "12": 1, "14": 2, "15": 3, "16": 4}
CHANNEL_RANGE = [{"rangeV": 10E-3, "apivalue": 0, "rangeStr": "10 mV"},
{"rangeV": 20E-3, "apivalue": 1, "rangeStr": "20 mV"},
{"rangeV": 50E-3, "apivalue": 2, "rangeStr": "50 mV"},
{"rangeV": 100E-3, "apivalue": 3, "rangeStr": "100 mV"},
{"rangeV": 200E-3, "apivalue": 4, "rangeStr": "200 mV"},
{"rangeV": 500E-3, "apivalue": 5, "rangeStr": "500 mV"},
# to load the proper dll
import platform
# Do not import or use ill definied data types
# such as short int or long
# use the values specified in the h file
# float is always defined as 32 bits
# double is defined as 64 bits
from ctypes import byref, POINTER, create_string_buffer, c_float, \
c_int16, c_int32, c_uint32, c_void_p, c_int64
from ctypes import c_int32 as c_enum
from picoscope.picobase import _PicoscopeBase
class PS5000a(_PicoscopeBase):
"""The following are low-level functions for the PS5000."""
LIBNAME = "ps5000a"
NUM_CHANNELS = 4
CHANNELS = {"A": 0, "B": 1, "C": 2, "D": 3,
"External": 4, "MaxChannels": 4, "TriggerAux": 5}
ADC_RESOLUTIONS = {"8": 0, "12": 1, "14": 2, "15": 3, "16": 4}
CHANNEL_RANGE = [{"rangeV": 10E-3, "apivalue": 0, "rangeStr": "10 mV"},
{"rangeV": 20E-3, "apivalue": 1, "rangeStr": "20 mV"},
{"rangeV": 50E-3, "apivalue": 2, "rangeStr": "50 mV"},
{"rangeV": 100E-3, "apivalue": 3, "rangeStr": "100 mV"},
{"rangeV": 200E-3, "apivalue": 4, "rangeStr": "200 mV"},
{"rangeV": 500E-3, "apivalue": 5, "rangeStr": "500 mV"},