bicarlsen / easy-biologic

Python library for communicating with Biologic devices.
GNU General Public License v3.0
18 stars 11 forks source link

KeyError: 'duration' #12

Closed Cdriko closed 2 years ago

Cdriko commented 2 years ago

hello, I try to use the lib with a VSP300. I installed easy_biologic Version 0.3.2 via pip

And I have an error while performing an exemple PEIS measure

File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\base_programs.py", line 1148, in run 'Duration_step': ch_params[ 'duration' ], KeyError: 'duration'

any idea?

keyErrorDuration.zip

Cdriko commented 2 years ago

note that the program params don't contain a 'duration' value :

params = {
        'voltage':0,
        'amplitude_voltage':0.05,
        'initial_frequency':1E+6,
        'final_frequency':0.05,
        'frequency_number':10,#decade=log(Dfreq)
        'repeat':2,
        'wait': 0.1,

    }
bicarlsen commented 2 years ago

I believe this is happening because you need to pass in a duration parameter to the program.

Cdriko commented 2 years ago

still don't works With the following script


def recieve_data(the_data):
    print("recieve data handler")
    print(the_data)

if __name__ == "__main__":
    ''' perform a test mesure'''
    import easy_biologic as ebl
    import easy_biologic.base_programs as blp

    #from easy_biologic.device import BiologicDevice
    from easy_biologic.lib.ec_lib import ChannelMode, ElectrodeConnection

    # create pei program    
    params = {
        'voltage':0,
        'amplitude_voltage':0.05,
        'initial_frequency':1E+6,
        'final_frequency':0.05,
        'frequency_number':10,#decade=log(Dfreq)
        'repeat':2,
        'wait': 0.1,
        'duration':100,

    }

    print(params)

    '''python -m easy_biologic.find_devices'''
    # create device
    print("connecting..")
    bl = ebl.BiologicDevice(  '192.109.209.128' )

    bl.connect()
    print("---------------------------------------------")
    print("VSP300 is connected = "+str(bl.is_connected()))

    print(" kind : "+str(bl.kind))
    print("FirmWareVersion : ")
    print( bl.info.FirmwareVersion)

    #set channel configuration
    #bl.set_channel_configuration( 5,  ChannelMode.GROUNDED , ElectrodeConnection.STANDARD )

    pei = blp.PEIS(
        bl,
        params,     
        channels = [ 5 ]        
    )

    #register callback data ufunction
    pei.on_data(recieve_data)

    # run program
    pei.run()  

it give :

{'voltage': 0, 'amplitude_voltage': 0.05, 'initial_frequency': 1000000.0, 'final_frequency': 0.05, 'frequency_number': 10, 'repeat': 2, 'wait': 0.1, 'duration': 100}
connecting..
---------------------------------------------
VSP300 is connected = True
 kind : DeviceCodes.KBIO_DEV_VSP300
