femagtools 1.6.8__py3-none-any.whl → 1.7.1__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.
- femagtools/__init__.py +2 -2
- femagtools/bch.py +1 -1
- femagtools/dxfsl/area.py +343 -406
- femagtools/dxfsl/areabuilder.py +139 -12
- femagtools/dxfsl/conv.py +27 -9
- femagtools/dxfsl/converter.py +406 -127
- femagtools/dxfsl/corner.py +3 -0
- femagtools/dxfsl/femparser.py +1 -1
- femagtools/dxfsl/fslrenderer.py +290 -246
- femagtools/dxfsl/functions.py +4 -2
- femagtools/dxfsl/geom.py +1204 -893
- femagtools/dxfsl/journal.py +58 -22
- femagtools/dxfsl/machine.py +254 -75
- femagtools/dxfsl/plotrenderer.py +38 -3
- femagtools/dxfsl/shape.py +380 -103
- femagtools/dxfsl/symmetry.py +679 -110
- femagtools/femag.py +27 -2
- femagtools/forcedens.py +65 -40
- femagtools/fsl.py +71 -28
- femagtools/losscoeffs.py +46 -0
- femagtools/machine/effloss.py +8 -1
- femagtools/machine/im.py +3 -1
- femagtools/machine/pm.py +11 -7
- femagtools/machine/sizing.py +15 -12
- femagtools/machine/sm.py +114 -33
- femagtools/machine/utils.py +38 -34
- femagtools/model.py +12 -2
- femagtools/moo/population.py +1 -1
- femagtools/parstudy.py +17 -1
- femagtools/plot/__init__.py +1 -1
- femagtools/plot/char.py +24 -7
- femagtools/plot/forcedens.py +56 -29
- femagtools/plot/mcv.py +4 -1
- femagtools/plot/phasor.py +6 -1
- femagtools/poc.py +17 -10
- femagtools/templates/cogg_calc.mako +7 -1
- femagtools/templates/displ_stator_rotor.mako +33 -0
- femagtools/templates/fieldcalc.mako +10 -16
- femagtools/templates/pm_sym_f_cur.mako +1 -1
- femagtools/tks.py +3 -9
- {femagtools-1.6.8.dist-info → femagtools-1.7.1.dist-info}/LICENSE +1 -0
- {femagtools-1.6.8.dist-info → femagtools-1.7.1.dist-info}/METADATA +7 -4
- {femagtools-1.6.8.dist-info → femagtools-1.7.1.dist-info}/RECORD +51 -50
- {femagtools-1.6.8.dist-info → femagtools-1.7.1.dist-info}/WHEEL +1 -1
- tests/engines/__init__.py +0 -20
- tests/geom/__init__.py +0 -20
- tests/moo/__init__.py +0 -20
- tests/test_model.py +8 -1
- tests/test_sizing.py +2 -2
- {femagtools-1.6.8.dist-info → femagtools-1.7.1.dist-info}/entry_points.txt +0 -0
- {femagtools-1.6.8.dist-info → femagtools-1.7.1.dist-info}/top_level.txt +0 -0
femagtools/dxfsl/journal.py
CHANGED
@@ -26,9 +26,8 @@ def getJournal(name=None, aktiv=False):
|
|
26
26
|
global journal
|
27
27
|
if not journal:
|
28
28
|
if not name:
|
29
|
-
|
30
|
-
|
31
|
-
journal = Journal(name=name, aktiv=True)
|
29
|
+
name = 'none'
|
30
|
+
journal = Journal(name=name, aktiv=aktiv)
|
32
31
|
return journal
|
33
32
|
|
34
33
|
|
@@ -40,6 +39,7 @@ class Journal(object):
|
|
40
39
|
self.aktiv = aktiv
|
41
40
|
self.journal = {}
|
42
41
|
self.data = {}
|
42
|
+
self.data_key = None
|
43
43
|
self.filename = Path('{}.json'.format(self.name))
|
44
44
|
|
45
45
|
def open_journal(self):
|
@@ -55,10 +55,18 @@ class Journal(object):
|
|
55
55
|
if not self.journal:
|
56
56
|
return
|
57
57
|
self.set_benchmark()
|
58
|
+
self.sort_by_keys()
|
58
59
|
with open(self.filename, 'w') as f:
|
59
60
|
f.write(json.dumps(self.journal, indent=4))
|
60
61
|
f.close()
|
61
62
|
|
63
|
+
def sort_by_keys(self):
|
64
|
+
myKeys = list(self.data.keys())
|
65
|
+
myKeys.sort()
|
66
|
+
sorted_dict = {i: self.data[i] for i in myKeys}
|
67
|
+
self.data = sorted_dict
|
68
|
+
self.journal[self.data_key] = sorted_dict
|
69
|
+
|
62
70
|
def get_journal(self, name):
|
63
71
|
if not self.aktiv:
|
64
72
|
return None
|
@@ -69,31 +77,58 @@ class Journal(object):
|
|
69
77
|
self.open_journal()
|
70
78
|
self.data = self.journal.get(name, None)
|
71
79
|
self.data = {'filename': ""} # initialise
|
80
|
+
self.data_key = name
|
72
81
|
self.journal[name] = self.data
|
73
82
|
return self.data
|
74
83
|
|
84
|
+
def get_total(self, name):
|
85
|
+
val = self.data.get(name, None)
|
86
|
+
if val is None:
|
87
|
+
return 0
|
88
|
+
if isinstance(val, list):
|
89
|
+
if not val:
|
90
|
+
return 0
|
91
|
+
if isinstance(val[0], int) or isinstance(val[0], float):
|
92
|
+
val = sum(val)
|
93
|
+
return val
|
94
|
+
return len(val)
|
95
|
+
if isinstance(val, int) or isinstance(val, float):
|
96
|
+
return val
|
97
|
+
return 1 # entries
|
98
|
+
|
75
99
|
def set_benchmark(self):
|
76
|
-
if self.
|
100
|
+
if self.get_total('area_errors') > 0:
|
77
101
|
self.put_warning("Problem with areas")
|
78
|
-
if self.
|
102
|
+
if self.get_total('appendices_deleted') > 0:
|
79
103
|
self.put_warning("Problem with appendices")
|
80
104
|
|
105
|
+
def set(self, name, val):
|
106
|
+
if not self.data:
|
107
|
+
return
|
108
|
+
self.data[name] = val
|
109
|
+
|
81
110
|
def put(self, name, val):
|
82
|
-
if self.data:
|
111
|
+
if not self.data:
|
112
|
+
return
|
113
|
+
data = self.data.get(name, None)
|
114
|
+
if data is None:
|
83
115
|
self.data[name] = val
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
116
|
+
return
|
117
|
+
if isinstance(data, list):
|
118
|
+
self.data[name].append(val)
|
119
|
+
return
|
120
|
+
data_list = [data]
|
121
|
+
data_list.append(val)
|
122
|
+
self.data[name] = data_list
|
88
123
|
|
89
124
|
def put_filename(self, val):
|
90
125
|
self.put('filename', val)
|
91
126
|
|
92
127
|
def put_areas(self, val):
|
93
|
-
self.
|
128
|
+
self.put('areas', val)
|
94
129
|
|
95
130
|
def put_area_errors(self, val):
|
96
|
-
self.
|
131
|
+
self.put('area_errors', val)
|
97
132
|
|
98
133
|
def put_elements(self, val):
|
99
134
|
self.put('elements', val)
|
@@ -102,27 +137,28 @@ class Journal(object):
|
|
102
137
|
self.put('nodes', val)
|
103
138
|
|
104
139
|
def put_concat_lines(self, val):
|
105
|
-
self.
|
140
|
+
self.put('concat_lines', val)
|
106
141
|
|
107
142
|
def put_concat_arcs(self, val):
|
108
|
-
self.
|
143
|
+
self.put('concat_arcs', val)
|
109
144
|
|
110
145
|
def put_appendices(self, val):
|
111
|
-
self.
|
146
|
+
self.put('appendices', val)
|
112
147
|
|
113
148
|
def put_appendices_connected(self, val):
|
114
|
-
self.
|
149
|
+
self.put('appendices_connected', val)
|
115
150
|
|
116
151
|
def put_appendices_remaining(self, val):
|
117
|
-
self.
|
152
|
+
self.put('appendices_remaining', val)
|
118
153
|
|
119
154
|
def put_appendices_deleted(self, val):
|
120
|
-
self.
|
121
|
-
|
155
|
+
self.put('appendices_deleted', val)
|
156
|
+
|
157
|
+
def put_nodes_connected(self, val):
|
158
|
+
self.put('nodes_connected', val)
|
159
|
+
|
122
160
|
def put_exception(self, msg):
|
123
161
|
self.put('exception', msg)
|
124
162
|
|
125
163
|
def put_warning(self, msg):
|
126
|
-
|
127
|
-
lst.append(msg)
|
128
|
-
self.put('warning', lst)
|
164
|
+
self.put('warning', msg)
|