Skip to content

EISFitpython.data_extraction

This module finds and reads data files. It also stacks, trims and splits the data.

from EISFitpython import data_extraction as data

Each reader returns a frequency array and a complex impedance array. The readers do not change the sign of the imaginary part in the file.

get_eis_files

get_eis_files(base_path=".", subfolder=None)

Returns a list of the files in base_path/subfolder. Without subfolder, the function uses base_path. The list has the order of the file names. The function prints the number of files and their names.

readNEISYS

readNEISYS(filename)

Reads a text export of the NEISYS spectrometer. Returns (f, Z).

parse_NEISYS_data

parse_NEISYS_data(lines)

Reads NEISYS data from a list of text lines. readNEISYS uses this function. A data line has three numbers with tabs between them: frequency, real part and imaginary part. The function ignores all other lines, for example the header.

Returns (f, Z) as NumPy arrays.

readTXT

readTXT(filename)

Reads a text file with three columns: frequency, real part and imaginary part. The separator can be a tab, a comma or spaces. The function ignores empty lines and header lines with words such as freq, hz, real, imag or z.

Returns (f, Z) as NumPy arrays.

readCSV

readCSV(filename)

Reads a CSV file with a minimum of three columns: frequency, real part and imaginary part. The separator can be a comma or a semicolon. The file must not have a header line.

Returns (f, Z) as NumPy arrays.

stack_NEISYS_files

stack_NEISYS_files(filenames, return_lengths=False)

Reads the NEISYS files in the order of the list and connects their data.

return_lengths Result
False (f, Z)
True (f, Z, lengths). lengths[i] is the number of data points of filenames[i]

stack_TXT_files

stack_TXT_files(filenames)

Reads each file with readTXT and connects the data. Returns (f, Z).

stack_CSV_files

stack_CSV_files(filenames)

Reads each file with readCSV and connects the data. Returns (f, Z).

trim_data

trim_data(f, Z, fmin=None, fmax=None)

Returns (f_trimmed, Z_trimmed) with the points from fmin to fmax. The two limits are part of the range. None for a limit means no limit on that side. f and Z must be NumPy arrays.

split_array

split_array(f, Z=None, split_freq=None, lengths=None)

Divides stacked data into one array for each spectrum.

Parameter Type Description
f one-dimensional array Stacked frequencies.
Z array or None Stacked impedance values.
split_freq float or None Frequency at which a new spectrum starts. The function uses it only if it finds no sweep start.
lengths sequence of int or None Number of points of each spectrum. Use it if it is available.

With lengths, the function splits at these point counts. The sum of lengths must be equal to the number of points. If it is not equal, the function gives a ValueError.

Without lengths, the function splits at each point where a new frequency sweep starts.

Returns (sublists_f, sublists_Z), two lists of arrays. sublists_Z is empty if Z is None.