echemdbconverters.eclabloader
Loads MPT files recorded with the EC-Lab software from BioLogic for BioLogic potentiostats.
EXAMPLES:
The file can be loaded with the ECLabLoader:
>>> from io import StringIO
>>> file = StringIO('''EC-Lab ASCII FILE
... Nb header lines : 6
...
... Device metadata : some metadata
...
... mode\ttime/s\tEwe/V\t<I>/mA\tcontrol/V
... 2\t0\t0.1\t0\t0
... 2\t1\t1.4\t5\t1
... ''')
>>> eclab_csv = ECLabLoader(file)
>>> eclab_csv.df
mode time/s Ewe/V <I>/mA control/V
0 2 0 0.1 0 0
1 2 1 1.4 5 1
The file can also be loaded from the base loader:
>>> from io import StringIO
>>> file = StringIO('''EC-Lab ASCII FILE
... Nb header lines : 6
...
... Device metadata : some metadata
...
... mode\ttime/s\tEwe/V\t<I>/mA\tcontrol/V
... 2\t0\t0.1\t0\t0
... 2\t1\t1.4\t5\t1
... ''')
>>> from echemdbconverters.csvloader import CSVloader
>>> csv = CSVloader.create('eclab')(file)
>>> csv.df
mode time/s Ewe/V <I>/mA control/V
0 2 0 0.1 0 0
1 2 1 1.4 5 1
>>> csv.header
['EC-Lab ASCII FILE\n', 'Nb header lines : 6\n', '\n', 'Device metadata : some metadata\n', '\n']
>>> csv.column_names
['mode', 'time/s', 'Ewe/V', '<I>/mA', 'control/V']
- class echemdbconverters.eclabloader.ECLabLoader(file)
Loads BioLogic EC-Lab MPT files.
EXAMPLES:
>>> from io import StringIO >>> file = StringIO('''EC-Lab ASCII FILE ... Nb header lines : 6 ... ... Device metadata : some metadata ... ... mode\ttime/s\tEwe/V\t<I>/mA\tcontrol/V ... 2\t0\t0.1\t0\t0 ... 2\t1\t1.4\t5\t1 ... ''') >>> from echemdbconverters.csvloader import CSVloader >>> csv = CSVloader.create('eclab')(file) >>> csv.df mode time/s Ewe/V <I>/mA control/V 0 2 0 0.1 0 0 1 2 1 1.4 5 1 >>> csv.header ['EC-Lab ASCII FILE\n', 'Nb header lines : 6\n', '\n', 'Device metadata : some metadata\n', '\n'] >>> csv.column_names ['mode', 'time/s', 'Ewe/V', '<I>/mA', 'control/V']
- property decimal
Returns the decimal separator in the MPT, which depends on the language settings of the operating system running the software.
EXAMPLES:
>>> from io import StringIO >>> file = StringIO('''EC-Lab ASCII FILE ... Nb header lines : 6 ... ... Device metadata : some metadata ... ... mode\ttime/s\tEwe/V\t<I>/mA\tcontrol/V ... 2\t0\t0,1\t0\t0 ... 2\t1\t1,4\t5\t1 ... ''') >>> from echemdbconverters.csvloader import CSVloader >>> ec = CSVloader.create('eclab')(file) >>> ec.decimal ','
- property df
A pandas dataframe with the data of the EC-Lab MPT file.
EXAMPLES:
>>> from io import StringIO >>> file = StringIO('''EC-Lab ASCII FILE ... Nb header lines : 6 ... ... Device metadata : some metadata ... ... mode\ttime/s\tEwe/V\t<I>/mA\tcontrol/V ... 2\t0\t0.1\t0\t0 ... 2\t1\t1.4\t5\t1 ... ''') >>> from echemdbconverters.csvloader import CSVloader >>> csv = CSVloader.create('eclab')(file) >>> csv.df mode time/s Ewe/V <I>/mA control/V 0 2 0 0.1 0 0 1 2 1 1.4 5 1
- property header_lines
The number of header lines of an EC-Lab MPT file without column names. The number is provided in the header of the MPT file, which contains, however, also the line with the data column names.
EXAMPLES:
>>> from io import StringIO >>> file = StringIO('''EC-Lab ASCII FILE ... Nb header lines : 6 ... ... Device metadata : some metadata ... ... mode\ttime/s\tEwe/V\t<I>/mA\tcontrol/V ... 2\t0\t0.1\t0\t0 ... 2\t1\t1.4\t5\t1 ... ''') >>> from echemdbconverters.csvloader import CSVloader >>> csv = CSVloader.create('eclab')(file) >>> csv.header_lines 5