Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented uniform points exports into methods export_report_to_csv and export_report_to_file #3733

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion _unittest/test_12_1_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,15 @@ def test_05_export_report_to_jpg(self):
assert os.path.exists(os.path.join(self.local_scratch.path, "MyTestScattering.jpg"))

def test_06_export_report_to_csv(self):
self.aedtapp.post.export_report_to_csv(self.local_scratch.path, "MyTestScattering")
self.aedtapp.post.export_report_to_csv(
self.local_scratch.path,
"MyTestScattering",
start="3GHz",
end="6GHz",
step="0.12GHz",
uniform=True,
use_trace_number_format=False,
)
assert os.path.exists(os.path.join(self.local_scratch.path, "MyTestScattering.csv"))

def test_06_export_report_to_rdat(self):
Expand Down
61 changes: 58 additions & 3 deletions pyaedt/modules/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,18 @@ def steal_focus_oneditor(self):
return True

@pyaedt_function_handler()
def export_report_to_file(self, output_dir, plot_name, extension, unique_file=False):
def export_report_to_file(
self,
output_dir,
plot_name,
extension,
unique_file=False,
uniform=False,
start=None,
end=None,
step=None,
use_trace_number_format=False,
):
"""Export a 2D Plot data to a file.

This method leaves the data in the plot (as data) as a reference
Expand All @@ -1167,6 +1178,20 @@ def export_report_to_file(self, output_dir, plot_name, extension, unique_file=Fa
* (Ansoft Report Data Files) .rdat
unique_file : bool
If set to True, generates unique file in output_dit
uniform : bool, optional
Whether the export uniform points to the file. The
default is ``False``.
start : str, optional
Start range with units for the sweep if the ``uniform`` parameter
is set to ``True``.
end : str, optional
End range with units for the sweep if the ``uniform`` parameter
is set to ``True``.
step : str, optional
Step range with units for the sweep if the ``uniform`` parameter is
set to ``True``.
use_trace_number_format : bool, optional
Whether to use trace number formats. The default is ``False``.

Returns
-------
Expand All @@ -1177,6 +1202,7 @@ def export_report_to_file(self, output_dir, plot_name, extension, unique_file=Fa
----------

>>> oModule.ExportReportDataToFile
>>> oModule.ExportUniformPointsToFile
>>> oModule.ExportToFile

Examples
Expand Down Expand Up @@ -1204,13 +1230,18 @@ def export_report_to_file(self, output_dir, plot_name, extension, unique_file=Fa

if extension == ".rdat":
self.oreportsetup.ExportReportDataToFile(plot_name, file_path)
elif uniform:
self.oreportsetup.ExportUniformPointsToFile(plot_name, file_path, start, end, step, use_trace_number_format)

else:
self.oreportsetup.ExportToFile(plot_name, file_path)

return file_path

@pyaedt_function_handler()
def export_report_to_csv(self, project_dir, plot_name):
def export_report_to_csv(
self, project_dir, plot_name, uniform=False, start=None, end=None, step=None, use_trace_number_format=False
):
"""Export the 2D Plot data to a CSV file.

This method leaves the data in the plot (as data) as a reference
Expand All @@ -1222,6 +1253,20 @@ def export_report_to_csv(self, project_dir, plot_name):
Path to the project directory. The csv file will be plot_name.csv.
plot_name : str
Name of the plot to export.
uniform : bool, optional
Whether the export uniform points to the file. The
default is ``False``.
start : str, optional
Start range with units for the sweep if the ``uniform`` parameter
is set to ``True``.
end : str, optional
End range with units for the sweep if the ``uniform`` parameter
is set to ``True``.
step : str, optional
Step range with units for the sweep if the ``uniform`` parameter is
set to ``True``.
use_trace_number_format : bool, optional
Whether to use trace number formats. The default is ``False``.

Returns
-------
Expand All @@ -1233,8 +1278,18 @@ def export_report_to_csv(self, project_dir, plot_name):

>>> oModule.ExportReportDataToFile
>>> oModule.ExportToFile
>>> oModule.ExportUniformPointsToFile
"""
return self.export_report_to_file(project_dir, plot_name, extension=".csv")
return self.export_report_to_file(
project_dir,
plot_name,
extension=".csv",
uniform=uniform,
start=start,
end=end,
step=step,
use_trace_number_format=use_trace_number_format,
)

@pyaedt_function_handler()
def export_report_to_jpg(self, project_dir, plot_name, width=0, height=0):
Expand Down
Loading