fiqus 2026.1.0__py3-none-any.whl → 2026.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fiqus/MainFiQuS.py +1 -8
- fiqus/data/DataConductor.py +4 -8
- fiqus/data/DataFiQuSMultipole.py +358 -167
- fiqus/data/DataModelCommon.py +30 -15
- fiqus/data/DataMultipole.py +33 -10
- fiqus/data/DataWindingsCCT.py +37 -37
- fiqus/data/RegionsModelFiQuS.py +1 -1
- fiqus/geom_generators/GeometryMultipole.py +751 -54
- fiqus/getdp_runners/RunGetdpMultipole.py +181 -31
- fiqus/mains/MainMultipole.py +109 -17
- fiqus/mesh_generators/MeshCCT.py +209 -209
- fiqus/mesh_generators/MeshMultipole.py +938 -263
- fiqus/parsers/ParserCOND.py +2 -1
- fiqus/parsers/ParserDAT.py +16 -16
- fiqus/parsers/ParserGetDPOnSection.py +212 -212
- fiqus/parsers/ParserGetDPTimeTable.py +134 -134
- fiqus/parsers/ParserMSH.py +53 -53
- fiqus/parsers/ParserRES.py +142 -142
- fiqus/plotters/PlotPythonCCT.py +133 -133
- fiqus/plotters/PlotPythonMultipole.py +18 -18
- fiqus/post_processors/PostProcessMultipole.py +16 -6
- fiqus/pre_processors/PreProcessCCT.py +175 -175
- fiqus/pro_assemblers/ProAssembler.py +3 -3
- fiqus/pro_material_functions/ironBHcurves.pro +246 -246
- fiqus/pro_templates/combined/CC_Module.pro +1213 -0
- fiqus/pro_templates/combined/ConductorAC_template.pro +1025 -0
- fiqus/pro_templates/combined/Multipole_template.pro +2738 -1338
- fiqus/pro_templates/combined/TSA_materials.pro +102 -2
- fiqus/pro_templates/combined/materials.pro +54 -3
- fiqus/utils/Utils.py +18 -25
- fiqus/utils/update_data_settings.py +1 -1
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/METADATA +64 -68
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/RECORD +42 -40
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/WHEEL +1 -1
- tests/test_geometry_generators.py +29 -32
- tests/test_mesh_generators.py +35 -34
- tests/test_solvers.py +32 -31
- tests/utils/fiqus_test_classes.py +396 -147
- tests/utils/generate_reference_files_ConductorAC.py +57 -57
- tests/utils/helpers.py +76 -1
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/LICENSE.txt +0 -0
- {fiqus-2026.1.0.dist-info → fiqus-2026.1.2.dist-info}/top_level.txt +0 -0
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import shutil
|
|
3
|
-
import sys
|
|
4
|
-
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))) # Add the path to the fiqus package to the system path
|
|
5
|
-
from fiqus.data.DataFiQuS import FDM
|
|
6
|
-
from fiqus.utils.Utils import FilesAndFolders as Util
|
|
7
|
-
from fiqus import MainFiQuS as mf
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Generate reference files for the models below:
|
|
11
|
-
model_names = [
|
|
12
|
-
"TEST_CAC_Strand_adaptiveMesh",
|
|
13
|
-
"TEST_CAC_Strand_hexFilaments",
|
|
14
|
-
"TEST_CAC_wireInChannel",
|
|
15
|
-
]
|
|
16
|
-
# The run types for the models above:
|
|
17
|
-
run_types = [
|
|
18
|
-
'geometry_and_mesh',
|
|
19
|
-
'start_from_yaml',
|
|
20
|
-
'start_from_yaml',
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
for model_name, run_type in zip(model_names, run_types):
|
|
24
|
-
# get path to the input file:
|
|
25
|
-
input_file = os.path.join(
|
|
26
|
-
os.path.dirname(os.path.dirname(__file__)),
|
|
27
|
-
"_inputs",
|
|
28
|
-
model_name,
|
|
29
|
-
f"{model_name}.yaml",
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
# select _references folder as the output folder:
|
|
33
|
-
output_folder = os.path.join(
|
|
34
|
-
os.path.dirname(os.path.dirname(__file__)), "_references", model_name
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
# if the output folder exists, remove it:
|
|
38
|
-
if os.path.exists(output_folder):
|
|
39
|
-
shutil.rmtree(output_folder)
|
|
40
|
-
|
|
41
|
-
# Create the output folder:
|
|
42
|
-
os.makedirs(output_folder)
|
|
43
|
-
|
|
44
|
-
# Cast input yaml file to FDM
|
|
45
|
-
data_model: FDM = Util.read_data_from_yaml(input_file, FDM)
|
|
46
|
-
|
|
47
|
-
data_model.run.overwrite = True
|
|
48
|
-
|
|
49
|
-
# Make the run type start_from_yaml:
|
|
50
|
-
data_model.run.type = run_type
|
|
51
|
-
|
|
52
|
-
fiqus_instance = mf.MainFiQuS(
|
|
53
|
-
fdm=data_model, model_folder=output_folder, input_file_path=input_file
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
# remove fiqus_instance to avoid memory issues:
|
|
57
|
-
del fiqus_instance
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
import sys
|
|
4
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))) # Add the path to the fiqus package to the system path
|
|
5
|
+
from fiqus.data.DataFiQuS import FDM
|
|
6
|
+
from fiqus.utils.Utils import FilesAndFolders as Util
|
|
7
|
+
from fiqus import MainFiQuS as mf
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Generate reference files for the models below:
|
|
11
|
+
model_names = [
|
|
12
|
+
"TEST_CAC_Strand_adaptiveMesh",
|
|
13
|
+
"TEST_CAC_Strand_hexFilaments",
|
|
14
|
+
"TEST_CAC_wireInChannel",
|
|
15
|
+
]
|
|
16
|
+
# The run types for the models above:
|
|
17
|
+
run_types = [
|
|
18
|
+
'geometry_and_mesh',
|
|
19
|
+
'start_from_yaml',
|
|
20
|
+
'start_from_yaml',
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
for model_name, run_type in zip(model_names, run_types):
|
|
24
|
+
# get path to the input file:
|
|
25
|
+
input_file = os.path.join(
|
|
26
|
+
os.path.dirname(os.path.dirname(__file__)),
|
|
27
|
+
"_inputs",
|
|
28
|
+
model_name,
|
|
29
|
+
f"{model_name}.yaml",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# select _references folder as the output folder:
|
|
33
|
+
output_folder = os.path.join(
|
|
34
|
+
os.path.dirname(os.path.dirname(__file__)), "_references", model_name
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# if the output folder exists, remove it:
|
|
38
|
+
if os.path.exists(output_folder):
|
|
39
|
+
shutil.rmtree(output_folder)
|
|
40
|
+
|
|
41
|
+
# Create the output folder:
|
|
42
|
+
os.makedirs(output_folder)
|
|
43
|
+
|
|
44
|
+
# Cast input yaml file to FDM
|
|
45
|
+
data_model: FDM = Util.read_data_from_yaml(input_file, FDM)
|
|
46
|
+
|
|
47
|
+
data_model.run.overwrite = True
|
|
48
|
+
|
|
49
|
+
# Make the run type start_from_yaml:
|
|
50
|
+
data_model.run.type = run_type
|
|
51
|
+
|
|
52
|
+
fiqus_instance = mf.MainFiQuS(
|
|
53
|
+
fdm=data_model, model_folder=output_folder, input_file_path=input_file
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# remove fiqus_instance to avoid memory issues:
|
|
57
|
+
del fiqus_instance
|
tests/utils/helpers.py
CHANGED
|
@@ -3,7 +3,7 @@ import itertools
|
|
|
3
3
|
import operator
|
|
4
4
|
import os
|
|
5
5
|
import unittest
|
|
6
|
-
from
|
|
6
|
+
from typing import List
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
|
|
@@ -32,6 +32,10 @@ class Paths:
|
|
|
32
32
|
self.input_file = os.path.join(self.inputs_folder, f'{model_name}.yaml')
|
|
33
33
|
self.model_file = os.path.join(self.model_folder, f'{model_name}.{f_extension}')
|
|
34
34
|
self.reference_file = os.path.join(self.references_folder, f'{model_name}.{f_extension}')
|
|
35
|
+
self.reference_vi_file = os.path.join(self.references_folder, f'{model_name}.vi')
|
|
36
|
+
self.reference_geo_yaml_file = os.path.join(self.references_folder, f'geometry.yaml')
|
|
37
|
+
self.reference_mesh_yaml_file = os.path.join(self.references_folder, f'mesh.yaml')
|
|
38
|
+
self.reference_regions_file = os.path.join(self.references_folder, f'{model_name}.regions')
|
|
35
39
|
|
|
36
40
|
|
|
37
41
|
def filecmp(filename1, filename2):
|
|
@@ -95,3 +99,74 @@ def assert_two_parameters(true_value, test_value):
|
|
|
95
99
|
test_case.assertListEqual(list(test_value), list(true_value))
|
|
96
100
|
else:
|
|
97
101
|
test_case.assertEqual(test_value, true_value)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def assert_equal_readable_files(file1: str, file2: str, verbose: bool = False) -> None:
|
|
105
|
+
"""
|
|
106
|
+
Assert that two readable (e.g. csv or cond) files are equal
|
|
107
|
+
:param file1: full path to the first file
|
|
108
|
+
:type file1: str
|
|
109
|
+
:param file2: full path to the second file
|
|
110
|
+
:type file2: str
|
|
111
|
+
:param verbose: if ture more is printed to the output
|
|
112
|
+
:type verbose: bool
|
|
113
|
+
:return: Nothing, however it asserts using unittest testcase
|
|
114
|
+
:rtype: None
|
|
115
|
+
"""
|
|
116
|
+
test_case = unittest.TestCase()
|
|
117
|
+
|
|
118
|
+
# Load files to compare
|
|
119
|
+
with open(file1, "r") as f1, open(file2, "r") as f2:
|
|
120
|
+
file1 = f1.readlines()
|
|
121
|
+
file2 = f2.readlines()
|
|
122
|
+
|
|
123
|
+
flag_equal = True
|
|
124
|
+
for line in file2:
|
|
125
|
+
if line not in file1:
|
|
126
|
+
if verbose:
|
|
127
|
+
print(f"Found line that appears in File2 but not in File1: {line}")
|
|
128
|
+
flag_equal = False
|
|
129
|
+
for line in file1:
|
|
130
|
+
if line not in file2:
|
|
131
|
+
if verbose:
|
|
132
|
+
print(f"Found line that appears in File1 but not in File2: {line}")
|
|
133
|
+
flag_equal = False
|
|
134
|
+
|
|
135
|
+
# Display message and assert files have the same entries
|
|
136
|
+
if flag_equal:
|
|
137
|
+
if verbose:
|
|
138
|
+
print('Files {} and {} have the same entries.'.format(file1, file2))
|
|
139
|
+
test_case.assertEqual(flag_equal, True)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def compare_conductors_dicts(dict1, dict2, max_relative_error=1e-6):
|
|
143
|
+
"""
|
|
144
|
+
Function that compares two conductor dicts and returns message list describing differences
|
|
145
|
+
If there are no differences the list is empty
|
|
146
|
+
:param dict1: reference dict to compare
|
|
147
|
+
:param dict2: output dict to compare
|
|
148
|
+
:param max_relative_error: maximum relative difference of values
|
|
149
|
+
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
the_same_flag = True
|
|
153
|
+
for brick_id in dict1.keys():
|
|
154
|
+
if dict1[brick_id] != dict2[brick_id]:
|
|
155
|
+
pass
|
|
156
|
+
else:
|
|
157
|
+
for key, value1 in dict1[brick_id].items():
|
|
158
|
+
value2 = dict2[brick_id][key]
|
|
159
|
+
if key in ['SHAPE', 'DRIVELABEL']:
|
|
160
|
+
if value1 == value2:
|
|
161
|
+
pass
|
|
162
|
+
else:
|
|
163
|
+
the_same_flag = False
|
|
164
|
+
else:
|
|
165
|
+
if abs(float(value1) - float(value2)) < max_relative_error * float(value2):
|
|
166
|
+
pass
|
|
167
|
+
elif float(value1) == float(value2): # both zero
|
|
168
|
+
pass
|
|
169
|
+
else:
|
|
170
|
+
the_same_flag = False
|
|
171
|
+
|
|
172
|
+
return the_same_flag
|
|
File without changes
|
|
File without changes
|