Skip to content
Snippets Groups Projects
Commit 9ab5a7a3 authored by Sudhanshu THAKUR's avatar Sudhanshu THAKUR
Browse files

modified formatter

parent ba7d42a8
Branches
No related tags found
1 merge request!39Draft: read_wakis function to read Impedance/wakepotential from wakis
......@@ -414,10 +414,12 @@ def read_wakis(file, component_type='long', divide_by=None, imp=True):
sep=r'\s+',
names=["Frequency", "Z"]) # read as string
df["Frequency"] = df["Frequency"].apply(lambda x: complex(x.strip("()"))) # Convert both columns from strings to complex numbers
df["Frequency"] = df["Frequency"].apply(lambda x: complex(x.strip(
"()"))) # Convert both columns from strings to complex numbers
df["Z"] = df["Z"].apply(lambda x: complex(x.strip("()")))
df["Frequency"] = df["Frequency"].apply(lambda z: z.real) # Remove imaginary parts from frequency column (they're all 0j)
df["Frequency"] = df["Frequency"].apply(
lambda z: z.real
) # Remove imaginary parts from frequency column (they're all 0j)
if divide_by is not None: # Normalize if needed
df["Z"] = df["Z"] / divide_by
if component_type == 'long':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment