/pyABF

A Python interface for ABF files

Primary LanguagePythonMIT LicenseMIT

pyABF

Changes

This fork has been modified to load .abf files as an io.BytesIO stream. This is useful when running on a web server and a .abf file is dragged and dropped into the browser.

Made changes to init() and _loadAndScaleData().

In _loadAndScaleData() simply switched

raw = np.fromfile(fb, dtype=self._dtype,
			  count=self.dataPointCount)

to

raw = np.frombuffer(fb.read(), dtype=self._dtype,
				count=self.dataPointCount)

Where fb is type '_io.BytesIO' and made from an Octet Stream (octetStream) with:

decoded = base64.b64decode(octetStream)
fb = io.BytesIO(decoded)

To install this fork, you need to use the following because setup.py is in a sub folder named 'src':

pip install "git+https://github.com/cudmore/pyABF#egg=pyabf&subdirectory=src"

I also removed docs, data, and dev folders to make my pip install from git+https relatively faster.

I will eventually try and merge this with the master...

pyABF is a Python library for reading electrophysiology data from Axon Binary Format (ABF) files. It was created with the goal of providing a Pythonic API to access the content of ABF files which is so intuitive to use (with a predictive IDE) that documentation is largely unnecessary. Flip through the pyABF Tutorial and you'll be analyzing data from your ABF files in minutes!

Installation

pip install --upgrade pyabf

Quickstart

import pyabf
abf = pyabf.ABF("demo.abf")
abf.setSweep(3)
print(abf.sweepY) # displays sweep data (ADC)
print(abf.sweepX) # displays sweep times (seconds)
print(abf.sweepC) # displays command waveform (DAC)

Resources