Skip to content

Every Export is saved in working directory #733

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

Merged
merged 3 commits into from
Jan 19, 2022
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
2 changes: 1 addition & 1 deletion _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def test_13_export_model_picture(self):
path = self.aedtapp.post.export_model_picture(picturename="test_picture")
assert path

@pytest.mark.skipif(config["build_machine"] or is_ironpython, reason="Not running in ironpython")
@pytest.mark.skipif(is_ironpython, reason="Not running in ironpython")
def test_14_Field_Ploton_cutplanedesignname(self):
cutlist = ["Global:XY"]
setup_name = self.aedtapp.existing_analysis_sweeps[0]
Expand Down
2 changes: 1 addition & 1 deletion examples/01-Modeling-Setup/Optimetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
create_sheets_on_openings=True,
)

hfss.plot(show=False, export_path=os.path.join(hfss.project_path, "Image.jpg"))
hfss.plot(show=False, export_path=os.path.join(hfss.working_directory, "Image.jpg"))


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/02-HFSS/HFSS_Dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

hfss.plot(show=False, export_path=os.path.join(hfss.project_path, "Image.jpg"), plot_air_objects=False)
hfss.plot(show=False, export_path=os.path.join(hfss.working_directory, "Image.jpg"), plot_air_objects=False)

###############################################################################
# Create the Setup
Expand Down
2 changes: 1 addition & 1 deletion examples/02-HFSS/HFSS_Spiral.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def create_line(pts):
# Plot the model
# ~~~~~~~~~~~~~~

hfss.plot(show=False, export_path=os.path.join(hfss.project_path, "Image.jpg"))
hfss.plot(show=False, export_path=os.path.join(hfss.working_directory, "Image.jpg"))


################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/02-HFSS/SBR_Doppler_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

app.plot(show=False, export_path=os.path.join(app.project_path, "Image.jpg"), plot_air_objects=True)
app.plot(show=False, export_path=os.path.join(app.working_directory, "Image.jpg"), plot_air_objects=True)

###############################################################################
# Solve and release desktop
Expand Down
2 changes: 1 addition & 1 deletion examples/02-HFSS/SBR_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

target.plot(show=False, export_path=os.path.join(target.project_path, "Image.jpg"), plot_air_objects=False)
target.plot(show=False, export_path=os.path.join(target.working_directory, "Image.jpg"), plot_air_objects=False)


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/02-Maxwell/Maxwell2D_Eddy.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

M3D.plot(show=False, export_path=os.path.join(M3D.project_path, "Image.jpg"), plot_air_objects=False)
M3D.plot(show=False, export_path=os.path.join(M3D.working_directory, "Image.jpg"), plot_air_objects=False)

###############################################################################
# Add an Eddy Current Setup
Expand Down
2 changes: 1 addition & 1 deletion examples/02-Maxwell/Maxwell2D_Transient.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

maxwell_2d.plot(show=False, export_path=os.path.join(maxwell_2d.project_path, "Image.jpg"), plot_air_objects=True)
maxwell_2d.plot(show=False, export_path=os.path.join(maxwell_2d.working_directory, "Image.jpg"), plot_air_objects=True)


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/02-Maxwell/Maxwell3DTeam3.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

M3D.plot(show=False, export_path=os.path.join(M3D.project_path, "Image.jpg"), plot_air_objects=False)
M3D.plot(show=False, export_path=os.path.join(M3D.working_directory, "Image.jpg"), plot_air_objects=False)


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/02-Maxwell/Maxwell3D_TEAM7.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

M3D.plot(show=False, export_path=os.path.join(M3D.project_path, "Image.jpg"), plot_air_objects=False)
M3D.plot(show=False, export_path=os.path.join(M3D.working_directory, "Image.jpg"), plot_air_objects=False)


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/02-Maxwell/Maxwell_Magnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

m3d.plot(show=False, export_path=os.path.join(m3d.project_path, "Image.jpg"), plot_air_objects=True)
m3d.plot(show=False, export_path=os.path.join(m3d.working_directory, "Image.jpg"), plot_air_objects=True)

###############################################################################
# Solve Setup
Expand Down
2 changes: 1 addition & 1 deletion examples/05-Q3D/Q3D_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
q.modeler["substrate"].color = (128, 128, 128)
q.modeler["substrate"].transparency = 0.8

