diff --git a/_unittest/test_12_1_PostProcessing.py b/_unittest/test_12_1_PostProcessing.py index e299a1ca96d..609f128c44c 100644 --- a/_unittest/test_12_1_PostProcessing.py +++ b/_unittest/test_12_1_PostProcessing.py @@ -221,7 +221,7 @@ def test_07_export_fields_from_Calculator(self): self.aedtapp.post.export_field_file_on_grid( "E", "Setup1 : LastAdaptive", - self.aedtapp.available_variations.nominal_w_values, + self.aedtapp.available_variations.nominal_w_values_dict, os.path.join(self.local_scratch.path, "Efield.fld"), grid_stop=[5, 5, 5], grid_step=[0.5, 0.5, 0.5], @@ -233,7 +233,7 @@ def test_07_export_fields_from_Calculator(self): self.aedtapp.post.export_field_file_on_grid( "Mag_E", "Setup1 : LastAdaptive", - self.aedtapp.available_variations.nominal_w_values, + self.aedtapp.available_variations.nominal_w_values_dict, os.path.join(self.local_scratch.path, "MagEfieldSph.fld"), gridtype="Spherical", grid_stop=[5, 300, 300], @@ -246,7 +246,7 @@ def test_07_export_fields_from_Calculator(self): self.aedtapp.post.export_field_file_on_grid( "Mag_E", "Setup1 : LastAdaptive", - self.aedtapp.available_variations.nominal_w_values, + self.aedtapp.available_variations.nominal_w_values_dict, os.path.join(self.local_scratch.path, "MagEfieldCyl.fld"), gridtype="Cylindrical", grid_stop=[5, 300, 5], diff --git a/_unittest/test_12_PostProcessing.py b/_unittest/test_12_PostProcessing.py index aecad589e2d..8e3a906e7ab 100644 --- a/_unittest/test_12_PostProcessing.py +++ b/_unittest/test_12_PostProcessing.py @@ -291,7 +291,7 @@ def test_17_circuit(self, circuit_test): assert len(data2.data_magnitude()) > 0 context = {"algorithm": "FFT", "max_frequency": "100MHz", "time_stop": "200ns", "test": ""} data3 = circuit_test.post.get_solution_data(["V(net_11)"], "Transient", "Spectral", context=context) - assert data3.units_sweeps["Spectrum"] == "GHz" + assert data3.units_sweeps["Spectrum"] == circuit_test.odesktop.GetDefaultUnit("Frequency") assert len(data3.data_real()) > 0 new_report = circuit_test.post.reports_by_category.spectral(["dB(V(net_11))"], "Transient") new_report.window = "Hanning" @@ -320,7 +320,6 @@ def test_17_circuit(self, circuit_test): new_report.time_stop = "190ns" new_report.plot_continous_spectrum = True assert new_report.create() - pass @pytest.mark.skipif(is_linux, reason="Crashing on Linux") def test_18_diff_plot(self, diff_test): @@ -898,7 +897,7 @@ def test_76_ipk_get_scalar_field_value(self, icepak_post): "Heat_Flow_Rate", scalar_function="Integrate", solution=None, - variation_dict=["power_block:=", ["0.25W"], "power_source:=", ["0.075W"]], + variation_dict={"power_block": "0.25W", "power_source": "0.075W"}, isvector=False, intrinsics=None, phase=None, @@ -910,7 +909,7 @@ def test_76_ipk_get_scalar_field_value(self, icepak_post): "Heat_Flow_Rate", scalar_function="Integrate", solution=None, - variation_dict=["power_block:=", ["0.6W"], "power_source:=", ["0.15W"]], + variation_dict={"power_block": "0.6W", "power_source": "0.15W"}, isvector=False, intrinsics=None, phase=None, @@ -922,7 +921,7 @@ def test_76_ipk_get_scalar_field_value(self, icepak_post): "Heat_Flow_Rate", scalar_function="Integrate", solution=None, - variation_dict=["power_block:=", ["0.6W"], "power_source:=", ["0.15W"]], + variation_dict={"power_block": "0.6W", "power_source": "0.15W"}, isvector=False, intrinsics=None, phase=None, @@ -934,7 +933,7 @@ def test_76_ipk_get_scalar_field_value(self, icepak_post): "Temperature", scalar_function="Maximum", solution=None, - variation_dict=["power_block:=", ["0.6W"], "power_source:=", ["0.15W"]], + variation_dict={"power_block": "0.6W", "power_source": "0.15W"}, isvector=False, intrinsics=None, phase=None, @@ -946,7 +945,7 @@ def test_76_ipk_get_scalar_field_value(self, icepak_post): "Temperature", scalar_function="Maximum", solution=None, - variation_dict=["power_block:=", ["0.6W"], "power_source:=", ["0.15W"]], + variation_dict={"power_block": "0.6W", "power_source": "0.15W"}, isvector=False, intrinsics=None, phase=None, diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index 7f2654508ff..713942b49b4 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -2456,23 +2456,30 @@ def get_scalar_field_value( elif object_type == "point": self.ofieldsreporter.EnterPoint(obj_list) self.ofieldsreporter.CalcOp(scalar_function) + if not variation_dict: - variation_dict = self._app.available_variations.nominal_w_values + variation_dict = self._app.available_variations.nominal_w_values_dict + + variation = [] + for el, value in variation_dict.items(): + variation.append(el + ":=") + variation.append(value) + if intrinsics: if "Transient" in solution: - variation_dict.append("Time:=") - variation_dict.append(intrinsics) + variation.append("Time:=") + variation.append(intrinsics) else: - variation_dict.append("Freq:=") - variation_dict.append(intrinsics) - variation_dict.append("Phase:=") + variation.append("Freq:=") + variation.append(intrinsics) + variation.append("Phase:=") if phase: - variation_dict.append(phase) + variation.append(phase) else: - variation_dict.append("0deg") + variation.append("0deg") file_name = os.path.join(self._app.working_directory, generate_unique_name("temp_fld") + ".fld") - self.ofieldsreporter.CalculatorWrite(file_name, ["Solution:=", solution], variation_dict) + self.ofieldsreporter.CalculatorWrite(file_name, ["Solution:=", solution], variation) value = None if os.path.exists(file_name) or settings.remote_rpc_session: with open_file(file_name, "r") as f: @@ -2600,20 +2607,27 @@ def export_field_file_on_grid( else: self.logger.error("Error in the type of the grid.") return False + if not variation_dict: - variation_dict = self._app.available_variations.nominal_w_values + variation_dict = self._app.available_variations.nominal_w_values_dict + + variation = [] + for el, value in variation_dict.items(): + variation.append(el + ":=") + variation.append(value) + if intrinsics: if "Transient" in solution: - variation_dict.append("Time:=") - variation_dict.append(intrinsics) + variation.append("Time:=") + variation.append(intrinsics) else: - variation_dict.append("Freq:=") - variation_dict.append(intrinsics) - variation_dict.append("Phase:=") + variation.append("Freq:=") + variation.append(intrinsics) + variation.append("Phase:=") if phase: - variation_dict.append(phase) + variation.append(phase) else: - variation_dict.append("0deg") + variation.append("0deg") self.ofieldsreporter.ExportOnGrid( filename, @@ -2621,7 +2635,7 @@ def export_field_file_on_grid( grid_stop_wu, grid_step_wu, solution, - variation_dict, + variation, True, gridtype, grid_center,