Code Monkey home page Code Monkey logo

bitscope's Introduction

Python 3.6 PyPI version bitlib version GitHub license

bitscope

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 [email protected]:codenio/bitscope.git
  • install bitlib library 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 !

bitscope's People

Contributors

codenio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bitscope's Issues

Can't install, 404 when install bitlib [BUG]

Describe the bug
A clear and concise description of what the bug is.

I am trying to get this all up and running with a bitscope pocket but don't seem to be able to install everything correctly due to a 404 error when trying to install bitlib. Is there a way for me to fix this? I greatly appreciate any help!

To Reproduce
Steps to reproduce the behavior:

  1. In a console, type "pip install bitscope" or "sudo pip install bitscope" or "sudo pip install bitscope==0.0.3"
  2. Receive the following error: "Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/bitlib"

Expected behavior
A clear and concise description of what you expected to happen.

Installer to conclude successfully

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Raspbian
  • Browser [e.g. chrome, safari] N/A
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Question about STREAM vs. FAST modes

I am trying to acquire data at 20 kHz, but for the entire duration of a separate event. In essence, I am moving a device and acquiring data at the same time and I need the data to be recording while this device is moving. Would it be best to use STREAM or FAST to do this? Also, would it be best to have the data acquisition and the moving of my device in two separate threads, so that they can be run simultaneously?

As of right now, I am able to move and acquire at the same time, but the FAST acquisition completes before the device is done moving. A

Any help is much appreciated.

Nathan

Is there anyway to control the AWG output?

Hi, I think I understand how to record the input channels but I do not understand how to control the signal generator output. Is it possible to set the waveform, amplitude, and offset for the signal generator and activate the output?

Thank you very much for your help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.