q.plot(show=False, export_path=os.path.join(q.project_path, "Q3D.jpg"), plot_air_objects=False)
q.plot(show=False, export_path=os.path.join(q.working_directory, "Q3D.jpg"), plot_air_objects=False)

###############################################################################
# Set Up Boundaries
Expand Down
2 changes: 1 addition & 1 deletion examples/06-Multiphysics/Hfss_Icepak_Coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
surflist = aedtapp.modeler.get_object_faces("outer")
plot1 = aedtapp.post.create_fieldplot_surface(surflist, quantity_name2, setup_name, intrinsic)

results_folder = os.path.join(aedtapp.project_path, "Coaxial_Results_NG")
results_folder = os.path.join(aedtapp.working_directory, "Coaxial_Results_NG")
if not os.path.exists(results_folder):
os.mkdir(results_folder)

Expand Down
2 changes: 1 addition & 1 deletion examples/06-Multiphysics/Hfss_Mechanical.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
# Plot the model
# ~~~~~~~~~~~~~~

mech.plot(show=False, export_path=os.path.join(mech.project_path, "Mech.jpg"), plot_air_objects=False)
mech.plot(show=False, export_path=os.path.join(mech.working_directory, "Mech.jpg"), plot_air_objects=False)

###############################################################################
# Solution
Expand Down
10 changes: 5 additions & 5 deletions pyaedt/application/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def export_results(self, analyze=False, export_folder=None):
analyze : bool
Either to Analyze before export or not. Solutions have to be present for the design.
export_folder : str, optional
Full path to project folder.
Full path to project folder. If `None` working_directory will be used.

Returns
-------
Expand All @@ -560,7 +560,7 @@ def export_results(self, analyze=False, export_folder=None):
"""
exported_files = []
if not export_folder:
export_folder = self.project_path
export_folder = self.working_directory
if analyze:
self.analyze_all()
setups = self.oanalysis.GetSetups()
Expand Down Expand Up @@ -674,7 +674,7 @@ def export_convergence(self, setup_name, variation_string="", file_path=None):
variation_string : str
Variation string with values. Eg ``'radius=3mm'``
file_path : str, optional
full path to .prof file.
full path to .prof file. If `None` working_directory will be used.


Returns
Expand All @@ -688,7 +688,7 @@ def export_convergence(self, setup_name, variation_string="", file_path=None):
>>> oModule.ExportConvergence
"""
if not file_path:
file_path = os.path.join(self.project_path, generate_unique_name("Convergence") + ".prop")
file_path = os.path.join(self.working_directory, generate_unique_name("Convergence") + ".prop")
self.odesign.ExportConvergence(setup_name, variation_string, file_path)
self.logger.info("Export Convergence to %s", file_path)
return file_path
Expand Down Expand Up @@ -1342,7 +1342,7 @@ def analyze_setup(self, name, num_cores=None, num_tasks=None, num_gpu=None, acf_
elif num_gpu or num_tasks or num_cores:
config_name = "pyaedt_config"
source_name = os.path.join(self.pyaedt_dir, "misc", "pyaedt_local_config.acf")
target_name = os.path.join(self.project_path, config_name + ".acf")
target_name = os.path.join(self.working_directory, config_name + ".acf")
shutil.copy2(source_name, target_name)
if num_cores:
update_hpc_option(target_name, "NumCores", num_cores, False)
Expand Down
4 changes: 2 additions & 2 deletions pyaedt/application/Analysis2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None):
variation_string : str, optional
Variation List.
mesh_path : str, optional
Full path to mesh statistics file.
Full path to mesh statistics file. If `None` working_directory will be used.

Returns
-------
Expand All @@ -211,7 +211,7 @@ def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None):
>>> oDesign.ExportMeshStats
"""
if not mesh_path:
mesh_path = os.path.join(self.project_path, "meshstats.ms")
mesh_path = os.path.join(self.working_directory, "meshstats.ms")
self.odesign.ExportMeshStats(setup_name, variation_string, mesh_path)
return mesh_path

Expand Down
4 changes: 2 additions & 2 deletions pyaedt/application/Analysis3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None):
variation_string : str, optional
Variation List.
mesh_path : str, optional
Full path to mesh statistics file.
Full path to mesh statistics file. If `None` working_directory will be used.

Returns
-------
Expand All @@ -242,7 +242,7 @@ def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None):
>>> oDesign.ExportMeshStats
"""
if not mesh_path:
mesh_path = os.path.join(self.project_path, "meshstats.ms")
mesh_path = os.path.join(self.working_directory, "meshstats.ms")
self.odesign.ExportMeshStats(setup_name, variation_string, mesh_path)
return mesh_path

