Skip to main content

Python library for reading files in Axon Binary Format (ABF)

Project description

pyABF: a pure-Python ABF file reader

pyABF provides a Python interface to electrophysiology files in the Axon Binary Format (ABF). pyABF supports Python versions 3.6 and newer and does not use obscure libraries (just the standard libraries plus numpy and matplotlib). pyABF supports reading of ABF1 and ABF2 files, and can write ABF1 files.

pyABF electrophysiology data analysis with Python and Matplotlib

Quickstart

Install or upgrade pyABF:

pip install --upgrade pyabf

Access ABF sweep data:

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

Plot a sweep with Matplotlib:

import matplotlib.pyplot as plt
import pyabf
abf = pyabf.ABF("17o05028_ic_steps.abf")
abf.setSweep(14)
plt.plot(abf.sweepX, abf.sweepY)
plt.show()
pyABF Example

Get fancy with Matplotlib:

import matplotlib.pyplot as plt
import pyabf
abf = pyabf.ABF("sample.abf")

plt.figure(figsize=(8, 5))
for sweepNumber in range(abf.sweepCount)[::5]:
    abf.setSweep(sweepNumber)
    plt.plot(abf.sweepX,abf.sweepY,alpha=.5,label="sweep %d"%(sweepNumber))

plt.legend()
plt.ylabel(abf.sweepLabelY)
plt.xlabel(abf.sweepLabelX)
plt.title("pyABF and Matplotlib are a great pair!")
plt.show()
pyABF Example

Additional Examples

Full pyabf API documentation, additional code examples, a pyabf cookbook, and low-level information about the ABF file format can be found at the pyABF project homepage: https://github.com/swharden/pyABF

pyABF Example

Citing pyABF

If the pyABF module facilitated your research, consider citing this project by name so it can benefit others too:

“Computational analysis of electrophysiological recordings was performed with custom software written for this project using Python 3.6 and the pyABF module.”


Feature Requests / Unsupported ABF Files

If you have ABF files which are unsupported (or read incorrectly) by this software, it is likely due to a use case we have not run across yet, so let us know about it! We can only develop and test this software against ABF files we have access to, so if you’re interested in having your ABF file supported send the primary author an email (and the ABF file you are trying to analyze) and we will investigate it. If a solution is reached the pyabf package will be updated so everyone can benefit from the change. We can only develop for (and test against) ABFs we have access to, so we really appreciate your contributions!


Author

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyabf-2.2.1.tar.gz (42.6 kB view details)

Uploaded Source

File details

Details for the file pyabf-2.2.1.tar.gz.

File metadata

  • Download URL: pyabf-2.2.1.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.9

File hashes

Hashes for pyabf-2.2.1.tar.gz
Algorithm Hash digest
SHA256 b49bb767dbc3f3e47d073c3efaca82f1bb69fbfc54982d3375210323cfafd3d4
MD5 0804b6c623dbe00e6adf7791c003e5e3
BLAKE2b-256 80b135fef1d7f04aa3235ef9e487d4391d325103ba743e47a22cbfaf3a86753d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page