Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolidoro committed Dec 12, 2016
0 parents commit 7ae4d80
Show file tree
Hide file tree
Showing 10 changed files with 780 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Backup files
*.~

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Sphinx documentation
docs/_build/

RELEASE-VERSION
48 changes: 48 additions & 0 deletions DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
vix_servo_device_python
======================

This Python package (vix\_servo\_device) creates a class named
VixServoDevice, which contains an instance of
serial\_device2.SerialDevice and adds methods to it to interface to
Vix Servo balances and scales that use the Vix Servo
Standard Interface Command Set (MT-SICS).

Authors::

Peter Polidoro <[email protected]>

License::

BSD

Example Usage::

from vix_servo_device import VixServoDevice
dev = VixServoDevice() # Might automatically find device if one available
# if it is not found automatically, specify port directly
dev = VixServoDevice(port='/dev/ttyUSB0') # Linux specific port
dev = VixServoDevice(port='/dev/tty.usbmodem262471') # Mac OS X specific port
dev = VixServoDevice(port='COM3') # Windows specific port
dev.get_serial_number()
1126493049
dev.get_balance_data()
['XS204', 'Excellence', '220.0090', 'g']
dev.get_weight_stable()
[-0.0082, 'g'] #if weight is stable
None #if weight is dynamic
dev.get_weight()
[-0.6800, 'g', 'S'] #if weight is stable
[-0.6800, 'g', 'D'] #if weight is dynamic
dev.zero_stable()
True #zeros if weight is stable
False #does not zero if weight is not stable
dev.zero()
'S' #zeros if weight is stable
'D' #zeros if weight is dynamic
devs = VixServoDevices() # Might automatically find all available devices
# if they are not found automatically, specify ports to use
devs = VixServoDevices(use_ports=['/dev/ttyUSB0','/dev/ttyUSB1']) # Linux
devs = VixServoDevices(use_ports=['/dev/tty.usbmodem262471','/dev/tty.usbmodem262472']) # Mac OS X
devs = VixServoDevices(use_ports=['COM3','COM4']) # Windows
dev = devs[0]

32 changes: 32 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
License Agreement
(3-clause BSD License)
Janelia Research Campus Software Copyright 1.1

Copyright (c) 2014, Howard Hughes Medical Institute
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the Howard Hughes Medical Institute nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include DESCRIPTION.rst
include README.md
include RELEASE-VERSION
include version.py
include setup.py

# Include the test suite (FIXME: does not work yet)
# recursive-include tests *

# If using Python 2.6 or less, then have to include package data, even though
# it's already declared in setup.py
# include sample/*.dat
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#vix_servo_device_python

This Python package (vix\_servo\_device) creates a class named
VixServoDevice, which contains an instance of
serial\_device2.SerialDevice and adds methods to it to interface to
Vix Servo balances and scales that use the Vix Servo
Standard Interface Command Set (MT-SICS).

Authors:

Peter Polidoro <[email protected]>

Contributors:

James Pells <https://github.com/jpells>
Roger Zatkoff <https://github.com/rpzatkoff>

License:

BSD

##Vix Servo RS232 Setup

| BAUDRATE | BIT/PARITY | STOP BITS | HANDSHAKE | END OF LINE | CHAR SET | CONTINUOUS MODE |
| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
| 9600 | 8/NO | 1 | NONE | \<CR\>\<LF\> | ANSI/WIN | OFF |

##Example Usage


```python
from vix_servo_device import VixServoDevice
dev = VixServoDevice() # Might automatically find device if one available
# if it is not found automatically, specify port directly
dev = VixServoDevice(port='/dev/ttyUSB0') # Linux specific port
dev = VixServoDevice(port='/dev/tty.usbmodem262471') # Mac OS X specific port
dev = VixServoDevice(port='COM3') # Windows specific port
dev.get_serial_number()
1126493049
dev.get_balance_data()
['XS204', 'Excellence', '220.0090', 'g']
dev.get_weight_stable()
[-0.0082, 'g'] #if weight is stable
None #if weight is dynamic
dev.get_weight()
[-0.6800, 'g', 'S'] #if weight is stable
[-0.6800, 'g', 'D'] #if weight is dynamic
dev.zero_stable()
True #zeros if weight is stable
False #does not zero if weight is not stable
dev.zero()
'S' #zeros if weight is stable
'D' #zeros if weight is dynamic
```

```python
devs = VixServoDevices() # Might automatically find all available devices
# if they are not found automatically, specify ports to use
devs = VixServoDevices(use_ports=['/dev/ttyUSB0','/dev/ttyUSB1']) # Linux
devs = VixServoDevices(use_ports=['/dev/tty.usbmodem262471','/dev/tty.usbmodem262472']) # Mac OS X
devs = VixServoDevices(use_ports=['COM3','COM4']) # Windows
dev = devs[0]
```

##Installation

[Setup Python](https://github.com/janelia-pypi/python_setup)

###Linux and Mac OS X

```shell
mkdir -p ~/virtualenvs/vix_servo_device
virtualenv ~/virtualenvs/vix_servo_device
source ~/virtualenvs/vix_servo_device/bin/activate
pip install vix_servo_device
```

###Windows

```shell
virtualenv C:\virtualenvs\vix_servo_device
C:\virtualenvs\vix_servo_device\Scripts\activate
pip install vix_servo_device
```
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[bdist_wheel]
# This flag says that the code is written to work on both Python 2 and Python
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
universal=1

[metadata]
description-file = README.md
95 changes: 95 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
from version import get_git_version

here = path.abspath(path.dirname(__file__))

# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='vix_servo_device',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version=get_git_version(),

description='Interface to Vix Servo balances and scales that use the Vix Servo Standard Interface Command Set (MT-SICS).',
long_description=long_description,

# The project's main homepage.
url='https://github.com/janelia-pypi/vix_servo_device_python',

# Author details
author='Peter Polidoro',
author_email='[email protected]',

# Choose your license
license='BSD',

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',

# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: BSD License',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
# 'Programming Language :: Python :: 2',
# 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
# 'Programming Language :: Python :: 3',
# 'Programming Language :: Python :: 3.2',
# 'Programming Language :: Python :: 3.3',
# 'Programming Language :: Python :: 3.4',
],

# What does your project relate to?
keywords='vix servo serial device',

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),

# List run-time dependencies here. These will be installed by pip when your
# project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/technical.html#install-requires-vs-requirements-files
install_requires=['pyserial',
'serial_device2',
],

# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
# package_data={
# 'sample': ['package_data.dat'],
# },

# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages.
# see http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
# data_files=[('my_data', ['data/data_file'])],

# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
# entry_points={
# 'console_scripts': [
# 'sample=sample:main',
# ],
# },
)
Loading

0 comments on commit 7ae4d80

Please sign in to comment.