Expand Down
4 changes: 2 additions & 2 deletions pyaedt/application/Analysis3DLayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None):
variation_string : str, optional
Variation List.
mesh_path : str, optional
Full path to mesh statistics file.
Full path to mesh statistics file. If `None` working_directory will be used.

Returns
-------
Expand All @@ -205,7 +205,7 @@ def export_mesh_stats(self, setup_name, variation_string="", mesh_path=None):
>>> oModule.ExportMeshStats
"""
if not mesh_path:
mesh_path = os.path.join(self.project_path, "meshstats.ms")
mesh_path = os.path.join(self.working_directory, "meshstats.ms")
self.odesign.ExportMeshStats(setup_name, variation_string, mesh_path)
return mesh_path

Expand Down
11 changes: 6 additions & 5 deletions pyaedt/application/Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,14 +857,15 @@ def temp_directory(self):
def toolkit_directory(self):
"""Path to the toolkit directory.


Returns
-------
str
Full absolute path for the ``toolkit`` directory for this project.
Full absolute path for the ``pyaedt`` directory for this project.
If this directory does not exist, it is created.

"""
toolkit_directory = os.path.join(self.project_path, self.project_name + ".toolkit")

toolkit_directory = os.path.join(self.project_path, self.project_name + ".pyaedt")
if not os.path.isdir(toolkit_directory):
os.mkdir(toolkit_directory)
return toolkit_directory
Expand Down Expand Up @@ -1034,7 +1035,7 @@ def export_profile(self, setup_name, variation_string="", file_path=None):
variation_string : str
Variation string with values. Eg ``'radius=3mm'``
file_path : str, optional
full path to .prof file.
full path to .prof file. If `None`, working_directory will be used.


Returns
Expand All @@ -1048,7 +1049,7 @@ def export_profile(self, setup_name, variation_string="", file_path=None):
>>> oDesign.ExportProfile
"""
if not file_path:
file_path = os.path.join(self.project_path, generate_unique_name("Profile") + ".prop")
file_path = os.path.join(self.working_directory, generate_unique_name("Profile") + ".prop")
self.odesign.ExportProfile(setup_name, variation_string, file_path)
self.logger.info("Exported Profile to file {}".format(file_path))
return file_path
Expand Down
4 changes: 2 additions & 2 deletions pyaedt/application/Variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ def export(self, dataset_path=None):
----------
dataset_path : str, optional
Path to export the dataset to. The default is ``None``, in which
case the dataset is exported to the project path.
case the dataset is exported to the working_directory path.

