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.8.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.8-py3-none-any.whl (35.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: puda_biologic-0.0.8.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.8.tar.gz
Algorithm Hash digest
SHA256 7b1fea12643b1b6caefa86879c790d19596bf311ec2079eb7916ce5a9d3d1afe
MD5 c9f91e09152ec1103209f665c5997166
BLAKE2b-256 739d6eab16c5aa1b0b770ccd49aa6f06a5d21d6a54cc1c3d625e7e3fe8565c33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: puda_biologic-0.0.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5ee7a80ca86533f783f9c8041f9e33e53a7ab3711db340477a52aa4ca823fbea
MD5 22cc10819e4b5ded340befde2341e7b8
BLAKE2b-256 8d05dad6ce89dfe52f2d5f8cc769cdfc8158d985a1bcf085bf9a4df297fcd687

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