PyFemtet 0.2.1__tar.gz → 0.2.3__tar.gz
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.
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/PKG-INFO +4 -2
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/gau_ex08_parametric.py +1 -1
- pyfemtet-0.2.3/pyfemtet/__init__.py +1 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/opt/base.py +3 -3
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/opt/monitor.py +22 -2
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/opt/optimizer.py +2 -2
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyproject.toml +2 -2
- pyfemtet-0.2.1/pyfemtet/__init__.py +0 -1
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/LICENSE +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/README.md +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/her_ex40_parametric.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/FemtetPJTSample/wat_ex14_parametric.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/_opt/_NX_Femtet.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/_opt/_SW_Femtet.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/_opt/_SimplestUI.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/_opt/visualization/ProcessMonitor.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/_opt/visualization/_dash.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/_opt/visualization/_visualization.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/_opt/visualization/_visualizationNameSpace.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/opt/_FemtetWithNX/update_model.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/opt/core.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/opt/interface.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/tools/DispatchUtils.py +0 -0
- {pyfemtet-0.2.1 → pyfemtet-0.2.3}/pyfemtet/tools/__init__.py +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyfemtet
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Design parameter optimization using Femtet.
|
|
5
5
|
Home-page: https://github.com/pyfemtet/pyfemtet
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
Author: kazuma.naito
|
|
8
8
|
Author-email: kazuma.naito@murata.com
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.9,<3.12
|
|
10
10
|
Classifier: License :: OSI Approved :: BSD License
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
15
|
Requires-Dist: botorch (>=0.9.5,<0.10.0)
|
|
14
16
|
Requires-Dist: dash (>=2.14.2,<3.0.0)
|
|
@@ -36,7 +36,7 @@ if __name__ == '__main__':
|
|
|
36
36
|
femopt.add_parameter("r", 5, lower_bound=1, upper_bound=10, memo='コイル半径')
|
|
37
37
|
femopt.add_parameter("n", 3, lower_bound=1, upper_bound=5, memo='コイル巻き数')
|
|
38
38
|
|
|
39
|
-
# インダクタンスが 0.
|
|
39
|
+
# インダクタンスが 0.1 uF に近づくようにゴールを設定
|
|
40
40
|
femopt.add_objective(
|
|
41
41
|
inductance, name='自己インダクタンス', direction=0.1e-06
|
|
42
42
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.3"
|
|
@@ -20,7 +20,7 @@ from .interface import FEMInterface, FemtetInterface
|
|
|
20
20
|
from .monitor import Monitor
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def symlog(x: float
|
|
23
|
+
def symlog(x: float or np.ndarray):
|
|
24
24
|
"""Log function whose domain is extended to the negative region.
|
|
25
25
|
|
|
26
26
|
Symlog processing is performed internally as a measure to reduce
|
|
@@ -28,7 +28,7 @@ def symlog(x: float | np.ndarray):
|
|
|
28
28
|
between objective functions in multi-objective optimization.
|
|
29
29
|
|
|
30
30
|
Args:
|
|
31
|
-
x (float
|
|
31
|
+
x (float or np.ndarray)
|
|
32
32
|
|
|
33
33
|
Returns:
|
|
34
34
|
float
|
|
@@ -381,7 +381,7 @@ class History:
|
|
|
381
381
|
|
|
382
382
|
# serialize
|
|
383
383
|
try:
|
|
384
|
-
self.actor_data.to_csv(self.path, index=None)
|
|
384
|
+
self.actor_data.to_csv(self.path, index=None, encoding='shift-jis')
|
|
385
385
|
except PermissionError:
|
|
386
386
|
print(f'warning: {self.path} がロックされています。データはロック解除後に保存されます。')
|
|
387
387
|
|
|
@@ -103,6 +103,11 @@ def setup_home():
|
|
|
103
103
|
dbc.CardBody(html.P(id="card-content", className="card-text")),
|
|
104
104
|
]
|
|
105
105
|
)
|
|
106
|
+
status = dbc.Alert(
|
|
107
|
+
children=[html.H4("optimization status here", className="alert-heading"),],
|
|
108
|
+
color="primary",
|
|
109
|
+
id='status-alert'
|
|
110
|
+
)
|
|
106
111
|
toggle_update_button = dbc.Button('グラフの自動更新の一時停止', id='toggle-update-button')
|
|
107
112
|
interrupt_button = dbc.Button('最適化を中断', id='interrupt-button', color='danger')
|
|
108
113
|
status_text = dcc.Markdown(f'''
|
|
@@ -120,6 +125,7 @@ OptimizerBase.set_monitor_server() を実行してください。
|
|
|
120
125
|
dbc.Row([dbc.Col(dummy), dbc.Col(interval)]),
|
|
121
126
|
dbc.Row([dbc.Col(header)]),
|
|
122
127
|
dbc.Row([dbc.Col(graphs)]),
|
|
128
|
+
dbc.Row([dbc.Col(status)]),
|
|
123
129
|
dbc.Row([dbc.Col(toggle_update_button), dbc.Col(interrupt_button)]),
|
|
124
130
|
dbc.Row([dbc.Col(status_text)]),
|
|
125
131
|
], fluid=True)
|
|
@@ -211,6 +217,7 @@ class Monitor(object):
|
|
|
211
217
|
# 3. メイン処理が中断 or 終了していたら ==> 更新を無効にする and 中断を無効にする
|
|
212
218
|
# 4. toggle_button が押されたら ==> 更新を有効にする or 更新を無効にする
|
|
213
219
|
# 5. タブを押したら ==> グラフの種類を切り替える
|
|
220
|
+
# 6. state に応じて を切り替える
|
|
214
221
|
@self.app.callback(
|
|
215
222
|
[
|
|
216
223
|
Output('interval-component', 'max_intervals'), # 2 3 4
|
|
@@ -218,6 +225,8 @@ class Monitor(object):
|
|
|
218
225
|
Output('toggle-update-button', 'disabled'), # 2 3 4
|
|
219
226
|
Output('toggle-update-button', 'children'), # 2 3 4
|
|
220
227
|
Output('card-content', 'children'), # 1 5
|
|
228
|
+
Output('status-alert', 'children'), # 6
|
|
229
|
+
Output('status-alert', 'color'), # 6
|
|
221
230
|
],
|
|
222
231
|
[
|
|
223
232
|
Input('interval-component', 'n_intervals'), # 1 3
|
|
@@ -241,6 +250,8 @@ class Monitor(object):
|
|
|
241
250
|
button_disable = False
|
|
242
251
|
toggle_text = 'グラフの自動更新を一時停止する'
|
|
243
252
|
graph = None
|
|
253
|
+
status_children = None
|
|
254
|
+
status_color = 'primary'
|
|
244
255
|
|
|
245
256
|
# toggle_button が奇数なら interval を disable にする
|
|
246
257
|
if toggle_n_clicks % 2 == 1:
|
|
@@ -253,7 +264,8 @@ class Monitor(object):
|
|
|
253
264
|
try:
|
|
254
265
|
state = self.femopt.ipv.get_state()
|
|
255
266
|
should_stop = (state == 'interrupted') or (state == 'terminated')
|
|
256
|
-
except AttributeError:
|
|
267
|
+
except AttributeError: # after ray.shutdown
|
|
268
|
+
state = 'terminated'
|
|
257
269
|
should_stop = True
|
|
258
270
|
finally:
|
|
259
271
|
if should_stop:
|
|
@@ -268,6 +280,7 @@ class Monitor(object):
|
|
|
268
280
|
button_disable = True
|
|
269
281
|
toggle_text = 'グラフの更新は行われません'
|
|
270
282
|
self.femopt.ipv.set_state('interrupted')
|
|
283
|
+
state = 'interrupted'
|
|
271
284
|
|
|
272
285
|
# グラフを更新する
|
|
273
286
|
if active_tab_id is not None:
|
|
@@ -276,7 +289,14 @@ class Monitor(object):
|
|
|
276
289
|
elif active_tab_id == "tab-2":
|
|
277
290
|
graph = dcc.Graph(figure=update_hypervolume_plot(self.femopt))
|
|
278
291
|
|
|
279
|
-
|
|
292
|
+
# status を更新する
|
|
293
|
+
status_children = [html.H4('optimization status: ' + state, className="alert-heading"), ]
|
|
294
|
+
if state == 'interrupted':
|
|
295
|
+
status_color = 'dark'
|
|
296
|
+
if state == 'terminated':
|
|
297
|
+
status_color = 'dark'
|
|
298
|
+
|
|
299
|
+
return max_intervals, button_disable, button_disable, toggle_text, graph, status_children, status_color
|
|
280
300
|
|
|
281
301
|
def start_server(self, host='localhost', port=8080):
|
|
282
302
|
|
|
@@ -17,7 +17,7 @@ from .base import OptimizerBase
|
|
|
17
17
|
warnings.filterwarnings('ignore', category=ExperimentalWarning)
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def generate_lhs(bounds: list[list[float]], seed: int
|
|
20
|
+
def generate_lhs(bounds: list[list[float]], seed: int or None = None) -> np.ndarray:
|
|
21
21
|
"""Latin Hypercube Sampling from given design parameter bounds.
|
|
22
22
|
|
|
23
23
|
If the number of parameters is d,
|
|
@@ -27,7 +27,7 @@ def generate_lhs(bounds: list[list[float]], seed: int | None = None) -> np.ndarr
|
|
|
27
27
|
|
|
28
28
|
Args:
|
|
29
29
|
bounds (list[list[float]]): List of [lower_bound, upper_bound] of parameters.
|
|
30
|
-
seed (int
|
|
30
|
+
seed (int or None, optional): Random seed. Defaults to None.
|
|
31
31
|
|
|
32
32
|
Returns:
|
|
33
33
|
np.ndarray: (N, d) shape ndarray.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyfemtet"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.3" # ignored by versioning plugin
|
|
4
4
|
description = "Design parameter optimization using Femtet."
|
|
5
5
|
authors = ["kazuma.naito <kazuma.naito@murata.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -8,7 +8,7 @@ license = "BSD-3-Clause"
|
|
|
8
8
|
repository = "https://github.com/pyfemtet/pyfemtet"
|
|
9
9
|
|
|
10
10
|
[tool.poetry.dependencies]
|
|
11
|
-
python = "
|
|
11
|
+
python = " >= 3.9, < 3.12" # ray cannot match 3.12
|
|
12
12
|
numpy = "^1.26.2"
|
|
13
13
|
pandas = "^2.1.3"
|
|
14
14
|
openpyxl = "^3.1.2"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|