Skip to content

Commit

Permalink
FEAT: added units to export_to_csv method (#4691)
Browse files Browse the repository at this point in the history
Co-authored-by: maxcapodi78 <Shark78>
  • Loading branch information
maxcapodi78 authored May 17, 2024
1 parent aa4a302 commit cc5fb48
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions pyaedt/modules/solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,13 +725,30 @@ def export_data_to_csv(self, output, delimiter=";"):
-------
bool
"""
header = [el for el in self._sweeps_names]
header = []
des_var = self._original_data[0].GetDesignVariableNames()
sweep_var = self._original_data[0].GetSweepNames()
for el in self._sweeps_names:
unit = ""
if el in des_var:
unit = self._original_data[0].GetDesignVariableUnits(el)
elif el in sweep_var:
unit = self._original_data[0].GetSweepUnits(el)
if unit == "":
header.append("{}".format(el))
else:
header.append("{} [{}]".format(el, unit))
# header = [el for el in self._sweeps_names]
for el in self.expressions:
data_unit = self._original_data[0].GetDataUnits(el)
if data_unit:
data_unit = " [{}]".format(data_unit)
if not self.is_real_only(el):
header.append(el + " (Real)")
header.append(el + " (Imag)")

header.append(el + " (Real){}".format(data_unit))
header.append(el + " (Imag){}".format(data_unit))
else:
header.append(el)
header.append(el + "{}".format(data_unit))

list_full = [header]
for e, v in self._solutions_real[self.active_expression].items():
Expand Down

0 comments on commit cc5fb48

Please sign in to comment.