Import Data
EIS - Electrochemical Impedance Spectra
Measurement Data
- class IsmImport(filename: str | bytes | bytearray)
Class to be able to read .ism file formats with Python.
By default, the data tracks contain the range between the reversal frequency and the end frequency.
The class contains getters that can be used to read out the available meta data for the measurement. These are mostly strings that can be freely assigned by the user, so there is no automatic conversion to floating point numbers.
- Parameters:
file – The path to the ism file, or the ism file as bytes or bytearray.
- getNumberOfSamples() int
Returns the complete number of samples.
This function returns the number of samples in the ism file.
- Returns:
Number of total samples.
- getFrequencyArray(includeDoubleFrequencies: bool = False) ndarray
Get the frequency points from the measurement.
- Parameters:
includeDoubleFrequencies – If True, all measurement data are returned, if False, only the largest non-overlapping area is returned. Defaults to False.
- Returns:
Numpy array with the frequency points.
- getImpedanceArray(includeDoubleFrequencies: bool = False) ndarray
Get the impedance points from the measurement.
- Parameters:
includeDoubleFrequencies – If True, all measurement data are returned, if False, only the largest non-overlapping area is returned. Defaults to False.
- Returns:
Numpy array with the impedance points.
- getPhaseArray(degree: bool = False, includeDoubleFrequencies: bool = False) ndarray
Get the phase points from the measurement.
- Parameters:
degree – True for phase in degree, default radiant.
includeDoubleFrequencies – If True, all measurement data are returned, if False, only the largest non-overlapping area is returned. Defaults to False.
- Returns:
Numpy array with the phase points as radiant.
- getComplexImpedanceArray(includeDoubleFrequencies: bool = False) ndarray
Get the complex impedance points from the measurement.
- Parameters:
includeDoubleFrequencies – If True, all measurement data are returned, if False, only the largest non-overlapping area is returned. Defaults to False.
- Returns:
Numpy array with the complex impedance points.
- getSignificanceArray(includeDoubleFrequencies: bool = False) ndarray
Get the significance points from the measurement.
- Parameters:
includeDoubleFrequencies – If True, all measurement data are returned, if False, only the largest non-overlapping area is returned. Defaults to False.
- Returns:
Numpy array with the significance points.
- getMeasurementDateTimeArray(includeDoubleFrequencies: bool = False) ndarray
Get the timestamps from the measurement.
- Parameters:
includeDoubleFrequencies – If True, all measurement data are returned, if False, only the largest non-overlapping area is returned. Defaults to False.
- Returns:
Numpy array with the datetime objects.
- getMeasurementStartDateTime() datetime
Get the start date time of the measurement.
Returns the start datetime of the measurement.
- Returns:
datetime object with the start time of the measurement.
- getMeasurementEndDateTime() datetime
Get the end date time of the measurement.
Returns the end datetime of the measurement.
- Returns:
datetime object with the end time of the measurement.
- save(filename)
Save the impedance data.
Only the binary file content that has been read is saved. If the data is edited, this is not saved.
- Parameters:
filename – Path and filename of the file to be saved with the extension .ism.
- getFileName() str
Get the name of the file.
- Returns:
The filename if the file was opened or “FromBytes.ism” if it was created from bytearrays.
- getBinaryFileContent() bytearray
Get the content of the file binary.
Returns the file contents as a binary byte array.
- Returns:
bytearray with the file content.
- getMetaData() bytearray
Get the meta data of the file binary.
Returns the file contents as a binary byte array.
- Returns:
bytearray with the file content.
- getTrackTypesList() list[str]
Get a list with the different data tracks.
If current and voltage were also measured, the tracks have the following names, for example:
Voltage/V
Current/A
- Returns:
List with the track names.
- getTrack(track: str, includeDoubleFrequencies: bool = False) ndarray
Returns an array with the points for the given track.
- Parameters:
track – name of the track.
includeDoubleFrequencies – If True, all measurement data are returned, if False, only the largest non-overlapping area is returned. Defaults to False.
- Returns:
Numpy array with the track.
- getSystemString() str
Get the optional user-defined string describing the chemical system.
- Returns:
Returns the user-defined system string.
- getStartVoltageString() str
Get measured voltage before the measurement, may be indicated with amplitudes.
- Returns:
String with dc value and optionally amplitude.
- getStartCurrentString() str
Get measured current before the measurement, may be indicated with amplitudes.
- Returns:
String with dc value and optionally amplitude.
- getStartTemperatureString() str
Get the start temperature string.
This string only contains a meaningful value if a TEMP-U or TEMP-U2 card with temperature sensor is plugged in and configured correctly.
- Returns:
String with the value.
- getTimeWindowString() str
Get the string with the time window of the measurement.
- Returns:
String with the value.
- getCommentStrings() str
Get the string with the 4 possible user-defined comment lines.
- Returns:
The 4 comment lines separated by \n.
- getElectrodeAreaString() str
Get the optional user-defined electrode area string.
- Returns:
String with the value.
- getAmplitude() float
Get the amplitude used for the measurement.
- Returns:
Amplitude as float in V or A.
Models/Circuits
- class IsfxModelImport(xmlFilePath: str = None, xmlString: str = None)
Class to import model/circuits.
The models must be in zahner isfx xml format. Either you pass the filename of the model you want to open or you pass the content of the file as a string.
- Parameters:
xmlFilePath – The file path of the isfx model file.
xmlString – The model as a string or the content of an isfx file.
- toString() str
Create string with all circuit elements of the model.
print(IsfxModelImport(…)) generates for example the following string:
Model: li-ion-model - fitted: inductor : L0 L: 7.940e-07 H fixed: False finite-diffusion : FI0 W: 4.073e-02 Ωs^(-½) fixed: False k: 1.385e-03 1/s fixed: False constant-phase-element : CPE0 C_eq: 6.733e-02 F fixed: False α: 7.361e-01 fixed: False f_norm: 1.000e+03 Hz fixed: True capacitor : C0 C: 5.025e-02 F fixed: False resistor : R0 R: 3.603e-03 Ω fixed: False resistor : R1 R: 2.683e-02 Ω fixed: False resistor : R2 R: 3.597e-02 Ω fixed: False
- Returns:
String with all circuit elements.
- getCircuitElementByName(name: str) IsfxModelElement
Returns an element of the circuit.
This function is used by the [] operator. Instead of this getter you can also use the [] operator wi in the following example.
impedanceCircuitModel = IsfxModelImport(r"diode-ac-model.isfx") print(impedanceCircuitModel["R0"]["R"].getValue())
- Returns:
The circuit element.
- getCircuitElements() list[IsfxModelElement]
Returns all circuit elements as an array.
- Returns:
The circuit elements.
- save(filename: str)
Save the model.
The model is saved with this function. The isfx file format contains xml.
- Parameters:
filename – Path and filename of the file to be saved with the extension .isfx.
- getFileName() str
Returns the filename.
If the model was created from the disk, then the filename is returned, otherwise the name attribute from the xml is returned. If the xml name attribute is an empty string “FromString.isfx” is returned.
- Returns:
The name.
- getBinaryFileContent() bytearray
Get the content of the file binary.
Returns the file contents as a binary byte array.
- Returns:
bytearray with the file content.
- class IsfxModelElement(xmlElement)
Classe which represents the circuit elements.
This constructor is only used by the class IsfxModelImport.
- Parameters:
xmlElement – The circuit element.
- getParameterByName(name: str) IsfxModelElementParameter
Returns an parameter of an circuit element.
This function is used by the [] operator. Instead of this getter you can also use the [] operator with in the following example.
impedanceCircuitModel = IsfxModelImport(r"diode-ac-model.isfx") print(impedanceCircuitModel["R0"]["R"].getValue())
Each resistor has a parameter “R”. Young Goehr impedances, for example, have the parameters C, p and T.
- Returns:
The circuit element parameter.
- getParameters() list[IsfxModelElementParameter]
Returns all parameters of the circuit element as an array.
- Returns:
The parameters.
- getName() str
Returns the name of the circuit element.
The name is the one assigned in the GUI, for example R0 or CPE7.
- Returns:
Name of the circuit element.
- getType() str
Returns the type of the circuit element.
- Returns:
Type of the circuit element.
- class IsfxModelElementParameter(elementXML, xmlParentTag=None)
Class which represents a parameter of a circuit element.
This constructor is only used by the class IsfxModelElement.
- Parameters:
xmlElement – The parameter.
xmlParentTag – The parent circuit element tag.
- getName() str
Returns the name of the parameter.
- Returns:
The name.
- getUnit() str
Returns the unit of the parameter.
- Returns:
The unit.
- getValue() float
Returns the value of the parameter.
- Returns:
The value.
- isFixed() bool
Returns the fixed state of the parameter.
If the parameter is fixed, then it is no longer changed by the fitter.
- Returns:
True when the value is fixed, else False.
- _parameterToString() str
Returns informations about the parameter as string.
- Returns:
A string with informations.
CV - Cyclic Voltammetry
Measurement Data
- class IscImport(filename)
Class to be able to read out isc files (CV).
This class extracts the data from the isc files.
The following code example shows how the ACQ data can be read out:
cvData = IscImport(r".\CV_32_acq_channels.isc") # read the file print(cvData.getAcqChannelNamesList()) # print available channels print(cvData.getAcqChannelUnitsList()) # print available units print(cvData.getAcqDecoded()) # read the flag for the ACQ status desiredAcqChannel = cvData.getAcqChannelNamesList()[ 1 ] # pick one acq channel by ChannelName print(f"data for channel: {desiredAcqChannel}") print( cvData.getAcqChannel(desiredAcqChannel)[0:10] ) # get the data for this channel
Output of the previous snippet:
['TC: K; V= 201', 'TC: K; V= 201-1', 'Pot1', 'Pot2', 'Reference', 'NTC', 'Voltage', 'Voltage-1', 'voltage', 'TC: K; V= 201-2', 'TC: K; V= 201-3', 'Pot1-1', 'Pot2-1', '', '-1', '-2', '-3', '-4', '-5', '-6', '-7', '-8', '-9', '-10', '-11', '-12', '-13', '-14', '-15', '-16', '-17', '-18'] ['CC', 'C', 'V', 'V', 'C', 'C', 'V', 'V', 'V', 'CC', 'C', 'V', 'V', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] True data for channel: TC: K; V= 201-1 [8.554705 8.44567554 8.4188244 8.40748142 8.41311547 8.41441981 8.4115903 8.40405186 8.39793716 8.40518822]
- Parameters:
file (str, bytes, bytearray) – The path to the isc file, or the isc file as bytes or bytearray.
- time
only new CV format with 32 ACQ channels
- getAcqDecoded() None | bool
returns the status of the decoded ACQ data, for debugging purposes, as the ACQ format is complex and could cause problems.
- Returns:
None if no ACQ data is available, or True if it could be decoded or False if not.
- getAcqChannelNamesList() list[str]
returns a list with the different data tracks.
- Returns:
List with the track names.
- getAcqChannelUnitsList() list[str]
returns a list with the different data tracks.
- Returns:
List with the track names.
- getAcqChannel(track: str) list[float]
returns an array with the points for the given track.
- Parameters:
track – name of the track
- Returns:
Numpy array with the track.
- getMeasurementStartDateTime() datetime
Get the start date time of the measurement.
Returns the start datetime of the measurement.
- Returns:
datetime object with the start time of the measurement.
- getMeasurementEndDateTime() datetime
Get the end date time of the measurement.
Returns the end datetime of the measurement.
- Returns:
datetime object with the end time of the measurement.
- getTimeArray() ndarray
Reading the measurement time stamps.
- Returns:
Numpy array with the time points.
- getCurrentArray() ndarray
Reading the measurement current points.
- Returns:
Numpy array with the current points.
- getVoltageArray() ndarray
Reading the measurement voltage points.
- Returns:
Numpy array with the voltage points.
- getScanRate() ndarray
Read the scan rate or slew rate.
- Returns:
The scan rate in V/s.
- save(filename)
Save the cv data.
Only the binary file content that has been read is saved. If the data is edited, this is not saved.
- Parameters:
filename – Path and filename of the file to be saved with the extension .ism.
- getFileName() str
Get the name of the file.
- Returns:
The filename if the file was opened or “FromBytes.isc” if it was created from bytearrays.
- getBinaryFileContent() bytearray
Get the content of the file binary.
Returns the file contents as a binary byte array.
- Returns:
bytearray with the file content.
I/E - Current Voltage Curves
Measurement Data
- class IssImport(filename)
Class to be able to read out iss files (I/E, Current Voltage Curves).
This class extracts the data from the iss files.
- Parameters:
file (str, bytes, bytearray) – The path to the iss file, or the iss file as bytes or bytearray.
- getMeasurementStartDateTime() datetime
Get the start date time of the measurement.
Returns the start datetime of the measurement.
- Returns:
datetime object with the start time of the measurement.
- getMeasurementEndDateTime() datetime
Get the end date time of the measurement.
Returns the end datetime of the measurement.
- Returns:
datetime object with the end time of the measurement.
- getTimeArray() ndarray
Reading the measurement time stamps.
- Returns:
Numpy array with the time points.
- getCurrentArray() ndarray
Reading the measurement current points.
- Returns:
Numpy array with the current points.
- getVoltageArray() ndarray
Reading the measurement voltage points.
- Returns:
Numpy array with the voltage points.
- save(filename)
Save the cv data.
Only the binary file content that has been read is saved. If the data is edited, this is not saved.
- Parameters:
filename – Path and filename of the file to be saved with the extension .ism.
- getFileName() str
Get the name of the file.
- Returns:
The filename if the file was opened or “FromBytes.isc” if it was created from bytearrays.
- getBinaryFileContent() bytearray
Get the content of the file binary.
Returns the file contents as a binary byte array.
- Returns:
bytearray with the file content.
Polarisation Measurement
Measurement Data
- class IswImport(filename)
Class to be able to read out Isw files (POL).
This class extracts the data from the Isw files.
- Parameters:
file (str, bytes, bytearray) – The path to the Isw file, or the Isw file as bytes or bytearray.
- getTimeArray() ndarray
Reading the measurement time stamps.
- Returns:
Numpy array with the time points.
- getCurrentArray() ndarray
Reading the measurement current points.
- Returns:
Numpy array with the current points.
- getVoltageArray() ndarray
Reading the measurement voltage points.
- Returns:
Numpy array with the voltage points.
- getFileName() str
Get the name of the file.
- Returns:
The filename if the file was opened or “FromBytes.isw” if it was created from bytearrays.
DCSequencer - Current and Voltage Profiles
Measurement Data
- class SeqTxtImport(filename: str | bytes | bytearray)
Class to be able to read the sequence text files.
The following lines show a short example how to read all data tracks including ACQ channels.
imp = SeqTxtImport(r"C:/THALES/sequence.txt") tracks = imp.getTrackTypesList() dataTracks = {} for track in tracks: dataTracks[track] = imp.getTrack(track) time = imp.getTrack("Time/s") u = imp.getTrack("E/V") i = imp.getTrack("I/A")
- Parameters:
file (str, bytes, bytearray) – The path to the txt file, or the txt file as bytes or bytearray.
- getTrackTypesList() list[str]
returns a list with the different data tracks.
- Returns:
List with the track names.
- getTrack(track: str) list[float]
returns an array with the points for the given track.
- Parameters:
track – name of the track
- Returns:
Numpy array with the track.
- save(filename)
Save the cv data.
Only the binary file content that has been read is saved. If the data is edited, this is not saved.
- Parameters:
filename – Path and filename of the file to be saved with the extension .txt.
- getFileName() str
Get the name of the file.
- Returns:
The filename if the file was opened or “FromBytes.txt” if it was created from bytearrays.
- getBinaryFileContent() bytearray
Get the content of the file binary.
Returns the file contents as a binary byte array.
- Returns:
bytearray with the file content.