Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (322)
Showing
with 1084 additions and 925 deletions
......@@ -4,6 +4,14 @@ Breakpoints_v2.xcbkptlist
*.c
*.so
*.pyc
*.pyo
*~
/dstatInterface/dist/
/dstatInterface/build/
\ No newline at end of file
RELEASE-VERSION
paver-minilib.zip
dist
setup.py
*.egg-info
last_params
last_params.yml
\.idea/
File moved
Version 1.4.6
-Fixed data output for SWV/DPV forward/reverse current
-Working progress bars
-Refactored a lot of plotting code
-Calibration should work properly now
Version 1.4.5
-Made board definitions modular
-Fix several bugs with experiment parameters
-Uses DAC unit based parameters now (**REQUIRES dstat-firmware@9e4a9f or higher**)
-Change package import structure again (main must always be run as module now)
-Workaround for weird Gtk+3 redrawing bug on Windows
Version 1.4.4
-Make connection code more robust
-Execute button disabled until DStat is ready to start
-Supports new firmware version strings added in dstat-firmware@c5f9701
-Experimental firmware upgrade tool (see DStat Menu)
-Fix many bugs
Version 1.4.3
-Fix another critical bug with Windows multiprocessing
-Allow normal exit even if DStat was never connected
-Store last parameters in user folder
Version 1.4.2
-Refactor to fix critical bug preventing running packaged versions.
Version 1.4.1
-Fixed voltage axis orientation for LSV, CV, SWV, and DPV (Thanks to Dan Bizzotto @ UBC)
-Tweaked paver files to make version detection work without git.
Version 1.4
-Switched to GTK+3
-Support new DStat communications protocol (requires dstat-firmware>fe50c38)
-Many behind-the-scenes changes to improve code readability and make adding new experiment types easier
-Documented new Anaconda packages
Version 1.3.3
-Bugfix #24: Remove ZODB support until it can be fixed for latest ZODB
Version 1.3.2
-Improves initial connection reliability
Version 1.3.1
-Fixed electrochem modes broken when database added
-Make metadata keys optional.
Version 1.3
-Fixed a bug related to calibration mode
-Added ZODB data storage
-Integrated with zmq_plugin
Version 1.2
-Old Microdrop interface depreciated
-New zmq_plugin based interface
-Internal changes to save functionality and plot storage.
Version 1.1.3
-Changed internal storage of experiment data
-Added Analysis options:
-FFT integral moved there
-Basic statistics
Version 1.1.2
-Fixed more critical bugs from refactoring
Version 1.1.1
-Fixed critical bug that made PGA setting change with Gain resistor
Version 1.1
-Plot will be prettier if seaborn is installed
-Fixed bug in shutter FFT display
-Revamped experiment parameter system:
-Adds requirement for yaml
-Parameters automatically saved and loaded from last session
-Can manually save and load parameter files
Version 1.0.7
-Fixed a few bugs for systems without git
-Implements mean crossing detection instead of windowing for shutter FFT
Version 1.0.6
-Automatically integrates shutter FFT peak and saves to data file
-Adds option to offset start of FFT to avoid PMT startup delay
Version 1.0.5
-Bugfix for saving error introduced by new logging system
Version 1.0.4
-Adds support for synchronous electromechanical shutter detection (added in dstat/dstat-firmware@29d4c86)
-New version string system
Version 1.0.3
-Fixed #14: Added support for PMT idle mode
-Reduced CPU usage when running OCP by reducing polling frequency
Version 1.0.2a
-Hotfix #12: Restored measurement ability on Windows
-Minor logging changes
-Automatically enable TCS on DStat when measure light sensor button clicked.
Version 1.0.2
-Improved logging system: Log messages now print showing where they came from.
-Implemented gobject IO callbacks for experiments:
Process will not continuously poll for new data from serial process anymore.
-Stop button works again
-Buttons in Photodiode and Calibration modules remain insensitive until ready.
This diff is collapsed.
include RELEASE-VERSION
include version.py
include setup.py
include main.py
include paver-minilib.zip
include LICENSE
include CHANGELOG
include README.markdown
include core/utils/RELEASE-VERSION
recursive-include dstat_interface *
recursive-exclude dstat_interface *.pyc
recursive-exclude dstat_interface *~
recursive_exclude core last_params.yml
recursive-exclude . .DS_Store
\ No newline at end of file
##### _DStat is described in detail in [Dryden MDM, Wheeler AR (2015) DStat: A Versatile, Open-Source Potentiostat for Electroanalysis and Integration. PLoS ONE 10(10): e0140349. doi: 10.1371/journal.pone.0140349](http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0140349) If you use this information in published work, please cite accordingly._
---
## Python 2.7 is now discontinued and gtk has always been a pain for cross-platform use, so I am in the process of writing a new interface in Python 3 and Qt that I hope will be working before too long.
This is the documentation for the DStat interface software.
The DStat interface is written primarily in Python and runs on Linux, Mac, and Windows.
It is the main method for running experiments on the DStat, controlling experimental parameters and collecting and plotting data.
It currently has no abilities for analyzing recorded data or opening previously saved data files, but data is saved in a simple text format or numpy-compatible binary format and plots can be saved as images.
## Table of Contents:
1. [Installation](#Installation)
1. [MacOS](#macos)
1. [Using Anaconda (Recommended)](#using-anaconda-recommended)
2. [Old Homebrew Instructions](#old-homebrew-instructions)
1. [Linux](#linux)
2. [Windows](#windows)
3. [Upgrading](#upgrading)
2. [Getting Started](#Getting-Started)
# Introduction
The DStat interface is written primarily in Python and runs on Linux, Mac, and Windows.
It is the main method for running experiments on the DStat, controlling experimental parameters and collecting and plotting data.
It currently has no abilities for analyzing recorded data or opening previously saved data files, but data is saved in a simple text format and plots can be saved as images.
# Installation
dstat-interface has moved to gtk+3 and we now recommend Anaconda/Miniconda for installation.
## MacOS
### Using Anaconda (Recommended)
1. [Install Miniconda](https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh) It doesn't matter if you pick Python 2.7 or 3.5—this just sets Miniconda's default Python. (Skip if Miniconda or Anaconda are already installed)
2. Download the [conda env file](conda-env.yml).
3. In the terminal, create the dstat environment (replacing </path/to/conda-env.yml> with the actual path to the file on your computer):
````conda env create -f </path/to/conda-env.yml>````
3. Then to run dstat-interface:
````source activate dstat
python -m dstat_interface.main````
#### Old Homebrew Instructions
The easiest way to get most of the necessary requirements to run dstat-interface is using [Homebrew](http://brew.sh):
```shell
brew tap homebrew/python
brew update
brew install python gobject-introspection gtk+3 pygobject3 py2cairo scipy zeromq
brew install matplotlib --with-pygtk
```
Be patient on the last step—matplotlib needs to be compiled and may take 2 or 3 minutes.
Make sure you're using brew-installed python, not OS X's default python. `which python` should point to `/usr/local/bin/python` not `/usr/bin/python`. Type `brew doctor` for more information if you are having issues.
The final requirements, can be installed using python's pip system:
pip install pandas pyserial pyzmq pyyaml seaborn zmq-plugin
## Linux
Linux prerequisite installation is similar to that of MacOS with Homebrew, only using your distribution's native package manager rather than Homebrew, and X11 will likely be installed already. Some distributions may not have packages available for installing matplotlib or numpy, in which case, they should be installed using pip.
These instructions were tested on Ubuntu 17.04:
````shell
sudo apt-get install gobject-introspection python-gobject python-pip
pip install dstat-interface
````
You will need to add your user to the `dialout` group to access virtual serial ports (replace <user> with your username):
```shell
sudo usermod -a -G dialout <user>
```
## Windows
The following terminal commands will result in a full installation of dstat-interface and its requirements, assuming [64-bit Miniconda][1] is installed:
```shell
conda create -n dstat -c mdryden python=2 dstat-interface
activate dstat
```
To finish the installation, GTK+3 and its Python bindings must be installed:
1. Download the latest all-in-one installer from [here][2].
2. When the installer prompts for the path to your Python distribution, navigate to your Miniconda/Anaconda envs folder and choose the dstat folder. If you chose to install Miniconda for your user only, the envs folder is found in `$USER/Miniconda2/envs` (for Miniconda) or `$USER/Anaconda/envs` (for Anaconda), where `$USER` is your user directory. If you installed Miniconda for all users, the Miniconda2/Anaconda folder will be in the root of your C: drive.
3. When the installer asks which modules to install, choose GTK.
4. Finish the installer.
We are installing in a separate environment to keep a clean system.
`activate dstat` will enter the environment (must be done whenever a new terminal is opened),
and `deactivate` will return to the root environment.
Therefore, to run dstat-interface from our environment, we must first activate it (if not already done) before launching it:
```shell
activate dstat
python -m dstat_interface.main
```
[1]: https://repo.continuum.io/miniconda/Miniconda2-latest-Windows-x86_64.exe
[2]: https://sourceforge.net/projects/pygobjectwin32/
## Upgrading
Anaconda builds can be upgraded to the latest version by issuing this command (from an activated conda environment):
```shell
conda upgrade -c mdryden dstat-interface # For MacOS, be sure to upgrade dstat-interface-deps as well
```
pip installs can be upgraded similarly:
```shell
pip install --upgrade dstat-interface
```
You can also run development builds directly from a cloned git repository (from an activated conda environment):
```shell
cd ~/src/dstat-interface/dstat_interface # Replace with path to dstat_interface folder inside repository
python -m main
```
# Getting started
## Interface overview
![Main interface](images/1.png)
1. Menu bar
![Menu bar](images/5.png)
* File
* Save Current data… — Saves the data of the currently visible plot as a space-separated text file or numpy .npy file
* Save Plot… – Save the currently visible plot as a .pdf
* Quit — Quits dstat-interface
* Dropbot
* Connect — Listens for µDrop connection over ZMQ
* Disconnect — Disconnect from µDrop
* Help
* About — Displays license information
2. ADC Settings Panel
* PGA Setting — Sets the ADC's internal voltage gain. Should almost always be left at 2x except for potentiometry as increasing voltage gain reduces S/N. Settings other than 2x do not adjust data to match (e.g. one must halve measured current/voltage values if PGA is set to 4x).
* Sample Rate - Sets the ADC's sample frequency. Lower rates give less noise, but reduced temporal resolution. Digital filter has a zero at multiples of the sample rate, so the Sample Rate setting can be used to filter out AC line noise by setting the rate to a factor of the line frequency, e.g. for 60 Hz rejection, choose 60, 30, 15, 10, 5, or 2.5 Hz.
* Input Buffer — Sets the ADC's internal input buffer. Should generally be enabled.
3. Potentiostat Settings Panel
* Gain — Controls the current-to-voltage converter gain. Higher values produce better S/N but reduce full scale current limit. Has no effect on potentiometry experiments.
4. Experiment Panel - Pulldown menu changes between experiment types and parameters are entered below.
5. Experiment Control
* Execute — Start the currently selected experiment with the given parameters.
* Stop — Stop the currently running experiment. If Autosave is enabled, the partial experiment will be saved.
6. Communications Panel
* Serial Port — Select the port where DStat is located. On Windows, this is generally something like `COM3`. On Mac OS X, it should appear as `/dev/cu.usbmodem12...E1`. On Linux, it may vary, but will start with `/dev`. If you're not sure, the simplest way is to check the list before and after plugging the DStat in. (Clicking the Refresh button after)
* Refresh — Refreshes the Serial Port list
* Connect — Attempts to handshake with DStat. If unsuccessful, it will time out after approximately 30 seconds.
* OCP — Displays the current open circuit potential measured at the reference electrode input. Active when DStat is connected and an experiment is not running.
* Status bar — Displays status and error messages.
7. Data display tabs — Switches between the plot and raw data tabs
* Plot — Displays the graphical representation of the incoming data.
* Raw Data — The raw experiment data. Doesn't appear until the experiment is complete. The first column corresponds to the x-axis of the plot (time or voltage), and the second column corresponds to the y-axis (current or voltage). For mult-scan experiments, additional pairs of columns represent successive scans.
![raw data](images/4.png)
* Extra Data — For SWV and DPV, the separate forward and reverse currents are recorded here.
8. Autosave controls
* Autosave — Enables automatic data saving on experiment completion. A text data file and a .pdf image of the plot will be saved.
* File save location
* File name selector — A number will be appended automatically if a file with the same name already exists.
9. Plot display
10. Plot navigation controls — For changing the view of the data plot.
## Connecting to DStat
1. Plug the DStat into a USB port, ensuring that drivers are loaded correctly on Windows systems.
2. Click Refresh in the Communications Panel to refresh the Serial Port list and choose the correct entry for the DStat (described above).
3. Click Connect.
4. If the connection was successful, a number should appear in the OCP field and the version number will appear in the status bar.
![connect](images/2.png)
If the connection failed, unplug the DStat and try again.
## Running an experiment
1. Choose the experiment you want to run in the Experiment Panel.
2. Fill the parameter fields.
3. Set an appropriate potentiostat gain.
4. Click Execute.
![experiment](images/3.png)
name: dstat
channels:
- conda-forge
- mdryden
- defaults
dependencies:
- ca-certificates=2018.4.16=0
- certifi=2018.4.16=py27_0
- nb_conda_kernels=2.1.0=py27_0
- openssl=1.0.2o=0
- appnope=0.1.0=py27_0
- backports=1.0=py27_0
- backports_abc=0.5=py27_0
- bleach=1.5.0=py27_0
- configparser=3.5.0=py27_0
- curl=7.54.1=0
- cycler=0.10.0=py27_0
- decorator=4.1.2=py27_0
- entrypoints=0.2.3=py27_0
- enum34=1.1.6=py27_0
- expat=2.1.0=0
- freetype=2.5.5=2
- funcsigs=1.0.2=py27hb9f6266_0
- functools32=3.2.3.2=py27_0
- get_terminal_size=1.0.0=py27_0
- gettext=0.19.8=1
- git=2.11.1=0
- html5lib=0.9999999=py27_0
- icu=54.1=0
- intel-openmp=2018.0.0=h8158457_8
- ipykernel=4.6.1=py27_0
- ipython=5.3.0=py27_0
- ipython-notebook=4.0.4=py27_0
- ipython_genutils=0.2.0=py27_0
- jbig=2.1=0
- jinja2=2.9.6=py27_0
- jpeg=9b=0
- jsonschema=2.6.0=py27_0
- jupyter_client=5.1.0=py27_0
- jupyter_core=4.3.0=py27_0
- krb5=1.13.2=0
- libcxx=4.0.1=h579ed51_0
- libcxxabi=4.0.1=hebd6815_0
- libffi=3.2.1=1
- libgfortran=3.0.1=h93005f0_2
- libiconv=1.14=0
- libpng=1.6.30=1
- libssh2=1.8.0=0
- libtiff=4.0.6=3
- llvmlite=0.21.0=py27hac8ee23_0
- markupsafe=1.0=py27_0
- matplotlib=2.0.2=np113py27_0
- mistune=0.7.4=py27_0
- mkl=2018.0.1=hfbd8650_4
- nbconvert=5.2.1=py27_0
- nbformat=4.4.0=py27_0
- notebook=5.0.0=py27_0
- numba=0.36.2=np113py27h7c931aa_0
- numpy=1.13.3=py27h62f9060_0
- pandas=0.20.3=py27_0
- pandocfilters=1.4.2=py27_0
- path.py=10.3.1=py27_0
- pathlib2=2.3.0=py27_0
- patsy=0.4.1=py27_0
- pcre=8.39=1
- pexpect=4.2.1=py27_0
- pickleshare=0.7.4=py27_0
- pip=9.0.1=py27_1
- prompt_toolkit=1.0.15=py27_0
- ptyprocess=0.5.2=py27_0
- pygments=2.2.0=py27_0
- pyparsing=2.2.0=py27_0
- pyqt=5.6.0=py27_2
- python=2.7.13=0
- python-dateutil=2.6.1=py27_0
- pytz=2017.2=py27_0
- pyyaml=3.12=py27_0
- pyzmq=16.0.2=py27_0
- qt=5.6.2=2
- readline=6.2=2
- scandir=1.5=py27_0
- scipy=1.0.0=py27h793f721_0
- seaborn=0.8=py27_0
- setuptools=36.4.0=py27_0
- simplegeneric=0.8.1=py27_1
- singledispatch=3.4.0.3=py27_0
- sip=4.18=py27_0
- six=1.10.0=py27_0
- sqlite=3.13.0=0
- ssl_match_hostname=3.5.0.1=py27_0
- statsmodels=0.8.0=np113py27_0
- subprocess32=3.2.7=py27_0
- terminado=0.6=py27_0
- testpath=0.3.1=py27_0
- tk=8.5.18=0
- tornado=4.5.2=py27_0
- traitlets=4.3.2=py27_0
- wcwidth=0.1.7=py27_0
- wheel=0.29.0=py27_0
- xz=5.2.3=0
- yaml=0.1.6=0
- zlib=1.2.11=0
- adwaita-icon-theme=3.24.0=1
- arrow=0.10.0=py27_0
- at-spi2-atk=2.24.1=2
- at-spi2-core=2.24.1=2
- atk=2.24.0=3
- cairo-gobject=1.14.8=8
- dbus-client=1.10.18=0
- dfu-programmer=0.7.2=2
- dstat-interface=1.4.6=py27_0
- dstat-interface-deps=1.0=0
- gdk-pixbuf=2.36.6=2
- glib=2.52.2=5
- gobject-introspection=1.52.1=2
- gtk3=3.22.15=4
- harfbuzz=1.4.6=3
- libepoxy=1.4.2=5
- libusb=1.0.21=0
- pango=1.40.6=2
- pixman=0.34.0=1
- py2cairo=1.10.0=py27_0
- pygobject3=3.24.2=py27_3
- pyserial=3.3=py27_0
- zmq-plugin=0.2.post14=py27_0
- pip:
- backports.shutil-get-terminal-size==1.0.0
- backports.shutil-which==3.5.1
- backports.ssl-match-hostname==3.5.0.1
- chardet==3.0.4
- colorama==0.3.9
- idna==2.6
- paver==1.2.4
- pygobject==3.24.1
- requests==2.18.4
- urllib3==1.22
- vmprof==0.4.10
#!/usr/bin/env python
__requires__ = 'PyInstaller==2.1'
import os, sys
os.chdir(os.path.dirname(sys.argv[0]))
args = ['interface_test.spec']
args.extend(sys.argv[1:])
import PyInstaller.main as pyi #For some reason, it gets the path here, so working dir must be set first
pyi.run(args)
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXFileReference section */
5F05410F1994220800185C41 /* build_windows.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = build_windows.py; sourceTree = "<group>"; };
5F87883C19072E86007B53E0 /* mpltest.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = mpltest.py; sourceTree = "<group>"; };
5FB0B8E1198ACD4B00FA6CB7 /* microdrop.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = microdrop.py; sourceTree = "<group>"; };
5FCB541B190591CD00CEB148 /* interface */ = {isa = PBXFileReference; lastKnownFileType = folder; path = interface; sourceTree = "<group>"; };
5FCB541D1905923800CEB148 /* interface_test.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = interface_test.py; sourceTree = "<group>"; };
5FCB54231905B6EE00CEB148 /* dstat_comm.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = dstat_comm.py; sourceTree = "<group>"; };
5FDC0DFD18FDAD79003F857A /* mpl.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = mpl.py; sourceTree = "<group>"; };
5FDC1E4218FF9572007AD04D /* glade1.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = glade1.py; sourceTree = "<group>"; };
5FF00FDC1942BD16004D38A8 /* setup.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = setup.py; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
5FDC0DF218FDACDA003F857A = {
isa = PBXGroup;
children = (
5FF00FDC1942BD16004D38A8 /* setup.py */,
5F87883C19072E86007B53E0 /* mpltest.py */,
5F05410F1994220800185C41 /* build_windows.py */,
5FCB541D1905923800CEB148 /* interface_test.py */,
5FB0B8E1198ACD4B00FA6CB7 /* microdrop.py */,
5FCB54231905B6EE00CEB148 /* dstat_comm.py */,
5FCB541B190591CD00CEB148 /* interface */,
5FDC0DFD18FDAD79003F857A /* mpl.py */,
5FDC1E4218FF9572007AD04D /* glade1.py */,
);
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */
5FDC0DF718FDACDA003F857A /* dstatInterface */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "setup.py build_ext --inplace";
buildConfigurationList = 5FDC0DFA18FDACDA003F857A /* Build configuration list for PBXLegacyTarget "dstatInterface" */;
buildPhases = (
);
buildToolPath = /usr/local/bin/python;
buildWorkingDirectory = "/Users/mdryden/src/dstat-interface2/dstatInterface";
dependencies = (
);
name = dstatInterface;
passBuildSettingsInEnvironment = 1;
productName = dstatInterface;
};
/* End PBXLegacyTarget section */
/* Begin PBXProject section */
5FDC0DF318FDACDA003F857A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Wheeler Lab";
};
buildConfigurationList = 5FDC0DF618FDACDA003F857A /* Build configuration list for PBXProject "dstatInterface" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 5FDC0DF218FDACDA003F857A;
projectDirPath = "";
projectRoot = "";
targets = (
5FDC0DF718FDACDA003F857A /* dstatInterface */,
);
};
/* End PBXProject section */
/* Begin XCBuildConfiguration section */
5FDC0DF818FDACDA003F857A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
5FDC0DF918FDACDA003F857A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
SDKROOT = macosx;
};
name = Release;
};
5FDC0DFB18FDACDA003F857A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUGGING_SYMBOLS = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
5FDC0DFC18FDACDA003F857A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5FDC0DF618FDACDA003F857A /* Build configuration list for PBXProject "dstatInterface" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5FDC0DF818FDACDA003F857A /* Debug */,
5FDC0DF918FDACDA003F857A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5FDC0DFA18FDACDA003F857A /* Build configuration list for PBXLegacyTarget "dstatInterface" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5FDC0DFB18FDACDA003F857A /* Debug */,
5FDC0DFC18FDACDA003F857A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5FDC0DF318FDACDA003F857A /* Project object */;
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:dstatInterface.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>0F1B5EE2-7AAC-4E6A-B3E7-4BA34F7B9450</string>
<key>IDESourceControlProjectName</key>
<string>dstatInterface</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>4464FFD1-344B-433F-9C56-38CC9C58511E</key>
<string>ssh://bitbucket.org/mkdryden/dstat-interface-2.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>dstatInterface/dstatInterface.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>4464FFD1-344B-433F-9C56-38CC9C58511E</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh://bitbucket.org/mkdryden/dstat-interface-2.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>4464FFD1-344B-433F-9C56-38CC9C58511E</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>4464FFD1-344B-433F-9C56-38CC9C58511E</string>
<key>IDESourceControlWCCName</key>
<string>dstat-interface2</string>
</dict>
</array>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5FDC0DF718FDACDA003F857A"
BuildableName = "dstatInterface"
BlueprintName = "dstatInterface"
ReferencedContainer = "container:dstatInterface.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "YES"
customWorkingDirectory = "/Users/mdryden/src/dstat-interface2/dstatInterface"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<PathRunnable
FilePath = "/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/bin/python2.7">
</PathRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5FDC0DF718FDACDA003F857A"
BuildableName = "dstatInterface"
BlueprintName = "dstatInterface"
ReferencedContainer = "container:dstatInterface.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CommandLineArguments>
<CommandLineArgument
argument = "interface_test.py"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>dstatInterface.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>5FDC0DF718FDACDA003F857A</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
#!/usr/bin/env python
import serial, io, time, struct, sys, os
from types import *
from serial.tools import list_ports
import numpy as np
import multiprocessing as mp
from Queue import Empty
def call_it(instance, name, args=(), kwargs=None):
"indirect caller for instance methods and multiprocessing"
if kwargs is None:
kwargs = {}
return getattr(instance, name)(*args, **kwargs)
class delayedSerial(serial.Serial): #overrides normal serial write so that characters are output individually with a slight delay
def write(self, data):
for i in data:
serial.Serial.write(self, i)
time.sleep(.001)
class SerialDevices:
def __init__(self):
try:
self.ports, _, _ = zip(*list_ports.comports())
except ValueError:
self.ports = []
print "No serial ports found"
def refresh(self):
self.ports, _, _ = zip(*list_ports.comports())
class Experiment:
def run_wrapper(self, *argv):
self.p = mp.Process(target=call_it, args=(self, 'run', argv))
self.p.start()
def __init__(self): #will always be overriden, but self.parameters, self.viewparameters, and self.databytes should be defined
pass
def init(self):
self.data_extra = [] #must be defined even when not needed
self.__gaintable = [1e2, 3e2, 3e3, 3e4, 3e5, 3e6, 3e7, 5e8]
self.gain = self.__gaintable[int(self.parameters['gain'])]
self.commands = ["A","G"]
self.commands[0] += (self.parameters['adc_buffer'])
self.commands[0] += " "
self.commands[0] += (self.parameters['adc_rate'])
self.commands[0] += " "
self.commands[0] += (self.parameters['adc_pga'])
self.commands[0] += " "
self.commands[1] += (self.parameters['gain'])
self.commands[1] += " "
def run(self, strPort):
self.serial = delayedSerial(strPort, 1024000, timeout=1)
self.serial.write("ck")
self.serial.flushInput()
for i in self.commands:
print i
self.serial.write('!')
while not self.serial.read().startswith("C"):
pass
self.serial.write(i)
if not self.serial_handler():
break
self.data_postprocessing()
self.serial.close()
self.main_pipe.close()
def serial_handler(self):
scan = 0
while True:
if self.main_pipe.poll():
print "abort"
if self.main_pipe.recv() == 'a':
self.serial.write('a')
return False
for line in self.serial:
if line.startswith('B'):
self.main_pipe.send(self.data_handler((scan, self.serial.read(size=self.databytes))))
elif line.startswith('S'):
scan += 1
elif line.startswith("#"):
print line
elif line.lstrip().startswith("no"):
print line
self.serial.flushInput()
return True
def data_handler(self, input):
scan, data = input
voltage, current = struct.unpack('<Hl', data) #uint16 + int32
return (scan, [(voltage-32768)*3000./65536, current*(1.5/self.gain/8388607)])
def data_postprocessing(self):
pass
class chronoamp(Experiment):
def __init__(self, parameters, main_pipe):
self.main_pipe = main_pipe
self.parameters = parameters
self.datatype = "linearData"
self.xlabel = "Time (s)"
self.ylabel = "Current (A)"
self.data = [[],[]]
self.datalength = 2
self.databytes = 8
self.xmin = 0
self.xmax = 0
for i in self.parameters['time']:
self.xmax += int(i)
self.init() #need to call after xmin and xmax are set
self.commands += "R"
self.commands[2] += str(len(self.parameters['potential']))
self.commands[2] += " "
for i in self.parameters['potential']:
self.commands[2] += str(int(i*(65536./3000)+32768))
self.commands[2] += " "
for i in self.parameters['time']:
self.commands[2] += str(i)
self.commands[2] += " "
def data_handler(self, input): #overrides inherited method to not convert x axis
scan, data = input
seconds, milliseconds, current = struct.unpack('<HHl', data) #2*uint16 + int32
return (scan, [seconds+milliseconds/1000., current*(1.5/self.gain/8388607)])
class lsv_exp(Experiment):
def __init__(self, parameters, send_pipe):
self.main_pipe = send_pipe
self.parameters = parameters
self.datatype = "linearData"
self.xlabel = "Voltage (mV)"
self.ylabel = "Current (A)"
self.data = [[],[]]
self.datalength = 2
self.databytes = 6 #uint16 + int32
self.xmin = self.parameters['start']
self.xmax = self.parameters['stop']
self.init() #need to call after xmin and xmax are set
self.commands += "L"
self.commands[2] += str(self.parameters['clean_s'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['dep_s'])
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['clean_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['dep_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(self.parameters['start'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['stop'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['slope'])
self.commands[2] += " "
class cv_exp(Experiment):
def __init__(self, parameters, main_pipe):
self.main_pipe = main_pipe
self.parameters = parameters
self.datatype = "CVData"
self.xlabel = "Voltage (mV)"
self.ylabel = "Current (A)"
self.data = [[],[]] #Will have to alter data_handler to add new lists as needed
self.datalength = 2 * self.parameters['scans'] #x and y for each scan
self.databytes = 6 #uint16 + int32
self.xmin = self.parameters['v1']
self.xmax = self.parameters['v2']
self.init()
self.commands += "C"
self.commands[2] += str(self.parameters['clean_s'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['dep_s'])
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['clean_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['dep_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(self.parameters['v1'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['v2'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['start'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['scans'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['slope'])
self.commands[2] += " "
def data_handler(self, input):
scan, data = input
voltage, current = struct.unpack('<Hl', data) #uint16 + int32
return (scan, [(voltage-32768)*3000./65536, current*(1.5/self.gain/8388607)])
class swv_exp(Experiment):
def __init__(self, parameters, main_pipe):
self.main_pipe = main_pipe
self.parameters = parameters
self.datatype = "SWVData"
self.xlabel = "Voltage (mV)"
self.ylabel = "Current (A)"
self.data = [[],[]] #only difference stored here
self.datalength = 2 * self.parameters['scans']
self.databytes = 10
self.xmin = self.parameters['start']
self.xmax = self.parameters['stop']
self.init()
self.data_extra = [[],[]] #forward/reverse stored here - needs to be after self.init to keep from being redefined
self.commands += "S"
self.commands[2] += str(self.parameters['clean_s'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['dep_s'])
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['clean_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['dep_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(self.parameters['start'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['stop'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['step'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['pulse'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['freq'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['scans'])
self.commands[2] += " "
def data_handler(self, input):
scan, data = input
voltage, forward, reverse = struct.unpack('<Hll', data) #uint16 + int32
return (scan, [(voltage-32768)*3000./65536, (forward-reverse)*(1.5/self.gain/8388607), forward*(1.5/self.gain/8388607), reverse*(1.5/self.gain/8388607)])
class dpv_exp(swv_exp):
def __init__(self, parameters, main_pipe):
self.main_pipe = main_pipe
self.parameters = parameters
self.datatype = "SWVData"
self.xlabel = "Voltage (mV)"
self.ylabel = "Current (A)"
self.data = [[],[]] #only difference stored here
self.datalength = 2
self.databytes = 10
self.xmin = self.parameters['start']
self.xmax = self.parameters['stop']
self.init()
self.data_extra = [[],[]] #forward/reverse stored here - needs to be after self.init to keep from being redefined
self.commands += "D"
self.commands[2] += str(self.parameters['clean_s'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['dep_s'])
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['clean_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(int(self.parameters['dep_mV']*(65536./3000)+32768))
self.commands[2] += " "
self.commands[2] += str(self.parameters['start'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['stop'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['step'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['pulse'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['period'])
self.commands[2] += " "
self.commands[2] += str(self.parameters['width'])
self.commands[2] += " "
#!/usr/bin/env python
import sys
try:
import pygtk
pygtk.require('2.0')
except:
pass
try:
import gtk
except:
print('GTK not available')
sys.exit(1)
try:
import math
except:
print('math lib missing')
sys.exit(1)
# we can call it just about anything we want
class Buglump:
# This first define is for our on_window1_destroy signal we created in the
# Glade designer. The print message does just that and prints to the terminal
# which can be useful for debugging. The 'object' if you remember is the signal
# class we picked from GtkObject.
def on_window1_destroy(self, object, data=None):
print "quit with cancel"
gtk.main_quit()
# This is the same as above but for our menu item.
def on_gtk_quit_activate(self, menuitem, data=None):
print "quit from menu"
gtk.main_quit()
def on_gtk_about_activate(self, menuitem, data=None):
print "help about selected"
self.response = self.aboutdialog.run() #waits for user to click close - could test response with if
self.aboutdialog.hide()
def on_push_status_activate(self, menuitem, data=None): #adds message to top of stack
self.status_count += 1 #increment status_count
self.statusbar.push(self.context_id, "Message number %s" % str(self.status_count))
def on_pop_status_activate(self, menuitem, data=None): #removes top message from stack
self.status_count -= 1
self.statusbar.pop(self.context_id)
def on_clear_status_activate(self, menuitem, data=None): #clears status stack
self.statusbar.remove_all(self.context_id)
self.status_count = 0
# while (self.status_count > 0):
# self.statusbar.pop(self.context_id)
# self.status_count -= 1
def on_sfm_button_clicked(self, button, data=None):
# create an instance of the entry objects
# so we can get and set the text values
self.entry1 = self.builder.get_object("entry1")
self.entry2 = self.builder.get_object("entry2")
self.result1 = self.builder.get_object("result1")
# get the text from the GtkEntry widget and convert
# it to a float value so we can calculate the result
self.sfm = float(self.entry1.get_text())
self.diameter = float(self.entry2.get_text())
# calculate the result convert to an int to round the number
# then convert to a string to set the text in our label
# notice the math.pi constant is used in the calculation
self.rpm = str(int(self.sfm * ((12/math.pi)/self.diameter)))
# debugging print
print "calculate rpm clicked"
# set the result label with our results
self.result1.set_text(self.rpm)
def on_gtk_new_activate(self, menuitem, data=None):
# debugging message
print 'File New selected'
# create a label for the tab and using get_n_pages() to find out how
# many pages there is so the next page has a sequential number.
self.label1 = gtk.Label('Page ' + str(self.notebook.get_n_pages() + 1))
# create a label to put into the page
self.label2 = gtk.Label('Hello World')
# If you don't show the contents of the tab it won't show up
self.label2.show()
# append a page with label5 as the contents and label5 as the tab
self.notebook.append_page(self.label2, self.label1)
def on_notebook1_switch_page(self, notebook, page, page_num, data=None):
self.tab = notebook.get_nth_page(page_num)
self.label = notebook.get_tab_label(self.tab).get_label()
self.message_id = self.statusbar.push(0, self.label)
# This is our init part where we connect the signals
def __init__(self):
self.gladefile = "test1.glade" # store the file name
self.builder = gtk.Builder() # create an instance of the gtk.Builder
self.builder.add_from_file(self.gladefile) # add the xml file to the Builder
# This line does the magic of connecting the signals created in the Glade3
# builder to our defines above. You must have one def for each signal if
# you use this line to connect the signals.
self.builder.connect_signals(self)
#get widgets
self.window = self.builder.get_object("window1")
self.aboutdialog = self.builder.get_object("aboutdialog1")
self.statusbar = self.builder.get_object("statusbar")
self.notebook = self.builder.get_object("notebook1")
self.window.show() # this shows the 'window1' object
self.context_id = self.statusbar.get_context_id("status") #register and get statusbar context_id for description "status"
self.status_count = 0 #count of messages pushed
# If this is run stand alone execute the following after the 'if'
# If this class is imported into another program the code after the 'if' will
# not run. This makes the code more flexible.
if __name__ == "__main__":
main = Buglump() # create an instance of our class
gtk.main() # run the darn thing
\ No newline at end of file
#!/usr/bin/env python
import gtk
class acv:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file('interface/acv.glade')
self.builder.connect_signals(self)
self.start_entry = self.builder.get_object('start_entry')
self.stop_entry = self.builder.get_object('stop_entry')
self.slope_entry = self.builder.get_object('slope_entry')
self.amplitude_entry = self.builder.get_object('amplitude_entry')
self.freq_entry = self.builder.get_object('freq_entry')
\ No newline at end of file
#!/usr/bin/env python
import gtk
class adc_pot:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file('interface/adc_pot.glade')
self.builder.connect_signals(self)
self.cell = gtk.CellRendererText()
self.buffer_toggle = self.builder.get_object('buffer_checkbutton')
#initialize comboboxes
self.pga_combobox = self.builder.get_object('pga_combobox')
self.pga_combobox.pack_start(self.cell, True)
self.pga_combobox.add_attribute(self.cell, 'text', 1)
self.pga_combobox.set_active(1)
self.srate_combobox = self.builder.get_object('srate_combobox')
self.srate_combobox.pack_start(self.cell, True)
self.srate_combobox.add_attribute(self.cell, 'text', 1)
self.srate_combobox.set_active(7)
self.gain_combobox = self.builder.get_object('gain_combobox')
self.gain_combobox.pack_start(self.cell, True)
self.gain_combobox.add_attribute(self.cell, 'text', 1)
self.gain_combobox.set_active(1)
\ No newline at end of file
#!/usr/bin/env python
import gtk
class chronoamp:
def label_set_func(self, tree_column, cell, model, iter):
info = model.get_value(iter, 1)
cell.set_property("text", info)
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file('interface/chronoamp.glade')
self.builder.connect_signals(self)
self.statusbar = self.builder.get_object('statusbar')
self.potential = self.builder.get_object('potential_entry')
self.time = self.builder.get_object('time_entry')
self.model = self.builder.get_object('ca_list')
self.treeview = self.builder.get_object('treeview')
self.cell_renderer = gtk.CellRendererText()
self.treeview.insert_column_with_attributes(-1, "Time", self.cell_renderer, text=1).set_expand(True)
self.treeview.insert_column_with_attributes(-1, "Potential", self.cell_renderer, text=0).set_expand(True)
self.treeviewselection = self.treeview.get_selection()
self.treeviewselection.set_mode(gtk.SELECTION_MULTIPLE)
def on_add_button_clicked(self, widget):
self.statusbar.remove_all(0)
try:
potential = int(self.potential.get_text())
time = int(self.time.get_text())
if (potential > 1499 or potential < -1500):
raise ValueError("Potential out of range")
if (time < 1 or time > 65535):
raise ValueError("Time out of range")
self.model.append([potential, time])
except ValueError as e:
self.statusbar.push(0, str(e))
except TypeError as e:
self.statusbar.push(0, str(e))
def on_remove_button_clicked(self, widget):
self.selected_rows = list(self.treeviewselection.get_selected_rows()[1]) #returns 2-tuple: treemodel, list of paths selected rows
self.referencelist = []
for i in self.selected_rows:
x=gtk.TreeRowReference(self.model, i)
self.referencelist.append(x)
for i in self.referencelist:
self.model.remove(self.model.get_iter(i.get_path()))
#!/usr/bin/env python
import gtk
class cv:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file('interface/cv.glade')
self.builder.connect_signals(self)
self.clean_mV = self.builder.get_object('clean_mV')
self.clean_s = self.builder.get_object('clean_s')
self.dep_mV = self.builder.get_object('dep_mV')
self.dep_s = self.builder.get_object('dep_s')
self.start_entry = self.builder.get_object('start_entry')
self.v1_entry = self.builder.get_object('v1_entry')
self.v2_entry = self.builder.get_object('v2_entry')
self.slope_entry = self.builder.get_object('slope_entry')
self.scans_entry = self.builder.get_object('scans_entry')
\ No newline at end of file
#!/usr/bin/env python
import gtk
class dpv:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file('interface/dpv.glade')
self.builder.connect_signals(self)
self.clean_mV = self.builder.get_object('clean_mV')
self.clean_s = self.builder.get_object('clean_s')
self.dep_mV = self.builder.get_object('dep_mV')
self.dep_s = self.builder.get_object('dep_s')
self.start_entry = self.builder.get_object('start_entry')
self.stop_entry = self.builder.get_object('stop_entry')
self.step_entry = self.builder.get_object('step_entry')
self.pulse_entry = self.builder.get_object('pulse_entry')
self.period_entry = self.builder.get_object('period_entry')
self.width_entry = self.builder.get_object('width_entry')
\ No newline at end of file