pyfemtet 0.4.21__py3-none-any.whl → 0.4.24__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.

Potentially problematic release.


This version of pyfemtet might be problematic. Click here for more details.

Files changed (54) hide show
  1. pyfemtet/__init__.py +1 -1
  2. pyfemtet/_test_util.py +0 -2
  3. pyfemtet/message/messages.py +15 -1
  4. pyfemtet/opt/_femopt.py +233 -199
  5. pyfemtet/opt/_femopt_core.py +116 -47
  6. pyfemtet/opt/femprj_sample/ParametricIF.py +0 -2
  7. pyfemtet/opt/femprj_sample/cad_ex01_NX.py +0 -8
  8. pyfemtet/opt/femprj_sample/cad_ex01_SW.py +0 -8
  9. pyfemtet/opt/femprj_sample/gal_ex58_parametric.py +0 -8
  10. pyfemtet/opt/femprj_sample/gau_ex08_parametric.py +0 -8
  11. pyfemtet/opt/femprj_sample/her_ex40_parametric.py +0 -8
  12. pyfemtet/opt/femprj_sample/paswat_ex1_parametric.py +0 -8
  13. pyfemtet/opt/femprj_sample/paswat_ex1_parametric_parallel.py +0 -8
  14. pyfemtet/opt/femprj_sample/wat_ex14_parametric.py +0 -8
  15. pyfemtet/opt/femprj_sample/wat_ex14_parametric_parallel.py +0 -8
  16. pyfemtet/opt/femprj_sample_jp/ParametricIF_jp.py +0 -2
  17. pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.py +0 -8
  18. pyfemtet/opt/femprj_sample_jp/cad_ex01_SW_jp.py +0 -8
  19. pyfemtet/opt/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -8
  20. pyfemtet/opt/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -8
  21. pyfemtet/opt/femprj_sample_jp/her_ex40_parametric_jp.py +0 -8
  22. pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -8
  23. pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -8
  24. pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -8
  25. pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -8
  26. pyfemtet/opt/opt/_base.py +4 -4
  27. pyfemtet/opt/opt/_optuna.py +33 -1
  28. pyfemtet/opt/opt/_optuna_botorch_helper.py +209 -0
  29. pyfemtet/opt/visualization/complex_components/main_graph.py +22 -5
  30. pyfemtet/opt/visualization/complex_components/pm_graph.py +77 -25
  31. pyfemtet/opt/visualization/complex_components/pm_graph_creator.py +7 -0
  32. pyfemtet/opt/visualization/process_monitor/application.py +10 -6
  33. pyfemtet/opt/visualization/process_monitor/pages.py +102 -0
  34. pyfemtet/opt/visualization/result_viewer/application.py +6 -0
  35. pyfemtet/opt/visualization/result_viewer/pages.py +1 -1
  36. {pyfemtet-0.4.21.dist-info → pyfemtet-0.4.24.dist-info}/METADATA +2 -4
  37. {pyfemtet-0.4.21.dist-info → pyfemtet-0.4.24.dist-info}/RECORD +40 -53
  38. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj +0 -0
  39. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt +0 -0
  40. pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py +0 -118
  41. pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.SLDPRT +0 -0
  42. pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.femprj +0 -0
  43. pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.py +0 -121
  44. pyfemtet/FemtetPJTSample/_her_ex40_parametric.py +0 -148
  45. pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj +0 -0
  46. pyfemtet/FemtetPJTSample/gau_ex08_parametric.py +0 -58
  47. pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj +0 -0
  48. pyfemtet/FemtetPJTSample/her_ex40_parametric.py +0 -148
  49. pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py +0 -65
  50. pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj +0 -0
  51. pyfemtet/FemtetPJTSample/wat_ex14_parametric.py +0 -64
  52. {pyfemtet-0.4.21.dist-info → pyfemtet-0.4.24.dist-info}/LICENSE +0 -0
  53. {pyfemtet-0.4.21.dist-info → pyfemtet-0.4.24.dist-info}/WHEEL +0 -0
  54. {pyfemtet-0.4.21.dist-info → pyfemtet-0.4.24.dist-info}/entry_points.txt +0 -0
@@ -1,5 +1,7 @@
1
1
  from pyfemtet.opt.visualization.base import PyFemtetApplicationBase
2
2
  from pyfemtet.opt.visualization.result_viewer.pages import HomePage, PredictionModelPage
3
+ from pyfemtet.opt.visualization.process_monitor.pages import OptunaVisualizerPage
4
+
3
5
  from pyfemtet.message import Msg
4
6
 
5
7
 
@@ -24,9 +26,11 @@ def debug():
24
26
 
25
27
  g_home_page = HomePage(Msg.PAGE_TITLE_RESULT)
26
28
  g_rsm_page = PredictionModelPage(Msg.PAGE_TITLE_PREDICTION_MODEL, '/prediction-model', g_application)
29
+ g_optuna = OptunaVisualizerPage(Msg.PAGE_TITLE_OPTUNA_VISUALIZATION, '/optuna', g_application)
27
30
 
28
31
  g_application.add_page(g_home_page, 0)
29
32
  g_application.add_page(g_rsm_page, 1)
33
+ g_application.add_page(g_optuna, 2)
30
34
  g_application.setup_callback()
31
35
 
32
36
  g_application.run(debug=True)
@@ -37,9 +41,11 @@ def main():
37
41
 
38
42
  g_home_page = HomePage(Msg.PAGE_TITLE_RESULT)
39
43
  g_rsm_page = PredictionModelPage(Msg.PAGE_TITLE_PREDICTION_MODEL, '/prediction-model', g_application)
44
+ g_optuna = OptunaVisualizerPage(Msg.PAGE_TITLE_OPTUNA_VISUALIZATION, '/optuna', g_application)
40
45
 
41
46
  g_application.add_page(g_home_page, 0)
42
47
  g_application.add_page(g_rsm_page, 1)
48
+ g_application.add_page(g_optuna, 2)
43
49
  g_application.setup_callback()
44
50
 
45
51
  g_application.run()
@@ -281,7 +281,7 @@ class HomePage(AbstractPage):
281
281
  trial = pt['customdata'][0]
282
282
 
283
283
  # get parameter and update model
284
- df = self.application.history.local_data
284
+ df = self.application.history.get_df()
285
285
  row = df[df['trial'] == trial]
286
286
  metadata = np.array(self.application.history.metadata)