FirmWareVersion :
1136
Traceback (most recent call last):
  File "D:\debugVSP300\VSP300.py", line 60, in <module>
    pei.run()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\base_programs.py", line 1163, in run
    data = self._run( 'peis', params, retrieve_data = retrieve_data )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\program.py", line 483, in _run
    self.device.load_technique(
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\device.py", line 298, in load_technique
    ecl.load_technique(
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\lib\ec_lib.py", line 972, in load_technique
    validate( err )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\lib\ec_lib.py", line 1564, in validate
    raise EcError( err )
easy_biologic.lib.ec_errors.EcError: ERR_TECH_INCOMPATIBLEECC (-401): Ecc file not compatible with the channel firmware.
bicarlsen commented 2 years ago

This is a different error having to do with the compatibility of the firmware on the machine and the version of the PEIS file being run. By default easy-biologic uses version 6.04 of the techniques, but also includes vresion 6.01 and 5.35. I don't know what the compatibility with your firmware version and the provdied technqiue versions are, you'll have to find that information out yourself.

If your firmware on the machine isn't up to date, and it's possible for you to update, I would suggest that, as the default technique files should then work. If that is not possible for you you can modify which technique files are being used by modifying the technique_directory function in your install.

Cdriko commented 2 years ago

I updated the firmware of the VSP (now 11.40), and I try 6.04 , 6.01 and 5.35 technique version as you explained, but the result is the same. (note that the VSP is quite new)

Technique version : 5.35
{'voltage': 0, 'amplitude_voltage': 0.05, 'initial_frequency': 1000000, 'final_frequency': 0.05, 'frequency_number': 10, 'duration': 100}
connecting..
---------------------------------------------
VSP300 is connected = True
 kind : DeviceCodes.KBIO_DEV_VSP300
FirmWareVersion :
1140
HardwareConfiguration(connection=<ElectrodeConnection.STANDARD: 0>, mode=<ChannelMode.GROUNDED: 0>)
ChannelFirmware :
5
Traceback (most recent call last):
  File "C:\Users\Admin\Installation\ImpedanceComplexe\impedance-complexe\Software\main\debugVSP300\VSP300.py", line 63, in <module>
    pei.run()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\base_programs.py", line 1163, in run
    data = self._run( 'peis', params, retrieve_data = retrieve_data )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\program.py", line 483, in _run
    self.device.load_technique(
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\device.py", line 298, in load_technique
    ecl.load_technique(
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\lib\ec_lib.py", line 972, in load_technique
    validate( err )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\lib\ec_lib.py", line 1564, in validate
    raise EcError( err )
easy_biologic.lib.ec_errors.EcError: ERR_TECH_INCOMPATIBLEECC (-401): Ecc file not compatible with the channel firmware.
bicarlsen commented 2 years ago

I am not sure how to resolve the issue, so have contacted the BioLogic support team to see if they can give some advice.

Cdriko commented 2 years ago

I have contacted Biologic staff, but waiting the response, I try to had print("technic Params"+str(params)) in device.py load_technique. I get :

technic Params{
'vs_initial': False, 
'vs_final': False, 
'Initial_Voltage_step': 0.0, 
'Final_Voltage_step': 0.0, 
'Duration_step': 10.0, 
'Step_number': 0, 
'Record_every_dT': 1.0, 
'Record_every_dI': 0.001, 
'Final_frequency': 0.05, 
'Initial_frequency': 1000000.0, 
'sweep': False, 
'Amplitude_Voltage': 0.05, 
'Frequency_number': 10, 
'Average_N_times': 1, 
'Correction': False, 
'Wait_for_steady': 0.0
}

Maybe 'Step_number' should don't be at zero, no ?

bicarlsen commented 2 years ago

I believe the Step_number is correct given your parameters. From the documentation

Step_number | Number of steps minus 1 -- Sec. 7.11.2, EC-Lab Development Package - Version 6.00

And you have only given one step.

I also think that if that were the case it would throw an error ERR_GEN_INVALIDPARAMETERS (-4).

Cdriko commented 2 years ago

Hello . I Have progressed . I made two modifications in the code :

device.py line 296 :

#technique = ecl.technique_file( technique, self.kind )

(avoid double call to ecl.technique_file)

ec_lib.py ligne 1601 :

device is DeviceCodes.KBIO_DEV_SP300 or DeviceCodes.KBIO_DEV_VSP300 and

With this config, I succes to launch a PEIS measure, but it's while reading result that I'have a problem :

>python VSP300.py
Technique version : 6.04
Technique version : 6.04
{'voltage': 0, 'amplitude_voltage': 0.05, 'initial_frequency': 1000000, 'final_frequency': 0.05, 'frequency_number': 10, 'duration': 10}
connecting..
---------------------------------------------
VSP300 is connected = True
 kind : DeviceCodes.KBIO_DEV_VSP300
FirmWareVersion :
1140
HardwareConfiguration(connection=<ElectrodeConnection.STANDARD: 0>, mode=<ChannelMode.GROUNDED: 0>)
ChannelFirmware :
5
Traceback (most recent call last):
  File "C:\Users\Admin\Installation\ImpedanceComplexe\impedance-complexe\Software\main\debugVSP300\VSP300.py", line 63, in <module>
    pei.run('data')
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\base_programs.py", line 1163, in run
    data = self._run( 'peis', params, retrieve_data = retrieve_data )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\program.py", line 493, in _run
    asyncio.run( self._retrieve_data( read_interval ) )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\program.py", line 585, in _retrieve_data
    segments = await self._retrieve_data_segments( active_channels )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\program.py", line 553, in _retrieve_data_segments
    segments[ ch ] = await self._retrieve_data_segment( ch )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\program.py", line 510, in _retrieve_data_segment
    parsed = dp.parse(
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\lib\data_parser.py", line 81, in parse
    parsed = [
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\lib\data_parser.py", line 82, in <listcomp>
    Datum( *data[ i : i + cols ] ) for i in range( 0, rows* cols, cols )
TypeError: <lambda>() missing 1 required positional argument: 'current_range'

Maybe the data format of VSP300 is a bit different than SP300 devices ?

Cdriko commented 2 years ago

maybe the device version discrimination in ec_lib.py technique_file should be more generalist, as in the python example of the SDK : id_, device_info = api.Connect(address) (...) is_VMP3 = device_info.model in KBIO.VMP3_FAMILY

and tech_file = ocv3_tech_file if is_VMP3 else ocv4_tech_file

with : ` VMP3_FAMILY = ( "VMP2", "VMP3", "BISTAT", "BISTAT2", "MCS_200", "VSP", "SP50", "SP150", "FCT50S", "FCT150S", "CLB500", "CLB2000", "HCP803", "HCP1005", "MPG2", "MPG205", "MPG210", "MPG220", "MPG240", "VMP3E", "VSP3E", "SP50E", "SP150E", ) `

bicarlsen commented 2 years ago

Good to hear you've made progress :) I'm currently quite busy at work so won't have time to address this for the next few weeks. However, if you are able to fix the issue, please feel free to create a pull request.

Cdriko commented 2 years ago

ok I'll try that

Cdriko commented 2 years ago

Hello. I'm progessing : I've fixed ecc files and techniques fields discrimination by families of devices.

on my fork

Before doing a pull request, I've to fix a last (?) bug :

after the measure, the parsing fails : (it's verbose because I print the fields)

python test_VSP300.py
{'voltage': 0, 'amplitude_voltage': 0.05, 'initial_frequency': 1000000, 'final_frequency': 0.05, 'frequency_number': 10, 'duration': 10}
connecting..
---------------------------------------------
VSP300 is connected = True
 kind : DeviceCodes.KBIO_DEV_VSP300
FirmWareVersion :
1140
HardwareConfiguration(connection=<ElectrodeConnection.STANDARD: 0>, mode=<ChannelMode.GROUNDED: 0>)
ChannelFirmware :
5
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
([FieldInfo(name='t_high', type=<ParameterType.INT32: 0>), FieldInfo(name='t_low', type=<ParameterType.INT32: 0>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>)], [FieldInfo(name='frequency', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty1', type=<ParameterType.INT32: 0>), FieldInfo(name='abs_voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='abs_current_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='impendance_ce_phase', type=<ParameterType.SINGLE: 2>), FieldInfo(name='voltage_ce', type=<ParameterType.SINGLE: 2>), FieldInfo(name='empty2', type=<ParameterType.INT32: 0>), FieldInfo(name='empty3', type=<ParameterType.INT32: 0>), FieldInfo(name='time', type=<ParameterType.SINGLE: 2>), FieldInfo(name='current_range', type=<ParameterType.SINGLE: 2>)])
Traceback (most recent call last):
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\test_VSP300.py", line 63, in <module>
    pei.run('data')
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\easy_biologic\base_programs.py", line 1163, in run
    data = self._run( 'peis', params, retrieve_data = retrieve_data )
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\easy_biologic\program.py", line 493, in _run
    asyncio.run( self._retrieve_data( read_interval ) )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\easy_biologic\program.py", line 585, in _retrieve_data
    segments = await self._retrieve_data_segments( active_channels )
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\easy_biologic\program.py", line 553, in _retrieve_data_segments
    segments[ ch ] = await self._retrieve_data_segment( ch )
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\easy_biologic\program.py", line 510, in _retrieve_data_segment
    parsed = dp.parse(
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\easy_biologic\lib\data_parser.py", line 84, in parse
    parsed = [
  File "C:\Users\Admin\Documents\debugVSP300\easy-biologic\easy_biologic\lib\data_parser.py", line 85, in <listcomp>
    Datum( *data[ i : i + cols ] ) for i in range( 0, rows* cols, cols )
TypeError: <lambda>() missing 1 required positional argument: 'current_range'

Now it seems that the fields are the good ones, but the parsing bugs. Any idea ? Thanks Cédric

bicarlsen commented 2 years ago

Good to hear :)

I think the error is pretty clear. In easy_biologic.lib.data_parser#parse Datum is a namedtuple with fields set from either the passed in fields argument or implied from the passed in device argument. For one of the pieces of data attempting to be parsed the current_range FieldInfo doesn't exist. I suggest trying to print data just before the line causing the error to see what the error causing data looks like.

Cdriko commented 2 years ago

Done

bicarlsen commented 2 years ago

I will close this issue due to inactivity. If something else comes up, please feel free to open a new Issue.