Package: easy-biologic
Easy BiologicA library allowing easy control over BioLogic devices.
High and low level control over Biologic devices are available.
Low level control is included in thelibsubpackage, while high level control
is available in the main module.Install withpython -m pip install easy-biologicHigh Level APIThere are two high level API modules containing three classes, and two convenience modules.Biologic DeviceRepresents an instance of a Biologic Device.MethodsBiologicDevice( address, timeout = 5 ):Creates a new Biologic Device representing the device conencted ataddress.connect( bin_file, xlx_file ):Connects to the device, loading the bin and xlx file if provided.disconnect():Disconnects from the device.is_connected():Whether the device is connected or not.load_technique( ch, technique, params, index = 0, last = True, types = none ):Loads a technique onto the given device channel.load_techniques( ch, techniques, parameters, types = None ):Loads a series of techniques onto the given device channel.update_parameters( ch, technique, parameters, index = 0, types = None ):Update the parameters of the given technqiue on the specified device channel.start_channel( ch ):Starts the given channel.start_channels( chs = None ):Starts multiple channels.stop_channel( ch ):Stops the given channel.stop_channels( chs = None ):Stops the given channels.channel_info( ch ):Returns information about the given channel.channel_configuration( ch ):Returns configuration information of the channel.set_channel_configuration( ch, mode, conneciton ):Sets the channel's hardware configuration.get_values( ch ):Returns current values of the given channel.get_data( ch ):Returns buffered data of the given channel.Propertiesaddress:Connection address of the device.idn:ID of the device.kind:Device model.info:DeviceInfo structure.plugged:List of available channels.channels:List of ChannelInfo structures.hardware_configuration:Dictionary of HardwareConfiguration for each channel.techniques:List of TechParams loaded on each channel.Biologic ProgramAbstract ClassRepresents a program to be run on a device.MethodsBiologicProgram( device, params, channels = None, autoconnect = True, barrier = None, stop_event = None, threaded = False ):Creates a new program.channel_state( channels = None ):Returns the state of the channels.on_data( callback, index = None ):Registers a callback function to run when data is collected.run():Runs the program.stop():Sets the stop event flag.save_data( file, append = False, by_channel = False ):Saves data to the given file.sync():Waits for barrier, if set._connect():Connects to the devicePropertiesdevice:BiologicDevice.params:Passed in parameters.channels:Device channels.autoconnect:Whether connection to the device should be automatic or + not.barrier:A threading.Barrier to use for channel syncronization. [See ProgramRummer]field_titles:Column names for saving data.data:Data collected during the program.status:Status of the program.fields:Data fields teh program returns.technqiues:List of techniques the program uses.Program RunnerRepresents a program to be run on a device channel.MethodsProgramRunner( programs, sync = False ):Creates a new program runner.start():Runs the programs.wait():Wait for all threads to finish.stop():Sets stop event.Propertiesthreads:List of threads for each program.sync:Whether to sync the threads or not.Base ProgramsContains basic implementations of BiologicPrograms.OCVParamstime:Run time in seconds.time_interval:Maximum time between readings.
[Default: 1]voltage_interval:Maximum interval between voltage readings.
[Default: 0.01]CAParamsvoltages:List of voltages.durations:List of times in seconds.vs_initial:If step is vs. initial or previous.
[Default: False]time_interval:Maximum time interval between points.
[Default: 1]current_interval:Maximum current change between points.
[Default: 0.001]current_range:Current range. Use ec_lib.IRange.
[Default: IRange.m10 ]Methodsupdate_voltage( voltages, durations = None, vs_initial = None ):Updates the voltage.CALimitParamsvoltages:List of voltages.durations:List of times in seconds.vs_initial:If step is vs. initial or previous.
[Default: False]time_interval:Maximum time interval between points.
[Default: 1]current_interval:Maximum current change between points.
[Default: 0.001]current_range:Current range. Use ec_lib.IRange.
[Default: IRange.m10 ]Methodsupdate_voltage( voltages, durations = None, vs_initial = None ):Updates the voltage.PEISParamsvoltage:Initial potential in Volts.amplitude_voltage:Sinus amplitude in Volts.initial_frequency: Initial frequency in Hertz.final_frequency:Final frequency in Hertz.frequency_number:Number of frequencies.duration:Overall duration in seconds.vs_initial:If step is vs. initial or previous.
[Default: False]time_interval:Maximum time interval between points in seconds.
[Default: 1]current_interval:Maximum time interval between points in Amps.
[Default: 0.001]sweep:Defines whether the spacing between frequencies is logarithmic ('log') or linear ('lin').
[Default: 'log']repeat:Number of times to repeat the measurement and average the values for each frequency.
[Default: 1]correction:Drift correction.
[Default: False]wait:Adds a delay before the measurement at each frequency. The delay is expressed as a fraction of the period.
[Default: 0]GEISPerforms a Galvanostatic Electrochemical Impedance SpectroscopyParamscurrent:Initial current in Ampere.amplitude_current:Sinus amplitude in Ampere.initial_frequency: Initial frequency in Hertz.final_frequency:Final frequency in Hertz.frequency_number:Number of frequencies.duration:Overall duration in seconds.vs_initial:If step is vs. initial or previous.
[Default: False]time_interval:Maximum time interval between points in seconds.
[Default: 1]current_interval:Maximum time interval between points in Amps.
[Default: 0.001]sweep:Defines whether the spacing between frequencies is logarithmic ('log') or linear ('lin').
[Default: 'log']repeat:Number of times to repeat the measurement and average the values for each frequency.
[Default: 1]correction:Drift correction.
[Default: False]wait:Adds a delay before the measurement at each frequency. The delay is expressed as a fraction of the period.
[Default: 0]JV_ScanPerforms a JV scan.Paramsstart:Start voltage.
[Default: 0]end:End voltage.step:Voltage step.
[Default: 0.01]rate:Scan rate in V/s.
[Default: 0.01]average:Average over points.
[Default: False]MPP_TrackingPerforms MPP tracking.Paramsrun_time:Run time in seconds.init_vmpp:Initial v_mpp.probe_step:Voltage step for probe.
[Default: 0.01 V]probe_points:Number of data points to collect for probe.
[Default: 5]probe_interval:How often to probe in seconds.
[Default: 2]record_interval:How often to record a data point in seconds.
[Default: 1]MPPRuns MPP tracking, finding the initial Vmpp by first measuring Voc, then performing a JV scan from 0 to Voc.Paramsrun_time:Run time in seconds.probe_step:Voltage step for probe.
[Default: 0.01 V]probe_points:Number of data points to collect for probe.
[Default: 5]probe_interval:How often to probe in seconds.
[Default: 2]record_interval:How often to record a data point in seconds.
[Default: 1]MPP CyclesRuns multiple MPP cycles, performing Voc and JV scans at the beginning of each.Paramsrun_time:Run time in secondsscan_interval:How often to perform a JV scan.probe_step:Voltage step for probe. [Default: 0.01 V]probe_points:Number of data points to collect for probe. [Default: 5]probe_interval:How often to probe in seconds. [Default: 2]record_interval:How often to record a data point in seconds. [Default: 1]Find DevicesA convenience script for finding connected devices.UseFrom a terminal runpython -m easy_biologic.find_devices.Low Level APIThe low level API gives direct control of the Biologic device using the provided DLL libraries. The subpackage contains five modules.EC LibContains methods converting theBL_*DLL functions for use, enumeration classes to encapsulate program and device states, and C Structures for sending and receiving data from th device.Methodsconnect( address, timeout = 5 ):Connects to the device at the given address.disconnect( idn ):Disconnects given device.is_connected( address ):Checks if the device at the given address is connected.is_channel_connected( idn, ch ):Checks whether the given device channel is connected.get_channels( idn, length = 16 ):Returns a list of booleans of whether the cahnnel at the index exists.channel_info( idn, ch ):Returns a ChannelInfo struct of the given device channel.get_hardware_configuration( idn, ch ):Returns a HarwareConf struct of the given device channel.set_hardware_configuration( idn, ch, mode, connection ):Sets the hardware configuration of the given device channel.load_technique( idn, ch, technique, params, first = True, last = True, verbose = False ):Loads the technique with parameter on the given device channel.create_parameter( name, value, index, kind = None ):Creates an EccParam struct.update_paramters( idn, ch, technique, params, tech_index = 0 ):Updates the paramters of a technique on teh given device channel.cast_parameters( parameters, types ):Cast parameters to given types.start_channel( idn, ch ):Starts the given device channel.start_channels( idn, ch ):Starts the given device channels.stop_channel( idn, ch ):Stops the given device channel.stop_channels( idn, chs ):Stops the given device channels.get_values( idn, ch ):Gets the current values and states of the given device channel.raise_exception( err ):Raises an exception based on a calls error code.is_in_SP300_family( device_code ):Determines if the given device is in the SP300 device family.Enum ClassesDeviceCodes:Device code for identifying model.Values: [ KBIO_DEV_VMP, KBIO_DEV_VMP2, KBIO_DEV_MPG, KBIO_DEV_BISTAT, KBIO_DEV_MCS_200, KBIO_DEV_VMP3, KBIO_DEV_VSP, KBIO_DEV_HCP803, KBIO_DEV_EPP400, KBIO_DEV_EPP4000, KBIO_DEV_BISTAT2, KBIO_DEV_FCT150S, KBIO_DEV_VMP300, KBIO_DEV_SP50, KBIO_DEV_SP150, KBIO_DEV_FCT50S, KBIO_DEV_SP300, KBIO_DEV_CLB500, KBIO_DEV_HCP1005, KBIO_DEV_CLB2000, KBIO_DEV_VSP300, KBIO_DEV_SP200, KBIO_DEV_MPG2, KBIO_DEV_ND1, KBIO_DEV_ND2, KBIO_DEV_ND3, KBIO_DEV_ND4, KBIO_DEV_SP240, KBIO_DEV_MPG205, KBIO_DEV_MPG210, KBIO_DEV_MPG220, KBIO_DEV_MPG240, KBIO_DEV_UNKNOWN ]DeviceCodeDescriptions:Description of DeviceCodes.Values: [ KBIO_DEV_VMP, KBIO_DEV_VMP2, KBIO_DEV_MPG, KBIO_DEV_BISTAT, KBIO_DEV_MCS_200, KBIO_DEV_VMP3, KBIO_DEV_VSP, KBIO_DEV_HCP803, KBIO_DEV_EPP400, KBIO_DEV_EPP4000, KBIO_DEV_BISTAT2, KBIO_DEV_FCT150S, KBIO_DEV_VMP300, KBIO_DEV_SP50, KBIO_DEV_SP150, KBIO_DEV_FCT50S, KBIO_DEV_SP300, KBIO_DEV_CLB500, KBIO_DEV_HCP1005, KBIO_DEV_CLB2000, KBIO_DEV_VSP300, KBIO_DEV_SP200, KBIO_DEV_MPG2, KBIO_DEV_ND1, KBIO_DEV_ND2, KBIO_DEV_ND3, KBIO_DEV_ND4, KBIO_DEV_SP240, KBIO_DEV_MPG205, KBIO_DEV_MPG210, KBIO_DEV_MPG220, KBIO_DEV_MPG240, KBIO_DEV_UNKNOWN ]IRange:Current ranges.Values: [ p100, n1, n10, n100, u1, u10, u100, m1, m10, m100, a1, KEEP, BOOSTER, AUTO ]ERange:Voltage ranges.Values: [ v2_5, v5, v10, AUTO ]ElectrodeConnection:Whether the electrode is in standard or grounded mode.Values: [ STANDARD, GROUNDED ]ChannelMode:Whether the device is floating or grounded.Values: [ GROUNDED, FLOATING ]TechniqueId:ID of the technique. (Not fully implemented.)Values: [ NONE, OCV, CA, CP, CV, PEIS, CALIMIT ]ChannelState:State of the channel.Values: [ STOP, RUN, PAUSE ]ParameterType:Type of a parameter.Values: [ INT32, BOOLEAN, SINGLE, FLOAT ]
(FLOAT is an alias of SINGLE.)StructuresDeviceInfo:Information representing the device. Used byconnect().Fields: [ DeviceCode, RAMSize, CPU, NumberOfChannles, NumberOfSlots, FirmwareVersion, FirmwareDate_yyyy, FirmwareDate_mm, FirmwareDate_dd, HTdisplayOn, NbOfConnectedPC ]ChannelInfo:Information representing a device channel. Used bychannel_info().Fields: [ Channel, BoardVersion, BoardSerialNumber, FirmwareVersion, XilinxVersion, AmpCode, NbAmps, Lcboard, Zboard, RESERVED, MemSize, State, MaxIRange, MinIRange, MaxBandwidth, NbOfTechniques ]HardwareConf:Hardware configuration information for a channel.Fields: [ Conn, Ground ]EccParam:A technique parameter.Fields: [ ParamStr, ParamType, ParamVal, ParamIndex ]EccParams:A bundle of technique parameters.Fields: [ len, pParams ]CurrentValues:Values measured from and states of the device.Fields: [ State, MemFilled, TimeBase, Ewe, EweRangeMin, EweRangeMax, Ece, EceRangeMin, EceRangeMax, Eoverflow, I, IRange, Ioverflow, ElapsedTime, Freq, Rcomp, Saturation, OptErr, OptPos ]DataInfo:Metadata of measured data.Fields: [ IRQskipped, NbRows, NbCols, TechniqueIndex, TechniqueID, processIndex, loop, StartTime, MuxPad ]ConstantsVMP3_DEVICE_FAMILY:Set of DeviceCodes in the VMP3 device family.{ DeviceCodes.KBIO_DEV_VMP2, DeviceCodes.KBIO_DEV_VMP3, DeviceCodes.KBIO_DEV_BISTAT, DeviceCodes.KBIO_DEV_BISTAT2, DeviceCodes.KBIO_DEV_MCS_200, DeviceCodes.KBIO_DEV_VSP, DeviceCodes.KBIO_DEV_SP50, DeviceCodes.KBIO_DEV_SP150, DeviceCodes.KBIO_DEV_FCT50S, DeviceCodes.KBIO_DEV_FCT150S, DeviceCodes.KBIO_DEV_CLB500, DeviceCodes.KBIO_DEV_CLB2000, DeviceCodes.KBIO_DEV_HCP803, DeviceCodes.KBIO_DEV_HCP1005, DeviceCodes.KBIO_DEV_MPG2, DeviceCodes.KBIO_DEV_MPG205, DeviceCodes.KBIO_DEV_MPG210, DeviceCodes.KBIO_DEV_MPG220, DeviceCodes.KBIO_DEV_MPG240 }SP300_DEVICE_FAMILY:Set of DeviceCodes in the SP300 device family.{ DeviceCodes.KBIO_DEV_SP200, DeviceCodes.KBIO_DEV_SP300, DeviceCodes.KBIO_DEV_VSP300, DeviceCodes.KBIO_DEV_VMP300, DeviceCodes.KBIO_DEV_SP240 }Data ParserParses data received from a technique and contains technique fields for different device types.Methodsparse( data, info, fields = None, device = None ):Parses data received from a technique.calculate_time( t_high, t_low, data_info, current_value ):Calculates elapsed time from time data.ClassesVMP3_Fields:Contains technqiue fields for VMP3 devices.
(Not all techniques are implemented)
Properties: [ OCV, CP, CA, CPLIMIT, CALIMIT, CV, PEIS ]SP300_Fields:Contains technqiue fields for SP-300 devices.
(Not all techniques are implemented)
Properties: [ OCV, CP, CA, CPLIMIT, CALIMIT, CV, PEIS ]EC FindImplements the BL Find DLL.MethodsAll BL Find DLL functions are implemented under the same name.find_devices( connection = None ):Finds conencted devices.Technique FieldsParameter types for techniques. (Not all techniques are implemented.)ClassesOCVCVCACALIMITEC ErrorsImplements EC errors.ClassesEcError( value = None, code = None, message = None )ExampleA basic example running an MPP program on channels 0 - 7 for 10 minutes.importeasy_biologicaseblimporteasy_biologic.base_programsasblp# create devicebl=ebl.BiologicDevice('192.168.1.2')# create mpp programparams={'run_time':10*60}mpp=blp.MPP(bl,params,channels=[0,1,2,3,4,5,6])# run programmpp.run('data')