Skip to main content

An easy library for controlling BioLogic devices.

Project description

Easy Biologic

Allows easy control over BioLogic devices. High and low level control over BioLogic devices are available. Low level control is in the lib subpackage, while high level control is in the main module.

Install with python -m pip install easy-biologic

API

For a full overview of both APIs see API.md.

High Level

High level control of devices and programs. Most users will use these.

  • Biologic Device: Represents a BioLogic Device.
  • Biologic Program: Represents a program to be run on a device.
  • Program Runner: Represents a program to be run on a device channel.
  • Base Programs: Basic implementations of BiologicPrograms.
  • Find Devices: A convenience script for finding connected devices.

Low Level

Gives direct control of the Biologic device using DLL libraries. Used to implement new techniques.

  • EC Lib: Contains methods converting the BL_* DLL functions for use, enumeration classes to encapsulate program and device states, and C Structures for sending and receiving data from th device.
  • Data Parser: Parses data received from a technique and contains technique fields for different device types.
  • EC Find: Implements the BL Find DLL.
  • Technique Fields: Parameter types for techniques. (Not all techniques are implemented.)
  • EC Errors: Implements EC errors.

Examples

Basic

Runs an MPP program on channels 0 - 7 for 10 minutes.

import easy_biologic as ebl
import easy_biologic.base_programs as blp

# create device
bl = ebl.BiologicDevice('192.168.1.2')

# create mpp program
params = {
	'run_time': 10* 60		
}

mpp = blp.MPP(
    bl,
    params, 	
    channels = [ 0, 1, 2, 3, 4, 5, 6 ]        
)

# run program
mpp.run('data')

Custom parameters

Runs a CV scan for three cycles at a scan rate of 50 mV/s on channel 0. The experiment begins at 0.5 V and forward scans to -0.25 V, then scans backward to 0.8 V. In the final cycle, it scans to 1.0 V.

import easy_biologic as ebl
import easy_biologic.base_programs as blp        

bl = ebl.BiologicDevice('192.168.1.2')
save_path = '/path/to/data/CV.csv'
params = {
    'start': 0.5,
    'end': -0.25,
    'E2': 0.8,
    'Ef': 1.0,
    'rate': 0.05,  
    'step': 0.001,    
    'N_Cycles': 2,
    'begin_measuring_I': 0.5,
    'End_measuring_I': 1.0,
}  

CV = blp.CV(
    bl,
    params,     
    channels = [0]
)     

CV.run('data')
CV.save_data(save_path)

Advanced

Runs an OCV then uses the final OCV voltage for PEIS.

import easy_biologic as ebl
import easy_biologic.base_programs as blp        

bl = ebl.BiologicDevice('192.168.1.2')
save_path_ocv = '/path/to/data/OCV.csv'

# Run OCV
params_ocv = {
    'time': 2,
    'time_interval': 1,
}

ocv = blp.OCV(
    bl,
    params_ocv,
    channels=[0]
)

ocv.run('data')
ocv.save_data(save_path_ocv)

voc = {
    ch: [datum.voltage for datum in data]
    for ch, data in ocv.data.items()
}

voc = {
    ch: sum(ch_voc) / len(ch_voc)
    for ch, ch_voc in voc.items()
}

# Run PEIS
save_path_peis = '/path/to/data/PEIS.csv'
params_peis = {
    'voltage': list(voc.values())[0],
    'final_frequency': 1000,
    'initial_frequency': 1000000,
    'amplitude_voltage': 0.1,
    'frequency_number': 60,
    'duration': 0,
    'repeat': 10,
    'wait': 0.1
}

peis = blp.PEIS(
    bl,
    params_peis,
    channels=[0]
)

peis.run('data')
peis.save_data(save_path_peis)

CV and PEIS options

  • Voltage and current range: CV and PEIS accept optional voltage_range and current_range (use ec_lib.ERange and ec_lib.IRange) to fix the measurement ranges.
  • Averaging: PEIS supports N-point averaging per frequency via the repeat parameter (e.g. repeat: 5 or 10 for better noise averaging). CV supports hardware averaging on/off only via the average parameter (True/False).

Extras

  • pandas: Use pandas to save data.

Known issues

  • USB connection: Often times using a USB connection will give a ERR_COMM_CONNECTIONFAILED (-201) error. We have found that USB can be unreliable, and a TCP connection is resolves this issue.

Adding techniques

BioLogic will often update their firmware which needs to be included in this package. To do so 0. Download this package. The easiest way to do this is git clone https://github.com/bicarlsen/easy-biologic.git.

  1. Download the EC-Lab Developer Package, noting its install path (typically C:\EC-Lab Development Package).
  2. Copy the EC-Lab Development Package\lib folder (typically C:\EC-Lab Development Package\lib) into the folder easy-biologic/src/techniques folder and rename it with the major and minor version of the firmware (e.g. 6.04). You can view previous technique version folders for examples.
  3. Update the src/data/techniques_version.json file to the version you just added.
  4. (optional) Create a pull request to have it included in the package, so everybody benefits :).

Project details


Download files

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

Source Distribution

puda_biologic-0.0.7.tar.gz (34.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

puda_biologic-0.0.7-py3-none-any.whl (35.9 MB view details)

Uploaded Python 3

File details

Details for the file puda_biologic-0.0.7.tar.gz.

File metadata

  • Download URL: puda_biologic-0.0.7.tar.gz
  • Upload date:
  • Size: 34.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for puda_biologic-0.0.7.tar.gz
Algorithm Hash digest
SHA256 995e0bdc768f43b02df2c9f3848bd7c7b084a074fe2d4b3b702a2a8d79cdc953
MD5 379dc00647cb19e836d9b8a774e6f092
BLAKE2b-256 35c1162b386cc1b0e741b88221ffc5b846acc3c47534d43f95051cf460ba78bf

See more details on using hashes here.

File details

Details for the file puda_biologic-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: puda_biologic-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 35.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for puda_biologic-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 683633f3c46aea6d41f592facf8b63905b954060d673e25ae8bcdbf735896ff5
MD5 3545edb79e2e3b4322f6009c859bd75a
BLAKE2b-256 1cc3343187bf9fef8aee13492cc2eeba3eb733501faaf334d8cf9c63473542c4

See more details on using hashes here.

Supported by

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