bitscope is a comprehensive library for programming and data collection from Bitscope Micro.
It is a python wrapper for bitlib package installed using bitscope-library_2.0.FE26B and python3-bindings-2.0-DC01L
Usage
#!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np - from bitlib import * + from bitscope import * # initialisation of scope collects all the device data and stores them in # scope.devices list - BL_Open('USB:/dev/ttyUSB1',1) + scope = Scope('USB:/dev/ttyUSB1',1) # collect the list of devices devices = scope.devices #Setup acquisition in FAST mode, where the whole of the 12288 samples in #the buffer are used by one channel alone. - BL_Select(BL_SELECT_DEVICE,0) - BL_Mode(BL_MODE_FAST) + devices[0].mode(BL_MODE_FAST) #Setup channel-nonspecific parameters for capture. #How many seconds to capture before the trigger event- 0 by default - BL_Intro(BL_ZERO) #How many seconds to capture after the trigger event- 0 by default - BL_Delay(BL_ZERO) # optional, default BL_MAX_RATE - BL_Rate(MY_RATE) # optional default BL_MAX_SIZE - BL_Size(MY_SIZE) + scope.tracer.configure( + rate=BL_MAX_RATE, + size=BL_MAX_SIZE, + pre_capture=BL_ZERO, + post_capture=BL_ZERO + ) #Set up channel A properties - A has channel index 0, B has 1. #All the subsequent properties belong to channel A until another is selected. - BL_Select(BL_SELECT_CHANNEL,0); # use the POD input - the only one available - BL_Select(BL_SELECT_SOURCE,BL_SOURCE_POD); # Y-axis offset is set to zero as BL_ZERO - BL_Offset(BL_ZERO) # maximum range for y-axis - use this whenever possible - BL_Range(BL_Count(BL_COUNT_RANGE)) + devices[0].channels[0].configure( + source=BL_SOURCE_POD, + offset=BL_ZERO, + range=BL_Count(BL_COUNT_RANGE) +) #Enable the currently selected channel, i.e. channel A #This ensures the recorded data goes into the memory-buffer in Bitscope device - BL_Enable(TRUE); + devices[0].channels[0].enable() - BL_Trace(0.01,BL_SYNCHRONOUS) + scope.tracer.trace(0.01,BL_SYNCHRONOUS) - Data = BL_Acquire() + Data = devices[0].channels[0].acquire() print Data
Install
-
clone this repository using
$ git clone git@github.com:codenio/bitscope.git
-
install
bitliblibrary from ./src directory# cd into bitscope/src/ directory $ cd bitscope/src/ # install the bitscope-library_2.0 debian package $ sudo apt-get install bitscope-library_2.0.FE26B_amd64.deb
-
to use bitlib in python3
# to install python3 binding # unzip and cd into bitscope/src/python3-bindings-2.0-DC01L/ $ unzip python3-bindings-2.0-DC01L.zip $ cd python3-bindings-2.0-DC01L/ # install bitlib using the python-binding script $ sudo python3 setup-bitlib.py install # in case of errors.. try $ sudo BASECFLAGS="" OPT="" CFLAGS="-O3" python3 setup-bitlib.py install
Note: visit python3-bindings-2.0-DC01L for further details.
-
to install stable version of bitscope package
$ sudo pip install bitscope or $ sudo pip install bitscope==0.0.3
-
connect your bitscope to your pc and test the functionality using the example file at
examples/basics/bitscope-read-data.py$ python examples/basics/bitscope-read-data.py
Documentation
Develope
- make the suitable changes and from the root directory of this repository, install the bitscope python package using the install.sh script
$ sudo ./scripts/install.sh
Contribute
- You've discovered a bug or something else you want to change - excellent! - feel free to raise a issue.
- You've worked out a way to fix it – even better! - submit your PR
- You want to tell us about it – best of all!
Start contributing !