287
287
  idx = np.where(metadata == 'prm')[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyfemtet
3
- Version: 0.4.21
3
+ Version: 0.4.24
4
4
  Summary: Design parameter optimization using Femtet.
5
5
  Home-page: https://github.com/pyfemtet/pyfemtet
6
6
  License: BSD-3-Clause
@@ -13,8 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: babel (>=2.15.0,<3.0.0)
16
- Requires-Dist: botorch (>=0.9.5) ; python_version >= "3.12" and python_version < "3.13"
17
- Requires-Dist: botorch (>=0.9.5,<0.10.0) ; python_version < "3.12"
16
+ Requires-Dist: botorch (==0.9.5)
18
17
  Requires-Dist: colorlog (>=6.8.0,<7.0.0)
19
18
  Requires-Dist: dash (>=2.17.0,<3.0.0)
20
19
  Requires-Dist: dash-bootstrap-components (>=1.5.0,<2.0.0)
@@ -28,7 +27,6 @@ Requires-Dist: optuna-integration (>=3.6.0,<4.0.0)
28
27
  Requires-Dist: pandas (>=2.1.3,<3.0.0)
29
28
  Requires-Dist: plotly (>=5.22.0,<6.0.0)
30
29
  Requires-Dist: psutil (>=5.9.6,<6.0.0)
31
- Requires-Dist: pytest-dashboard (>=0.1.2,<0.2.0)
32
30
  Requires-Dist: pywin32 (>=306,<307)
33
31
  Requires-Dist: scipy (>=1.11.4,<2.0.0)
34
32
  Requires-Dist: torch (>=2.3.0,<2.4.0)
@@ -1,19 +1,5 @@
1
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj,sha256=JfzRl_C72doQFJO0hJq8BTX6TSFB_Skh2C4l-kiWoXY,170268
2
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt,sha256=3okHLeMdslrRA_wkhppZtxIe-2-ZPMfNqWCdQwUV31o,226626
3
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py,sha256=YJ3nszFLYfd7m4CaQ6ZG9DS_aHdgQIdSHCopmGakBWE,3980
4
- pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.SLDPRT,sha256=U0Yh559Fygd5sp013NwwhZ5vRA8D_E6kmiUXDP5isJQ,83094
5
- pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.femprj,sha256=omF3QvS8gzi_fSr2yobbVVaspR2YzDiUcMYvei-8ZmQ,155307
6
- pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.py,sha256=Irv3nNXkQpCGZgy41IcWwGKVddW6oOziwe6EyantUn4,4182
7
- pyfemtet/FemtetPJTSample/_her_ex40_parametric.py,sha256=B5PQoh71Q3KN2CyLU1gP_Yh9g3o6poi0HFasWzHQ_vk,5144
8
- pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj,sha256=EguPWZHcwZMMX8cX1rZhLc2Pr__P4PR8RF4_n4uxDaI,268761
9
- pyfemtet/FemtetPJTSample/gau_ex08_parametric.py,sha256=B-ibQDodTLcJ-wc8sNVb1Dxae2ksL6Fns3uNBRU7s5g,1799
10
- pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj,sha256=ZFQ1Rl31dmLhYW__yahRYLejKw5DdccPGdpg67CWlS0,126336
11
- pyfemtet/FemtetPJTSample/her_ex40_parametric.py,sha256=B5PQoh71Q3KN2CyLU1gP_Yh9g3o6poi0HFasWzHQ_vk,5144
12
- pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py,sha256=UfhJffuXyhzdIWNpOrpV6xLTK1fuVvgyhlyg4Rp-628,2148
13
- pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj,sha256=pxacKe0NPNUPAcxqo2cATFApsMKiVt2g2e_FOk4fpjA,172895
14
- pyfemtet/FemtetPJTSample/wat_ex14_parametric.py,sha256=LGbWxCek0Ad2YrDCKykiQkE3aIypM4g8P3mLd_2anEE,2052
15
- pyfemtet/__init__.py,sha256=1n-NaGbhCs2-5sTHYY-kUYdFODaECYkQxiDw4p6nNng,22
16
- pyfemtet/_test_util.py,sha256=CT9J19qQ4gYT5glFs8WwlTDmc3SokvdE5ucpB-KCOro,4274
1
+ pyfemtet/__init__.py,sha256=LCS1ryUP4e5uYaNvtTtYvsm3x-_EtvKrlSrr2OZR6DA,22
2
+ pyfemtet/_test_util.py,sha256=v41jPexrQFdBCn8n5W0xirgfgWSsN-WQudnnS40PpWc,4235
17
3
  pyfemtet/core.py,sha256=3lqfBGJ5IuKz2Nqj5pRo7YQqKwx_0ZDL72u95Ur_1p0,1386
18
4
  pyfemtet/dispatch_extensions.py,sha256=XVZajbjh7mb6NG4Hq8qff2TJWab75r4Hd59cIvCRsVg,16213
19
5
  pyfemtet/logger.py,sha256=JYD0FvzijMS2NvZN7VT7vZA5hqtHEkvS93AHlIMDePw,2507
@@ -24,35 +10,35 @@ pyfemtet/message/babel.cfg,sha256=rlvsm_EjDU2ki-OLVPG3toWspVuVA0JFAFvFp2U-By4,72
24
10
  pyfemtet/message/locales/ja/LC_MESSAGES/messages.mo,sha256=VbUncnHf3ztDF3WqaoNd4AcGqpYKLMEKc1LL5P4yuoQ,16965
25
11
  pyfemtet/message/locales/ja/LC_MESSAGES/messages.po,sha256=6UtCDxiDiRetnnSRo-l_BunYfYoIm0L-9Z8qU3r8z8Q,21723
26
12
  pyfemtet/message/locales/messages.pot,sha256=JWknwqPn_541aeIEbxp9Y2tqXvUcoM-vgdjeUo4C2T0,12336
27
- pyfemtet/message/messages.py,sha256=GCzjA6dBLI8108K3hel82pcr1nYTvjJKCfCAn5jZ5OM,11324
13
+ pyfemtet/message/messages.py,sha256=5noem1v82W0hNB-PTQq-Y3jz-VpXLUurxKcjviU_vBY,12628
28
14
  pyfemtet/opt/__init__.py,sha256=AJc1_d0sQ2_X4h_8FOcdmHvSPrFV_vfxlRrZTsqDZuE,612
29
- pyfemtet/opt/_femopt.py,sha256=lJJYDNoeAFlPEDD7mMz5PXA-x91vz6u0hnai7FLJJ30,24905
30
- pyfemtet/opt/_femopt_core.py,sha256=ezf-E1_oaupSgHb0mwPooV0nvsrQC1wgtumN5WzQop8,25311
15
+ pyfemtet/opt/_femopt.py,sha256=n8wUEYSoN88wIbus9d26zl9Lqq2CkZG3LNt6aMdJreU,27229
16
+ pyfemtet/opt/_femopt_core.py,sha256=6tjaepx_2qrgBk52KnjmYL7yMiJPYx3zD4Y5wX0ozXo,27417
31
17
  pyfemtet/opt/femprj_sample/.gitignore,sha256=hx-5Hhaf7kpHe1wvWWfJqjPfObg-zf9CTI4joNh2Hk4,28
32
18
  pyfemtet/opt/femprj_sample/ParametricIF - True.femprj,sha256=tCd29CUXmyJ0VH6cV0xTdjQMLBPkCk0UrFwvRbyrcYA,431415
33
19
  pyfemtet/opt/femprj_sample/ParametricIF.femprj,sha256=9BtDHmc3cdom0Zq33DTdZ0mDAsIUY6i8SRkkg-n7GO0,442090
34
- pyfemtet/opt/femprj_sample/ParametricIF.py,sha256=yzFmG0041RMOBc1qQW46st5uMrplSf25JCbYUADvM3k,774
20
+ pyfemtet/opt/femprj_sample/ParametricIF.py,sha256=oXzchBZEbH69xacDht5HDnbZzKwapXsn6bp9qihY17Y,707
35
21
  pyfemtet/opt/femprj_sample/ParametricIF_test_result.reccsv,sha256=TiOAqEDMub6SCGYClBv1JvQxphDOY3iIdr_pMmGgJ9M,2859
36
22
  pyfemtet/opt/femprj_sample/cad_ex01_NX.femprj,sha256=KC8JlHqHzqgyKriK911QSnQByQpRlw-SX5OSQ_GNe5M,149193
37
23
  pyfemtet/opt/femprj_sample/cad_ex01_NX.prt,sha256=3okHLeMdslrRA_wkhppZtxIe-2-ZPMfNqWCdQwUV31o,226626
38
- pyfemtet/opt/femprj_sample/cad_ex01_NX.py,sha256=TmM8wQ5CuesS8-QWlQNwykoAJWaPxUfNjqjx7xhDqz8,4892
24
+ pyfemtet/opt/femprj_sample/cad_ex01_NX.py,sha256=_wrpHQ6NlNJ9js0PwR3tfuxXt5fxORTa9h8BvjiWOcg,4621
39
25
  pyfemtet/opt/femprj_sample/cad_ex01_NX_test_result.reccsv,sha256=hFxjat32G71F3XE_UtC9zzi5HZxu0Q0MXjU9e1xVIDM,4710
40
26
  pyfemtet/opt/femprj_sample/cad_ex01_SW.SLDPRT,sha256=jjBi4aRRwZPK-4-YRKDC4eO_Ch2jwd7M7chvJlnBbZU,97158
41
27
  pyfemtet/opt/femprj_sample/cad_ex01_SW.femprj,sha256=knN0bBTHm5CqExLdmxdJvPldJ6ahnQesKt974qRjWh4,126837
42
- pyfemtet/opt/femprj_sample/cad_ex01_SW.py,sha256=AtKGRMMweXjIriYe5kxEecrNK5KPdf2XMNm54nVK-1o,4830
28
+ pyfemtet/opt/femprj_sample/cad_ex01_SW.py,sha256=JoGQSwH3yJnABxyd-WJfrwMkhd1UV0yYF2L2RvMFXmc,4559
43
29
  pyfemtet/opt/femprj_sample/cad_ex01_SW_test_result.reccsv,sha256=NS0Zik2c1mbMdGa0hGJaRQdCD08Bltx84n9QzP5CjPo,4736
44
30
  pyfemtet/opt/femprj_sample/gal_ex58_parametric.femprj,sha256=dbanN3W2eX_ciZ0wZGqK60mc4edSVh5G2OqbbMKyFng,74898
45
- pyfemtet/opt/femprj_sample/gal_ex58_parametric.py,sha256=imD84lKenIbkxY9La37SWbPvJlhXJRnV_IFtE0tQ5ac,2729
31
+ pyfemtet/opt/femprj_sample/gal_ex58_parametric.py,sha256=RxLSXFs0SqUjlug_JZAKlkJhqJdQCY3Y3F-DtSQRtVM,2458
46
32
  pyfemtet/opt/femprj_sample/gal_ex58_parametric_test_result.reccsv,sha256=IcGm9f5YEACTGavoyMlAY-zUvsl-Zz-rTlSRhBVDzz8,1267
47
33
  pyfemtet/opt/femprj_sample/gau_ex08_parametric.femprj,sha256=Yb9ILeTEKx5xfJGk8IZH_DVlgkpGB33Vy9-LGIEQboY,279251
48
- pyfemtet/opt/femprj_sample/gau_ex08_parametric.py,sha256=SzHKPrK05Muv5edvrMr91YYN6Zm51qHbWWLCWd94Ww8,2200
34
+ pyfemtet/opt/femprj_sample/gau_ex08_parametric.py,sha256=5KazqJ5wRbGs0dBMJslZ1eRCUWq8j3k1mqlhyB8M0g8,1929
49
35
  pyfemtet/opt/femprj_sample/gau_ex08_parametric_test_result.reccsv,sha256=yZ9aHthiKIBY_NMOz94Jl2dyHIH-GWMvukgHk4ZeT_o,3474
50
36
  pyfemtet/opt/femprj_sample/her_ex40_parametric.femprj,sha256=LLAUDlUo1dIpRzlKPs1lvACzJQxjnWW3xAGAodYEqRM,117221
51
- pyfemtet/opt/femprj_sample/her_ex40_parametric.py,sha256=iEIkQLozBwQOBzv04nVH0JRUByPvfwPX50c1P9IRHfY,5083
37
+ pyfemtet/opt/femprj_sample/her_ex40_parametric.py,sha256=5WQ7pgYB3_-DCGg0KZuY0kPrWFkFrYc3VDRZmQpLJT8,4812
52
38
  pyfemtet/opt/femprj_sample/her_ex40_parametric_test_result.reccsv,sha256=UrNZP9DtjvE3wSgEVF9i4CxO26y3vPmIVF2lFpwy2Hw,3462
53
39
  pyfemtet/opt/femprj_sample/paswat_ex1_parametric.femprj,sha256=z2NHFJWiuiLv_zhxjFpLpmRbYVvQ43bAMj_NLioQGsk,262283
54
- pyfemtet/opt/femprj_sample/paswat_ex1_parametric.py,sha256=HXbkWYUtGB5p1IyCfrg-CQ6Q5HXTEtgAtKwa75iGXBo,2632
55
- pyfemtet/opt/femprj_sample/paswat_ex1_parametric_parallel.py,sha256=Px8fS_WrQ0N3xaD5eHyYvx2-kcx8Mf84CIC2STS1kKw,2743
40
+ pyfemtet/opt/femprj_sample/paswat_ex1_parametric.py,sha256=2oUBg2MvKuewO5Acs5FO3dkXX0QIZGRR5RRvKAb4CMk,2361
41
+ pyfemtet/opt/femprj_sample/paswat_ex1_parametric_parallel.py,sha256=V6XYS3RblruTi8T43lEnNl_3pgdsobknspsD_K2iEpU,2472
56
42
  pyfemtet/opt/femprj_sample/paswat_ex1_parametric_test_result.reccsv,sha256=6PjbmLfwDx01Z0pywDL9eT5lfRKgZDU3r_H2SfZYaT4,3885
57
43
  pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14.pdt,sha256=WTb5gutfp0NN64AbBAa5LOPjgDYQ8ix2FFeIYSc8Tfk,3382324
58
44
  pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial1.jpg,sha256=N11tFxfTixrwbCJOH1lhcw4UuPCYb-9xJAwiynbN2DE,44463
@@ -86,27 +72,27 @@ pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial8.pdt,sha256=43
86
72
  pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial9.jpg,sha256=ZszK2ZXT0WLkwrwg86I61EvCfg4QNCuslwkc3NC2D9g,41198
87
73
  pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial9.pdt,sha256=YNL2baRPN4Hb6cn2bw_5FwWI65h__plWI0JgIXW54zM,2907148
88
74
  pyfemtet/opt/femprj_sample/wat_ex14_parametric.femprj,sha256=F-yu2dGrsbrIA1Lhizu2aHTjQFTohyBmOuJv-Iyl8jk,179596
89
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.py,sha256=o_LeUpo779a8vCBjxqS6NNF5zS7ID4mBfFjHsYvI1vs,2484
90
- pyfemtet/opt/femprj_sample/wat_ex14_parametric_parallel.py,sha256=_kZVa4zSxY9UAa_CA1V_tFeTpjf4F8BHAJpYLZzF-r4,2560
75
+ pyfemtet/opt/femprj_sample/wat_ex14_parametric.py,sha256=K9ZlIkmD05NOF2dXnv4AmYsvM7klhm8Ss7irAr74MVQ,2213
76
+ pyfemtet/opt/femprj_sample/wat_ex14_parametric_parallel.py,sha256=UjPMpoZY99rJY9mqudsK7MOGURhzwOulwDkrRiclZzI,2289
91
77
  pyfemtet/opt/femprj_sample/wat_ex14_parametric_test_result.reccsv,sha256=bvHgcuFZ1iS8sb_FT5W7MuquODxmv3IcFkiNOdSMiK8,3450
92
78
  pyfemtet/opt/femprj_sample_jp/ParametricIF_jp.femprj,sha256=9BtDHmc3cdom0Zq33DTdZ0mDAsIUY6i8SRkkg-n7GO0,442090
93
- pyfemtet/opt/femprj_sample_jp/ParametricIF_jp.py,sha256=gv8RFRsTld1c5wCE0cfvc_lCj4gIFAl4LuBh9iWe_6k,789
79
+ pyfemtet/opt/femprj_sample_jp/ParametricIF_jp.py,sha256=oXzchBZEbH69xacDht5HDnbZzKwapXsn6bp9qihY17Y,707
94
80
  pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.femprj,sha256=0RBhOGhtiFAp0QSCTBYEaDY9EZymn9hJYchAOJ6PaBA,143533
95
- pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.py,sha256=sqhOskvRn84e1xET5rTfvbu5WG0kXvLoNfdAJ3e_XqA,5205
81
+ pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.py,sha256=B7wVemkiVzh0NJXDzG3fdigWBOb58ZxrJZUT4NRvW9Q,4899
96
82
  pyfemtet/opt/femprj_sample_jp/cad_ex01_SW_jp.femprj,sha256=ZZhT9XjB9Xu9YwHWv4gbvKBiUWlOFKEoHjAcGWb3vvQ,128026
97
- pyfemtet/opt/femprj_sample_jp/cad_ex01_SW_jp.py,sha256=qI_mU_0ype_6706CQphaLD_IF2ILawgNqPUCWsfbLsc,5143
83
+ pyfemtet/opt/femprj_sample_jp/cad_ex01_SW_jp.py,sha256=e-XaHBZ8syWlG9pObcDDkHGLC5t338zAt_NyRXty338,4837
98
84
  pyfemtet/opt/femprj_sample_jp/gal_ex58_parametric_jp.femprj,sha256=PzqtNVde6VnMHFpedRBsOq9JVhCY0ymQPVs54EKsNLw,75668
99
- pyfemtet/opt/femprj_sample_jp/gal_ex58_parametric_jp.py,sha256=MLLlWxpDo1JWWiglNc7XNoms3_IXPCj65aEPy_83tLs,2767
85
+ pyfemtet/opt/femprj_sample_jp/gal_ex58_parametric_jp.py,sha256=97np4uH-UQqpv4UDwJS0doFYA7TOkXnbhLdkZExdNek,2461
100
86
  pyfemtet/opt/femprj_sample_jp/gau_ex08_parametric_jp.femprj,sha256=TTXw_8YT8pzHQlu4ufGzTq1IFYSwcWWt4GA6sIY1YPM,295600
101
- pyfemtet/opt/femprj_sample_jp/gau_ex08_parametric_jp.py,sha256=g8VYoibnKwnNpK7KPZ321jrlSL28xJ3dKzP3FacovNw,2393
87
+ pyfemtet/opt/femprj_sample_jp/gau_ex08_parametric_jp.py,sha256=8Op_zwz9SD0NfGg4TFlcNvs-ZlU0bxgs5oaaI9UtlRU,2087
102
88
  pyfemtet/opt/femprj_sample_jp/her_ex40_parametric_jp.femprj,sha256=OJ7f8iw0z1BZqanuNn71uEaoM2Kgb93ptUU8iYwYON0,129783
103
- pyfemtet/opt/femprj_sample_jp/her_ex40_parametric_jp.py,sha256=eMrUZhyqIQ2jDl9kdHrTnpvmiw-6GkPJQBf7kaBilaI,5551
89
+ pyfemtet/opt/femprj_sample_jp/her_ex40_parametric_jp.py,sha256=t0M8sYeiCokETe6grdgvejfTCN__y_ZYdSQprtENntE,5245
104
90
  pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_jp.femprj,sha256=y7eURFBdqh6PmD4zbelGuB458HmfihVht0K4wVI-mik,265368
105
- pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_jp.py,sha256=HwLhd1xIq_wdQchjttKmcT4EU1lpNkcaAZDcK-L8C_w,2795
106
- pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py,sha256=utOjKYFSXqvrgPtphHMeYUQpDT20K7Iw2GBLG80ga5M,2911
91
+ pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_jp.py,sha256=ibXVhya5JV7CfCD2srQceXOj1sYjH3kWtaIEfyu98u4,2489
92
+ pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py,sha256=cY9RhoAFEnVUkfGhbXpn3LavT_NRp_OwVxGbL7jSbBQ,2605
107
93
  pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.femprj,sha256=dMwQMt6yok_PbZLyxPYdmg5wJQwgQDZ4RhS76zdGLGk,177944
108
- pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.py,sha256=W30jobW1eEYuAsJJR14-EifQ1fxeXlS-gRSFqgCP4BM,2590
109
- pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py,sha256=ul2JUwlM5jfjNRELHkT7ZDuyMOq5RAHO32vAweEhCwg,2641
94
+ pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.py,sha256=vMy-KUP1wEMV9Rt6yXjkE40Fcs1t1cpQK-nQJK8hHao,2284
95
+ pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py,sha256=4X0cl3YWpYarcNBCH79mrlyFuKUYSqvnGzokEbv9ILk,2335
110
96
  pyfemtet/opt/interface/__init__.py,sha256=qz5BszPuU3jZIoDnPjkPDAgvgHLlx1sYhuqh5ID798k,480
111
97
  pyfemtet/opt/interface/_base.py,sha256=I4pJttLeRW-6WWMuCNynwxWPwriiGZk20vHLVcfixZY,2332
112
98
  pyfemtet/opt/interface/_femtet.py,sha256=vWPEn8TpJFCSN48uk430kAFr7_5ralMoOGF8IKvpIjU,34441
@@ -116,8 +102,9 @@ pyfemtet/opt/interface/_femtet_with_nx/_interface.py,sha256=cibPOhsUAvTDJa1xdEhV
116
102
  pyfemtet/opt/interface/_femtet_with_nx/update_model.py,sha256=P7VH0i_o-X9OUe6AGaLF1fACPeHNrMjcrOBCA3MMrI4,3092
117
103
  pyfemtet/opt/interface/_femtet_with_sldworks.py,sha256=Ldr8Esa5xZ-D_E5uIXBTF2DHslXVMFDYOsqTd8FhY1M,6242
118
104
  pyfemtet/opt/opt/__init__.py,sha256=_9hkYtxk-8PfWkWJaiYqESrH5CnSKM2Gv93HxtD-f3o,383
119
- pyfemtet/opt/opt/_base.py,sha256=pIxreZzhT4YQOj7mtXnfidNqJ18ypZBpD2CK0G_uQ6Q,11425
120
- pyfemtet/opt/opt/_optuna.py,sha256=y4MnFPDyP1eheq5nUh786z0BM-pHNYrSwjo1TD044h0,11105
105
+ pyfemtet/opt/opt/_base.py,sha256=EZsmVQmLkWNXCV960XKdV6hFoKR74TloyPjJnKw-7PA,11424
106
+ pyfemtet/opt/opt/_optuna.py,sha256=sCAg5lHEY0aZcau5ZuqFbZYYeuLMDRRf1XXEwLap8sw,12203
107
+ pyfemtet/opt/opt/_optuna_botorch_helper.py,sha256=6d5LOCXhSyiffCW-mraAXUiHN6YdG-qz67F2_9m3Jec,8613
121
108
  pyfemtet/opt/opt/_scipy.py,sha256=8Alx9sIlLzNTxuVGTHOJMsvW5LSp8WDFiqD8IV6CVPc,4203
122
109
  pyfemtet/opt/opt/_scipy_scalar.py,sha256=ot1KbetZeQh5XkllzHc1PubPjBPgVBtC0a4jllNi8G4,2833
123
110
  pyfemtet/opt/parameter.py,sha256=YLE9lmYRaZA8isnTPJnbYXpUn6zsJFW4xg03QaSWey8,3950
@@ -131,23 +118,23 @@ pyfemtet/opt/visualization/complex_components/__init__.py,sha256=47DEQpj8HBSa-_T
131
118
  pyfemtet/opt/visualization/complex_components/alert_region.py,sha256=IIsfw4Dwlag7ked94X7MF2UxEODJCBeYruDOUQsKzGQ,2104
132
119
  pyfemtet/opt/visualization/complex_components/control_femtet.py,sha256=b4gn_pQMXe3NL3aqfEgsPTvhmdWmg-tRBvaHG659lZg,6240
133
120
  pyfemtet/opt/visualization/complex_components/main_figure_creator.py,sha256=mdX1DvMp75iGHMLzI13ki216iPO-wvB6XdxDqWdZVeM,5140
134
- pyfemtet/opt/visualization/complex_components/main_graph.py,sha256=4eAGHrmnFhmlRQD2rDrAiNSUAe7AGxbNBZZBIlGUuTQ,9450
135
- pyfemtet/opt/visualization/complex_components/pm_graph.py,sha256=bfHqhQnZtS_N6-rDvKw0Lnib2orDR76oF_c32ARxT9Y,23124
136
- pyfemtet/opt/visualization/complex_components/pm_graph_creator.py,sha256=Keqx02h50Kg1OYXlkveVfNvCBndfC4FdRpQo8Fuam9Q,7101
121
+ pyfemtet/opt/visualization/complex_components/main_graph.py,sha256=RkFe2GVYfXa1_e0d4maj4RMqKqk3QUNuIYrXi1qu7oE,10259
122
+ pyfemtet/opt/visualization/complex_components/pm_graph.py,sha256=n1p-yruqo9NW93UOUIdxPF2QdO4qDSuH37h6l8C68BQ,24921
123
+ pyfemtet/opt/visualization/complex_components/pm_graph_creator.py,sha256=ukv9XqW_Mzdsw9Oxc3JXLwKJTyXPSrt9DiB3dvKv4uk,7302
137
124
  pyfemtet/opt/visualization/process_monitor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
- pyfemtet/opt/visualization/process_monitor/application.py,sha256=JACrJdwmKWpHzdPpgGtAEAkODDEegSHJ2pOc7KwuDWw,7631
139
- pyfemtet/opt/visualization/process_monitor/pages.py,sha256=0mgvgBsCPxZ--uhP_EaeqT3FVFuhgOi6-KiXdnL0vEQ,11280
125
+ pyfemtet/opt/visualization/process_monitor/application.py,sha256=ir0xVTsbqFWq2FlPw75XNcMpFEUQNUQr5OcAW0r-FuY,7922
126
+ pyfemtet/opt/visualization/process_monitor/pages.py,sha256=JiWeaPt6uww1XsdEDefcaMn9qFNdVLg-6_Bf17u-nV8,15112
140
127
  pyfemtet/opt/visualization/result_viewer/.gitignore,sha256=ryvb4aqbbsHireHWlPQfxxqDHQJo6YkVYhE9imKt0b8,6
141
128
  pyfemtet/opt/visualization/result_viewer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
142
- pyfemtet/opt/visualization/result_viewer/application.py,sha256=Mg864h3CfoAHJaS4YGni-QldNvytk8ODF1Nl1E1AU2c,1327
143
- pyfemtet/opt/visualization/result_viewer/pages.py,sha256=oXd8VC3TSqlG8xF2ITcnPYesGC-wvYqMDqFL1dvqcpg,32004
129
+ pyfemtet/opt/visualization/result_viewer/application.py,sha256=jq_OyHOv8tXQBc884sWennWRpeMmWRmy53kxjpwsNm0,1688
130
+ pyfemtet/opt/visualization/result_viewer/pages.py,sha256=2ABJAb_d7RVP5lTZWf4z3DcxmYaPAM16HDP3W0ydP6g,32002
144
131
  pyfemtet/opt/visualization/wrapped_components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
132
  pyfemtet/opt/visualization/wrapped_components/dbc.py,sha256=wzR1ZMOb4uwPNTMFn5upLJ9tXeuJ22mLGynyJlA2cho,42161
146
133
  pyfemtet/opt/visualization/wrapped_components/dcc.py,sha256=hcW7SR6VIMn4S4-JMyohvOzdc0Aw8A4chIeHqQEUbFU,17499
147
134
  pyfemtet/opt/visualization/wrapped_components/html.py,sha256=sE2XHTDY1GvA1NW7y6SKWf-WglVXFKKvXhU9h3z53_g,95652
148
135
  pyfemtet/opt/visualization/wrapped_components/str_enum.py,sha256=NZqbh2jNEAckvJyZv__MWeRs2F2Q-dkJCWo30rU2rrM,1383
149
- pyfemtet-0.4.21.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
150
- pyfemtet-0.4.21.dist-info/METADATA,sha256=r0QpSmzWtYQ9Us_OsVe_cNJGRo8E6JKci0aL9SDD-qI,3459
151
- pyfemtet-0.4.21.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
152
- pyfemtet-0.4.21.dist-info/entry_points.txt,sha256=ZfYqRaoiPtuWqFi2_msccyrVF0LurMn-IHlYamAegZo,104
153
- pyfemtet-0.4.21.dist-info/RECORD,,
136
+ pyfemtet-0.4.24.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
137
+ pyfemtet-0.4.24.dist-info/METADATA,sha256=9OXrLPkD3nKvfJHVCg1FWDELoTWvJk1YSgoucyLMisQ,3288
138
+ pyfemtet-0.4.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
139
+ pyfemtet-0.4.24.dist-info/entry_points.txt,sha256=ZfYqRaoiPtuWqFi2_msccyrVF0LurMn-IHlYamAegZo,104
140
+ pyfemtet-0.4.24.dist-info/RECORD,,
@@ -1,118 +0,0 @@
1
- """External CAD (NX) Integration
2
-
3
- This script performs parametric optimization
4
- using a project that has imported an external CAD model
5
- that has been parametrically modeled.
6
-
7
- Please perform the following steps in preparation.
8
- - Install NX.
9
- - Place NX_ex01.prt, NX_ex01.femprj and .py file in the same folder.
10
- - Create C:\\temp folder on your disk.
11
- Note: NX exports .x_t files during optimization.
12
- """
13
-
14
- import os
15
- from pyfemtet.opt import FEMOpt, OptunaOptimizer
16
- from pyfemtet.opt.interface import FemtetWithNXInterface
17
- from pyfemtet.core import ModelError
18
-
19
-
20
- here, me = os.path.split(__file__)
21
- os.chdir(here)
22
-
23
-
24
- def disp(Femtet):
25
- """Obtain the maximum displacement in the Z direction from the analysis results.
26
-
27
- Note:
28
- The objective or constraint function
29
- must take a Femtet as its first argument
30
- and must return a single float.
31
-
32
- Warning:
33
- CAD integration may assign boundary conditions to unintended locations.
34
-
35
- In this example, if the boundary conditions are assigned as intended,
36
- the maximum displacement is always negative.
37
- If the maximum displacement is positive,
38
- it is assumed that boundary condition assignment has failed
39
- and a ModelError is raised.
40
-
41
- If a ModelError, MeshError, or SolveError is raised during an optimization,
42
- the Optimizer considers the trial a failure
43
- and skips it to the next trial.
44
- """
45
- _, _, ret = Femtet.Gogh.Galileo.GetMaxDisplacement_py()
46
-
47
- if ret >= 0:
48
- raise ModelError('The boundary condition assignment is incorrect.')
49
- return ret
50
-
51
-
52
- def volume(Femtet):
53
- """Obtain the volume."""
54
- _, ret = Femtet.Gogh.CalcVolume_py([0])
55
- return ret
56
-
57
-
58
- def C_minus_B(_, opt):
59
- """Calculate the difference between C and B dimensions.
60
-
61
- The constraint function must take a Femtet instance as its first argument,
62
- but this example does not use it.
63
-
64
- Another example uses the following snippet to access design variables:
65
-
66
- A = Femtet.GetVariableValue('A')
67
-
68
- However, when performing CAD integration,
69
- this method does not work because the variables are not set in the .femprj file.
70
-
71
- In CAD integration, design variables are obtained in the following way.
72
-
73
- The objective function and constraint function can take any variable after the first argument.
74
- The member variable opt of FEMOpt has a method called get_parameter().
75
- This method can retrieve design variables added by add_parameter().
76
- By taking opt as the second argument, you can execute get_parameter()
77
- in the objective function or constraint function to obtain the design variables.
78
-
79
- """
80
- A, B, C = opt.get_parameter('values')
81
- return C - B
82
-
83
-
84
- if __name__ == '__main__':
85
-
86
- # Define NX-Femtet integration object.
87
- # At this point, Python is connected to the running Femtet.
88
- fem = FemtetWithNXInterface(
89
- prt_path='NX_ex01.prt',
90
- femprj_path='NX_ex01.femprj',
91
- )
92
-
93
- # Define mathematical optimization object.
94
- opt = OptunaOptimizer(
95
- sampler_kwargs=dict(
96
- n_startup_trials=5,
97
- )
98
- )
99
-
100
- # Define FEMOpt object (This process integrates mathematical optimization and FEM.).
101
- femopt = FEMOpt(fem=fem, opt=opt)
102
-
103
- # Add design variables (Use variable names set in NX) to the optimization problem.
104
- femopt.add_parameter('A', 10, lower_bound=1, upper_bound=59)
105
- femopt.add_parameter('B', 10, lower_bound=1, upper_bound=40)
106
- femopt.add_parameter('C', 20, lower_bound=5, upper_bound=59)
107
-
108
- # Add constraint to the optimization problem.
109
- femopt.add_constraint(C_minus_B, 'C>B', lower_bound=1, args=femopt.opt)
110
-
111
- # Add objective to the optimization problem.
112
- femopt.add_objective(disp, name='displacement', direction=0)
113
- femopt.add_objective(volume, name='volume', direction='minimize')
114
-
115
- # Run optimization.
116
- femopt.set_random_seed(42)
117
- femopt.optimize(n_trials=20)
118
- femopt.terminate_all()
@@ -1,121 +0,0 @@
1
- """External CAD (Solidworks) Integration
2
-
3
- This script performs parametric optimization
4
- using a project that has imported an external CAD model
5
- that has been parametrically modeled.
6
-
7
- Please perform the following steps in preparation.
8
- - Install Solidworks.
9
- - Place Sldworks_ex01.SLDPRT, Sldworks_ex01.femprj and this .py file in the same folder.
10
- - Create C:\\temp folder on your disk.
11
- Note: NX exports .x_t files during optimization.
12
- """
13
-
14
- import os
15
- from pyfemtet.opt import FEMOpt, OptunaOptimizer
16
- from pyfemtet.opt.interface import FemtetWithSolidworksInterface
17
- from pyfemtet.core import ModelError
18
-
19
-
20
- here, me = os.path.split(__file__)
21
- os.chdir(here)
22
-
23
-
24
- def disp(Femtet):
25
- """Obtain the maximum displacement in the Z direction from the analysis results.
26
-
27
- Note:
28
- The objective or constraint function
29
- must take a Femtet as its first argument
30
- and must return a single float.
31
-
32
- Warning:
33
- CAD integration may assign boundary conditions to unintended locations.
34
-
35
- In this example, if the boundary conditions are assigned as intended,
36
- the maximum displacement is always negative.
37
- If the maximum displacement is positive,
38
- it is assumed that boundary condition assignment has failed
39
- and a ModelError is raised.
40
-
41
- If a ModelError, MeshError, or SolveError is raised during an optimization,
42
- the Optimizer considers the trial a failure
43
- and skips it to the next trial.
44
- """
45
- _, _, ret = Femtet.Gogh.Galileo.GetMaxDisplacement_py()
46
-
47
- if ret >= 0:
48
- raise ModelError('The boundary condition assignment is incorrect.')
49
- return ret
50
-
51
-
52
- def volume(Femtet):
53
- """Obtain the volume."""
54
- _, ret = Femtet.Gogh.CalcVolume_py([0])
55
- return ret
56
-
57
-
58
- def C_minus_B(_, opt):
59
- """Calculate the difference between C and B dimensions.
60
-
61
- The constraint function must take a Femtet instance as its first argument,
62
- but this example does not use it.
63
-
64
- Another example uses the following snippet to access design variables:
65
-
66
- A = Femtet.GetVariableValue('A')
67
-
68
- However, when performing CAD integration,
69
- this method does not work because the variables are not set in the .femprj file.
70
-
71
- In CAD integration, design variables are obtained in the following way.
72
-
73
- The objective function and constraint function can take any variable after the first argument.
74
- The member variable opt of FEMOpt has a method called get_parameter().
75
- This method can retrieve design variables added by add_parameter().
76
- By taking opt as the second argument, you can execute get_parameter()
77
- in the objective function or constraint function to obtain the design variables.
78
-
79
- """
80
- A, B, C = opt.get_parameter('values')
81
- return C - B
82
-
83
-
84
- if __name__ == '__main__':
85
-
86
- # Define Solidworks-Femtet integration object.
87
- # At this point, Python is connected to the running Femtet.
88
- fem = FemtetWithSolidworksInterface(
89
- sldprt_path='Sldworks_ex01.SLDPRT',
90
- femprj_path='Sldworks_ex01.femprj',
91
- )
92
-
93
- # Define mathematical optimization object.
94
- opt = OptunaOptimizer(
95
- sampler_kwargs=dict(
96
- n_startup_trials=5,
97
- )
98
- )
99
-
100
- # Define FEMOpt object (This process integrates mathematical optimization and FEM.).
101
- femopt = FEMOpt(fem=fem, opt=opt)
102
-
103
- # Add design variables (Use variable names set in NX) to the optimization problem.
104
- femopt.add_parameter('A', 10, lower_bound=1, upper_bound=59)
105
- femopt.add_parameter('B', 10, lower_bound=1, upper_bound=40)
106
- femopt.add_parameter('C', 20, lower_bound=5, upper_bound=59)
107
-
108
- # Add constraint to the optimization problem.
109
- # Note that we use the ``args`` keyword
110
- # to pass femopt.opt as an argument
111
- # to the constraint function ``C_minus_B``.
112
- femopt.add_constraint(C_minus_B, 'C>B', lower_bound=1, args=femopt.opt)
113
-
114
- # Add objective to the optimization problem.
115
- femopt.add_objective(disp, name='displacement', direction=0)
116
- femopt.add_objective(volume, name='volume', direction='minimize')
117
-
118
- # Run optimization.
119
- femopt.set_random_seed(42)
120
- femopt.optimize(n_trials=20)
121
- femopt.terminate_all()
@@ -1,148 +0,0 @@
1
- """Single-objective optimization: Resonant frequency of a circular patch antenna
2
-
3
- Using Femtet’s electromagnetic wave analysis solver,
4
- we explain an example of setting the resonant frequency
5
- of a circular patch antenna to a specific value.
6
- """
7
- from time import sleep
8
-
9
- import numpy as np
10
- from scipy.signal import find_peaks
11
- from tqdm import tqdm
12
- from optuna.integration.botorch import BoTorchSampler
13
-
14
- from pyfemtet.opt import OptunaOptimizer, FEMOpt
15
-
16
-
17
- class SParameterCalculator:
18
- """This class is for calculating S-parameters and resonance frequencies."""
19
-
20
- def __init__(self):
21
- self.freq = []
22
- self.S = []
23
- self.interpolated_function = None
24
- self.resonance_frequency = None
25
- self.minimum_S = None
26
-
27
- def get_result_from_Femtet(self, Femtet):
28
- """Obtain the relationship between frequency and S-parameter from the Femtet analysis results."""
29
-
30
- # Preparation
31
- Femtet.OpenCurrentResult(True)
32
- Gogh = Femtet.Gogh
33
-
34
- # Obtain the frequency and S(1,1) for each mode
35
- mode = 0
36
- freq_list = []
37
- dB_S_list = []
38
- for mode in tqdm(range(Gogh.Hertz.nMode), 'Obtaining frequency and S-parameter'):
39
- # Femtet result screen mode settings
40
- Gogh.Hertz.Mode = mode
41
- sleep(0.01)
42
- # Get frequency
43
- freq = Gogh.Hertz.GetFreq().Real
44
- # Get S-parameters
45
- comp_S = Gogh.Hertz.GetSMatrix(0, 0)
46
- norm = np.linalg.norm((comp_S.Real, comp_S.Imag))
47
- dB_S = 20 * np.log10(norm)
48
- # Get results
49
- freq_list.append(freq)
50
- dB_S_list.append(dB_S)
51
- self.freq = freq_list
52
- self.S = dB_S_list
53
-
54
- def calc_resonance_frequency(self):
55
- """Compute the frequency that gives the first peak for S-parameter."""
56
- x = -np.array(self.S)
57
- peaks, _ = find_peaks(x, height=None, threshold=None, distance=None, prominence=0.5, width=None, wlen=None, rel_height=0.5, plateau_size=None)
58
- from pyfemtet.core import SolveError
59
- if len(peaks) == 0:
60
- raise SolveError('No peaks detected.')
61
- self.resonance_frequency = self.freq[peaks[0]]
62
- self.minimum_S = self.S[peaks[0]]
63
-
64
- def get_resonance_frequency(self, Femtet):
65
- """Calculate the resonant frequency.
66
-
67
- Note:
68
- The objective or constraint function
69
- must take a Femtet as its first argument
70
- and must return a single float.
71
-
72
- Params:
73
- Femtet: An instance for using Femtet macros. For more information, see "Femtet Macro Help / CFemtet Class".
74
-
75
- Returns:
76
- float: A resonance frequency.
77
- """
78
- self.get_result_from_Femtet(Femtet)
79
- self.calc_resonance_frequency()
80
- f = self.resonance_frequency * 1e-9
81
- return f # GHz
82
-
83
-
84
- def antenna_is_smaller_than_substrate(Femtet):
85
- """Calculate the relationship between antenna size and board size.
86
-
87
- This function is used to constrain the model
88
- from breaking down while changing parameters.
89
-
90
- Params:
91
- Femtet: An instance for using Femtet macros.
92
-
93
- Returns:
94
- float: Difference between the board size and antenna size. Must be equal to or grater than 1 mm.
95
- """
96
- ant_r = Femtet.GetVariableValue('ant_r')
97
- Sx = Femtet.GetVariableValue('sx')
98
- return Sx/2 - ant_r
99
-
100
-
101
- def port_is_inside_antenna(Femtet):
102
- """Calculate the relationship between the feed port location and antenna size.
103
-
104
- This function is used to constrain the model
105
- from breaking down while changing parameters.
106
-
107
- Params:
108
- Femtet: An instance for using Femtet macros.
109
-
110
- Returns:
111
- float: Difference between the antenna edge and the position of the feed port. Must be equal to or grater than 1 mm.
112
- """
113
- ant_r = Femtet.GetVariableValue('ant_r')
114
- xf = Femtet.GetVariableValue('xf')
115
- return ant_r - xf
116
-
117
-
118
- if __name__ == '__main__':
119
- # Define the object for calculating S-parameters and resonance frequencies.
120
- s = SParameterCalculator()
121
-
122
- # Define mathematical optimization object.
123
- opt = OptunaOptimizer(
124
- sampler_class=BoTorchSampler,
125
- sampler_kwargs=dict(
126
- n_startup_trials=10,
127
- )
128
- )
129
-
130
- # Define FEMOpt object (This process integrates mathematical optimization and FEM.).
131
- femopt = FEMOpt(opt=opt)
132
-
133
- # Add design variables (Use variable names set in Femtet) to the optimization problem.
134
- femopt.add_parameter('ant_r', 10, 5, 20)
135
- femopt.add_parameter('sx', 50, 40, 60)
136
- femopt.add_parameter('xf', 5, 1, 20)
137
-
138
- # Add constraint to the optimization problem.
139
- femopt.add_constraint(antenna_is_smaller_than_substrate, 'board_antenna_clearance', lower_bound=1)
140
- femopt.add_constraint(port_is_inside_antenna, 'antenna_port_clearance', lower_bound=1)
141
-
142
- # Add objective to the optimization problem.
143
- # The target frequency is 3 GHz.
144
- femopt.add_objective(s.get_resonance_frequency, 'First_resonant_frequency(GHz)', direction=3.0)
145
-
146
- femopt.set_random_seed(42)
147
- femopt.optimize(n_trials=20)
148
- femopt.terminate_all()