Skip to content

Commit 85bd251

Browse files
Refactoring arguments in Material Class (#4535)
Co-authored-by: maxcapodi78 <Shark78> Co-authored-by: Samuel Lopez <[email protected]>
1 parent e03436c commit 85bd251

File tree

7 files changed

+175
-174
lines changed

7 files changed

+175
-174
lines changed

_unittest/test_03_Materials.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -290,29 +290,29 @@ def test_14_get_coreloss_coefficients(self):
290290
mat = self.aedtapp.materials.add_material("mat_test")
291291
# Test points_list_at_freq
292292
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
293-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}
293+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}
294294
)
295295
assert isinstance(coeff, list)
296296
assert len(coeff) == 3
297297
assert all(isinstance(c, float) for c in coeff)
298298
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
299-
points_list_at_freq={"60Hz": [[0, 0], [1, 3.5], [2, 7.4]]}
299+
points_at_frequency={"60Hz": [[0, 0], [1, 3.5], [2, 7.4]]}
300300
)
301301
assert isinstance(coeff, list)
302302
assert len(coeff) == 3
303303
assert all(isinstance(c, float) for c in coeff)
304304
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
305-
points_list_at_freq={"0.06kHz": [[0, 0], [1, 3.5], [2, 7.4]]}
305+
points_at_frequency={"0.06kHz": [[0, 0], [1, 3.5], [2, 7.4]]}
306306
)
307307
assert isinstance(coeff, list)
308308
assert len(coeff) == 3
309309
assert all(isinstance(c, float) for c in coeff)
310310
with pytest.raises(TypeError):
311311
self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
312-
points_list_at_freq=[[0, 0], [1, 3.5], [2, 7.4]]
312+
points_at_frequency=[[0, 0], [1, 3.5], [2, 7.4]]
313313
)
314314
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
315-
points_list_at_freq={
315+
points_at_frequency={
316316
60: [[0, 0], [1, 3.5], [2, 7.4]],
317317
100: [[0, 0], [1, 8], [2, 9]],
318318
150: [[0, 0], [1, 10], [2, 19]],
@@ -323,45 +323,45 @@ def test_14_get_coreloss_coefficients(self):
323323
assert all(isinstance(c, float) for c in coeff)
324324
# Test thickness
325325
coeff = self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
326-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="0.6mm"
326+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="0.6mm"
327327
)
328328
assert isinstance(coeff, list)
329329
assert len(coeff) == 3
330330
assert all(isinstance(c, float) for c in coeff)
331331
with pytest.raises(TypeError):
332332
self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
333-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="invalid"
333+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="invalid"
334334
)
335335
with pytest.raises(TypeError):
336336
self.aedtapp.materials["mat_test"].get_core_loss_coefficients(
337-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness=50
337+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness=50
338338
)
339339

340340
def test_14_set_core_loss(self):
341341
mat = self.aedtapp.materials["mat_test"]
342342
# Test points_list_at_freq
343343
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
344-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}
344+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}
345345
)
346346
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
347-
points_list_at_freq={"60Hz": [[0, 0], [1, 3.5], [2, 7.4]]}
347+
points_at_frequency={"60Hz": [[0, 0], [1, 3.5], [2, 7.4]]}
348348
)
349349
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
350-
points_list_at_freq={"0.06kHz": [[0, 0], [1, 3.5], [2, 7.4]]}
350+
points_at_frequency={"0.06kHz": [[0, 0], [1, 3.5], [2, 7.4]]}
351351
)
352352
with pytest.raises(TypeError):
353353
self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
354-
points_list_at_freq=[[0, 0], [1, 3.5], [2, 7.4]]
354+
points_at_frequency=[[0, 0], [1, 3.5], [2, 7.4]]
355355
)
356356
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
357-
points_list_at_freq={
357+
points_at_frequency={
358358
60: [[0, 0], [1, 3.5], [2, 7.4]],
359359
100: [[0, 0], [1, 8], [2, 9]],
360360
150: [[0, 0], [1, 10], [2, 19]],
361361
}
362362
)
363363
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
364-
points_list_at_freq={
364+
points_at_frequency={
365365
60: [[0, 0], [1, 3.5], [2, 7.4]],
366366
100: [[0, 0], [1, 8], [2, 9]],
367367
150: [[0, 0], [1, 10], [2, 19]],
@@ -370,17 +370,17 @@ def test_14_set_core_loss(self):
370370
)
371371
with pytest.raises(ValueError):
372372
self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
373-
points_list_at_freq={80: [[0, 0], [1, 3.5], [2, 7.4]]}, core_loss_model_type="Power Ferrite"
373+
points_at_frequency={80: [[0, 0], [1, 3.5], [2, 7.4]]}, core_loss_model_type="Power Ferrite"
374374
)
375375
# Test thickness
376376
assert self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
377-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="0.6mm"
377+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="0.6mm"
378378
)
379379
with pytest.raises(TypeError):
380380
self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
381-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="invalid"
381+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness="invalid"
382382
)
383383
with pytest.raises(TypeError):
384384
self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
385-
points_list_at_freq={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness=50
385+
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness=50
386386
)

_unittest/test_13_LoadAEDTFile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def test_07_load_material_file(self):
163163
def test_08_add_material_from_amat(self, mat1):
164164
mat_file = os.path.join(local_path, "example_models", test_subfolder, "material_sample.amat")
165165
dd = load_entire_aedt_file(mat_file)
166-
newmat = mat1.materials.add_material("foe_mat", props=dd["mat_example_1"])
166+
newmat = mat1.materials.add_material("foe_mat", properties=dd["mat_example_1"])
167167
assert newmat.conductivity.value == "1100000"
168168
assert newmat.thermal_conductivity.value == "13.8"
169169
assert newmat.mass_density.value == "8055"

_unittest/test_28_Maxwell3D.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def test_36_set_bp_curve_loss(self):
561561
[[0, 0], [0.6, 1.57], [1.0, 4.44], [1.5, 20.562], [2.1, 44.23]],
562562
kdc=0.002,
563563
cut_depth=0.0009,
564-
punit="w/kg",
564+
units="w/kg",
565565
bunit="tesla",
566566
frequency=50,
567567
thickness="0.5mm",

examples/03-Maxwell/Maxwell_Transformer_Coreloss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
m3d.materials[mat.name].set_coreloss_at_frequency(points_list_at_freq=pv,
8787
coefficient_setup="kw_per_cubic_meter",
8888
core_loss_model_type="Power Ferrite")
89-
coefficients = m3d.materials[mat.name].get_core_loss_coefficients(points_list_at_freq=pv,
89+
coefficients = m3d.materials[mat.name].get_core_loss_coefficients(points_at_frequency=pv,
9090
coefficient_setup="kw_per_cubic_meter")
9191

9292
###################################################################################

pyaedt/modeler/advanced_cad/stackup_3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def duplicate_parametrize_material(
597597
if duplicated_material.name == cloned_material_name: # return that material.
598598
return duplicated_material
599599
duplicated_material = self._app.materials.duplicate_material(
600-
material_name, cloned_material_name, props=list_of_properties
600+
material_name, cloned_material_name, properties=list_of_properties
601601
)
602602
# duplicated_material = DuplicatedParametrizedMaterial(
603603
# application, material_name, cloned_material_name, list_of_properties

0 commit comments

Comments
 (0)