Returns
-------
Expand All @@ -1619,7 +1619,7 @@ def export(self, dataset_path=None):
>>> oDesign.ExportDataset
"""
if not dataset_path:
dataset_path = os.path.join(self._app.project_path, self.name + ".tab")
dataset_path = os.path.join(self._app.working_directory, self.name + ".tab")
if self.name[0] == "$":
self._app._oproject.ExportDataset(self.name, dataset_path)
else:
Expand Down
10 changes: 6 additions & 4 deletions pyaedt/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ def export_touchstone(self, solutionname, sweepname, filename=None, variation=[]
sweepname : str
Name of the sweep that has been solved.
filename : str, optional
Full path and name for the Touchstone file. The default is ``None``.
Full path and name for the Touchstone file.
The default is ``None`` which export file in working_directory.
variation : list, optional
List of all parameter variations. For example, ``["$AmbientTemp", "$PowerIn"]``.
The default is ``[]``.
Expand All @@ -774,7 +775,7 @@ def export_touchstone(self, solutionname, sweepname, filename=None, variation=[]
for v, vv in zip(variation, variations_value):
appendix += "_" + v + vv.replace("'", "")
ext = ".S" + str(self.oboundary.GetNumExcitations()) + "p"
filename = os.path.join(self.project_path, solutionname + "_" + sweepname + appendix + ext)
filename = os.path.join(self.working_directory, solutionname + "_" + sweepname + appendix + ext)
else:
filename = filename.replace("//", "/").replace("\\", "/")
self.logger.info("Exporting Touchstone " + filename)
Expand Down Expand Up @@ -850,7 +851,8 @@ def export_fullwave_spice(
is_solution_file : bool, optional
Whether it is an imported solution file. The default is ``False``.
filename : str, optional
Full path and name for exporting the HSpice file. The default is ``None``.
Full path and name for exporting the HSpice file.
The default is ``None`` which export file in working_directory.
passivity : bool, optional
Whether to compute the passivity. The default is ``False``.
causality : bool, optional
Expand Down Expand Up @@ -878,7 +880,7 @@ def export_fullwave_spice(
if not designname:
designname = self.design_name
if not filename:
filename = os.path.join(self.project_path, self.design_name + ".sp")
filename = os.path.join(self.working_directory, self.design_name + ".sp")
if is_solution_file:
setupname = designname
designname = ""
Expand Down
8 changes: 5 additions & 3 deletions pyaedt/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3573,7 +3573,7 @@ def validate_full_design(self, dname=None, outputdir=None, ports=None):
if not dname:
dname = self.design_name
if not outputdir:
outputdir = self.project_path
outputdir = self.working_directory
pname = self.project_name
validation_log_file = os.path.join(outputdir, pname + "_" + dname + "_validation.log")

Expand Down Expand Up @@ -3797,7 +3797,9 @@ def export_touchstone(self, solutionname, sweepname, filename=None, variation=[]
sweepname : str
Name of the sweep that has been solved.
filename : str, optional
Full path and name for the output file. The default is ``None``.
Full path and name for the output file.
The default is ``None`` which export file in working_directory.

variation : list, optional
List of all parameter variations. For example, ``["$AmbientTemp", "$PowerIn"]``.
The default is ``[]``.
Expand All @@ -3817,7 +3819,7 @@ def export_touchstone(self, solutionname, sweepname, filename=None, variation=[]
for v, vv in zip(variation, variations_value):
appendix += "_" + v + vv.replace("'", "")
ext = ".S" + str(self.oboundary.GetNumExcitations()) + "p"
filename = os.path.join(self.project_path, solutionname + "_" + sweepname + appendix + ext)
filename = os.path.join(self.working_directory, solutionname + "_" + sweepname + appendix + ext)
else:
filename = filename.replace("//", "/").replace("\\", "/")
print("Exporting Touchstone " + filename)
Expand Down
9 changes: 6 additions & 3 deletions pyaedt/hfss3dlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ def validate_full_design(self, name=None, outputdir=None, ports=None):
name : str, optional
Name of the design to validate. The default is ``None``.
outputdir : str, optional
Output directory to save the log file to. The default is ``None``.
Output directory to save the log file to.
The default is ``None`` which export file in working_directory.

ports : str, optional
Number of excitations that are expected. The default is ``None``.

Expand All @@ -405,7 +407,7 @@ def validate_full_design(self, name=None, outputdir=None, ports=None):
if name is None:
name = self.design_name
if outputdir is None:
outputdir = self.project_path
outputdir = self.working_directory

self.logger.info("#### Design Validation Checks###")
#
Expand Down Expand Up @@ -553,6 +555,7 @@ def export_touchstone(self, solutionname, sweepname, filename, variation, variat
Name of the sweep that has been solved.
filename : str
Full path for the Touchstone file.
The default is ``None`` which export file in working_directory.
variation : list
List of all parameter variations, such as ``["$AmbientTemp", "$PowerIn"]``.
variations_value : list
Expand All @@ -574,7 +577,7 @@ def export_touchstone(self, solutionname, sweepname, filename, variation, variat
for v, vv in zip(variation, variations_value):
appendix += "_" + v + vv.replace("'", "")
ext = ".S" + str(len(self.port_list)) + "p"
filename = os.path.join(self.project_path, solutionname + "_" + sweepname + appendix + ext)
filename = os.path.join(self.working_directory, solutionname + "_" + sweepname + appendix + ext)
else:
filename = filename.replace("//", "/").replace("\\", "/")
print("Exporting Touchstone " + filename)
Expand Down
Loading