Skip to content

Commit faad232

Browse files
authored
Merge pull request #145 from upb-lea/ito
update scipy dependency, update integration tests
2 parents 0ea1288 + dae8843 commit faad232

5 files changed

Lines changed: 190 additions & 190 deletions

File tree

femmt/functions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88
import warnings
99
from typing import Union, List, Tuple, Dict
10-
from scipy.integrate import quadrature
10+
from scipy.integrate import quad
1111

1212

1313
# Third parry libraries
@@ -1673,7 +1673,7 @@ def visualize_inductance_matrix(inductance_matrix: np.array, silent: bool) -> No
16731673

16741674
def calculate_quadrature_integral(time_steps: List[float], data: List[float]) -> float:
16751675
"""
1676-
Calculate the integral of given data over specific time steps using the quadrature method.
1676+
Calculate the integral of given data over specific time steps using the quad method.
16771677
16781678
:param time_steps: List of time steps.
16791679
:type time_steps: List[float]
@@ -1683,11 +1683,11 @@ def calculate_quadrature_integral(time_steps: List[float], data: List[float]) ->
16831683
:rtype: float
16841684
"""
16851685
func = lambda x: np.interp(x, time_steps, data)
1686-
return quadrature(func, time_steps[0], time_steps[-1])[0]
1686+
return quad(func, time_steps[0], time_steps[-1])[0]
16871687

16881688
def calculate_squared_quadrature_integral(time_steps: List[float], data: List[float]) -> float:
16891689
"""
1690-
Calculate the integral of squared given data over specific time steps using the quadrature method..
1690+
Calculate the integral of squared given data over specific time steps using the quad method..
16911691
16921692
:param time_steps: List of time steps.
16931693
:type time_steps: List[float]
@@ -1697,7 +1697,7 @@ def calculate_squared_quadrature_integral(time_steps: List[float], data: List[fl
16971697
:rtype: float
16981698
"""
16991699
func = lambda x: np.interp(x, time_steps, data) ** 2
1700-
return quadrature(func, time_steps[0], time_steps[-1])[0]
1700+
return quad(func, time_steps[0], time_steps[-1])[0]
17011701

17021702
def calculate_average(integral: float, time_steps: List[float]) -> float:
17031703
"""

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
'Environment :: MacOS X'
3737
],
3838
description="FEM Magnetics Toolbox",
39-
install_requires=['pandas~=2.2.1',
40-
'numpy~=1.26.0',
41-
'matplotlib~=3.8.0',
39+
install_requires=['pandas',
40+
'numpy',
41+
'matplotlib',
4242
'gmsh>=4.13.1',
4343
'onelab>=1.0',
44-
'scipy~=1.12.0',
44+
'scipy',
4545
'pytest',
4646
'pycodestyle',
4747
'PyQt5>=5.15.6',

tests/integration/fixtures/inductor_time_domain.json

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"winding1": {
1414
"number_turns": 7,
1515
"flux": [
16-
6.597457099254291e-21
16+
6.597457099229695e-21
1717
],
1818
"V": [
19-
7.125757217255167e-15
19+
7.125757217228565e-15
2020
],
2121
"I": 4.5
2222
}
@@ -29,10 +29,10 @@
2929
"winding1": {
3030
"number_turns": 7,
3131
"flux": [
32-
-0.0001077446510103608
32+
-0.0001077446510099585
3333
],
3434
"V": [
35-
-116.3724466877538
35+
-116.372446687319
3636
],
3737
"I": 2.755455298081545e-16
3838
}
@@ -45,10 +45,10 @@
4545
"winding1": {
4646
"number_turns": 7,
4747
"flux": [
48-
-2.17295736405006e-07
48+
-2.172957356635589e-07
4949
],
5050
"V": [
51-
116.1295014221795
51+
116.1295014225463
5252
],
5353
"I": -4.5
5454
}
@@ -61,10 +61,10 @@
6161
"winding1": {
6262
"number_turns": 7,
6363
"flux": [
64-
0.0001076531837167653
64+
0.0001076531837163754
6565
],
6666
"V": [
67-
116.5083098798428
67+
116.5083098786209
6868
],
6969
"I": -8.266365894244633e-16
7070
}
@@ -77,10 +77,10 @@
7777
"winding1": {
7878
"number_turns": 7,
7979
"flux": [
80-
0.0002156350894730235
80+
0.0002156350894741519
8181
],
8282
"V": [
83-
116.6369215864199
83+
116.6369215880606
8484
],
8585
"I": 4.5
8686
}
@@ -90,54 +90,54 @@
9090
],
9191
"average_losses": {
9292
"core_eddy_losses": [
93-
0.3741369333406631
93+
0.37011728617857176
9494
],
9595
"core_hyst_losses": [
9696
0
9797
],
9898
"core_parts": {
9999
"core_part_1": {
100-
"total_core_part_1": 0.3741369333406631
100+
"total_core_part_1": 0.37011728617857176
101101
}
102102
},
103103
"winding1": {
104-
"winding_losses": 0.6900431923699826,
104+
"winding_losses": 0.6889948519566834,
105105
"turn_losses": [
106-
0.02062169918780006,
107-
0.0640740246767881,
108-
0.1358084753404246,
109-
0.19008381621056092,
110-
0.1777720510658816,
111-
0.06950271753711698,
112-
0.024907924591631932
106+
0.021618938051441074,
107+
0.06330126872171397,
108+
0.1348807882156743,
109+
0.19195353829081477,
110+
0.17952718687163013,
111+
0.07162441266156501,
112+
0.02612954650549344
113113
],
114114
"flux_over_current": [
115-
1.6640773590451344e-05
115+
2.70273967261006e-05
116116
],
117117
"average_current": [
118118
0.8999999999999998
119119
],
120120
"average_voltage": [
121-
43.563213887152386
121+
43.64595635196963
122122
],
123-
"P": 39.20689249843714,
124-
"S": 246.73612005242165,
125-
"Q": 243.60117511855114
123+
"P": 39.28136071677266,
124+
"S": 246.94791520712943,
125+
"Q": 243.8037069557934
126126
}
127127
},
128128
"total_losses": {
129-
"all_windings_losses": 0.6900431923699826,
130-
"eddy_core": 0.3741369333406631,
129+
"all_windings_losses": 0.6889948519566834,
130+
"eddy_core": 0.37011728617857176,
131131
"hyst_core_fundamental_freq": 0,
132-
"core": 0.3741369333406631,
133-
"total_core_part_1": 0.3741369333406631,
134-
"total_losses": 1.0641801257106458
132+
"core": 0.37011728617857176,
133+
"total_core_part_1": 0.37011728617857176,
134+
"total_losses": 1.059112138135255
135135
},
136136
"simulation_settings": {
137137
"simulation_name": null,
138-
"date": "2024-01-13 00:27:49",
138+
"date": "2025-02-24 12:49:53",
139139
"component_type": "Inductor",
140-
"working_directory": "C:\\Users\\uthmn\\PycharmProjects\\FEM_Magnetics_Toolbox\\femmt\\examples\\example_results\\inductor",
140+
"working_directory": "/home/nikolasf/Dokumente/01_git/30_Python/FEMMT/tests/integration/temp",
141141
"core": {
142142
"core_type": 1,
143143
"core_inner_diameter": 0.0149,
@@ -242,4 +242,4 @@
242242
],
243243
"total_cost_incl_margin": 5.281563525657976
244244
}
245-
}
245+
}

0 commit comments

Comments
 (0)