EISFitpython.data_extraction¶
This module finds and reads data files. It also stacks, trims and splits the 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¶
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¶
Reads a text export of the NEISYS spectrometer. Returns (f, Z).
parse_NEISYS_data¶
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¶
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¶
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¶
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¶
Reads each file with readTXT and connects the data. Returns (f, Z).
stack_CSV_files¶
Reads each file with readCSV and connects the data. Returns (f, Z).
trim_data¶
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¶
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.