pyfemtet 0.8.9__tar.gz → 0.8.10__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.

Potentially problematic release.


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

Files changed (158) hide show
  1. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/PKG-INFO +2 -1
  2. pyfemtet-0.8.10/pyfemtet/__init__.py +1 -0
  3. pyfemtet-0.8.10/pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
  4. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +10 -2
  5. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_message/locales/messages.pot +10 -2
  6. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_message/messages.py +2 -1
  7. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_util/excel_parse_util.py +33 -15
  8. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/_femopt.py +2 -0
  9. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/_femopt_core.py +1 -1
  10. pyfemtet-0.8.10/pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
  11. pyfemtet-0.8.10/pyfemtet/opt/advanced_samples/meta_script/meta_script.py +163 -0
  12. pyfemtet-0.8.10/pyfemtet/opt/advanced_samples/meta_script/sample.yaml +14 -0
  13. pyfemtet-0.8.10/pyfemtet/opt/advanced_samples/meta_script/yaml_generator.txt +0 -0
  14. pyfemtet-0.8.10/pyfemtet/opt/advanced_samples/meta_script/yaml_generator.xlsm +0 -0
  15. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/__init__.py +1 -1
  16. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_base.py +13 -4
  17. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_excel_interface.py +45 -39
  18. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_femtet.py +6 -2
  19. pyfemtet-0.8.10/pyfemtet/opt/interface/_femtet_excel.py +138 -0
  20. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_surrogate/_base.py +43 -0
  21. pyfemtet-0.8.10/pyfemtet/opt/interface/_surrogate_excel.py +102 -0
  22. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_process_monitor/pages.py +13 -0
  23. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyproject.toml +2 -1
  24. pyfemtet-0.8.9/pyfemtet/__init__.py +0 -1
  25. pyfemtet-0.8.9/pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
  26. pyfemtet-0.8.9/pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
  27. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/LICENSE +0 -0
  28. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/README.md +0 -0
  29. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_femtet_config_util/__init__.py +0 -0
  30. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_femtet_config_util/autosave.py +0 -0
  31. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_femtet_config_util/exit.py +0 -0
  32. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_message/1. make_pot.bat +0 -0
  33. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_message/2. make_mo.bat +0 -0
  34. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_message/__init__.py +0 -0
  35. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_message/babel.cfg +0 -0
  36. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_util/__init__.py +0 -0
  37. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_util/dask_util.py +0 -0
  38. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_util/excel_macro_util.py +0 -0
  39. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_util/sample.xlsx +0 -0
  40. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/_warning.py +0 -0
  41. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/brep/__init__.py +0 -0
  42. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/brep/_impl.py +0 -0
  43. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/core.py +0 -0
  44. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/dispatch_extensions/__init__.py +0 -0
  45. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/dispatch_extensions/_impl.py +0 -0
  46. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/logger/__init__.py +0 -0
  47. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/logger/_impl.py +0 -0
  48. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/__init__.py +0 -0
  49. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/_test_utils/__init__.py +0 -0
  50. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/_test_utils/control_femtet.py +0 -0
  51. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/_test_utils/hyper_sphere.py +0 -0
  52. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/_test_utils/record_history.py +0 -0
  53. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
  54. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -0
  55. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -0
  56. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj +0 -0
  57. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +0 -0
  58. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +0 -0
  59. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -0
  60. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -0
  61. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -0
  62. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -0
  63. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
  64. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_femtet_parametric.py +0 -0
  65. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -0
  66. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -0
  67. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_femtet_with_nx/update_model.py +0 -0
  68. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -0
  69. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_surrogate/__init__.py +0 -0
  70. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -0
  71. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -0
  72. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/__init__.py +0 -0
  73. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_base.py +0 -0
  74. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_optuna/__init__.py +0 -0
  75. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_optuna/_botorch_patch/__init__.py +0 -0
  76. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -0
  77. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_optuna/_optuna.py +0 -0
  78. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -0
  79. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_scipy.py +0 -0
  80. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/_scipy_scalar.py +0 -0
  81. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/optimizer/parameter.py +0 -0
  82. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/prediction/__init__.py +0 -0
  83. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/prediction/_base.py +0 -0
  84. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/prediction/single_task_gp.py +0 -0
  85. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
  86. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -0
  87. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -0
  88. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
  89. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
  90. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -0
  91. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -0
  92. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
  93. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
  94. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -0
  95. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -0
  96. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
  97. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -0
  98. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -0
  99. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
  100. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -0
  101. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -0
  102. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
  103. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -0
  104. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -0
  105. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
  106. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +0 -0
  107. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
  108. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -0
  109. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -0
  110. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
  111. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -0
  112. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -0
  113. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -0
  114. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
  115. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -0
  116. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -0
  117. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -0
  118. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
  119. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -0
  120. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
  121. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -0
  122. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
  123. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -0
  124. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -0
  125. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
  126. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -0
  127. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
  128. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -0
  129. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +0 -0
  130. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
  131. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -0
  132. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
  133. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -0
  134. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -0
  135. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj +0 -0
  136. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -0
  137. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -0
  138. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/__init__.py +0 -0
  139. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_base.py +0 -0
  140. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_complex_components/__init__.py +0 -0
  141. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_complex_components/alert_region.py +0 -0
  142. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_complex_components/control_femtet.py +0 -0
  143. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -0
  144. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_complex_components/main_graph.py +0 -0
  145. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_complex_components/pm_graph.py +0 -0
  146. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -0
  147. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_create_wrapped_components.py +0 -0
  148. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_process_monitor/__init__.py +0 -0
  149. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_process_monitor/application.py +0 -0
  150. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
  151. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_wrapped_components/dbc.py +0 -0
  152. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_wrapped_components/dcc.py +0 -0
  153. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_wrapped_components/html.py +0 -0
  154. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/_wrapped_components/str_enum.py +0 -0
  155. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/result_viewer/.gitignore +0 -0
  156. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
  157. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/result_viewer/application.py +0 -0
  158. {pyfemtet-0.8.9 → pyfemtet-0.8.10}/pyfemtet/opt/visualization/result_viewer/pages.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyfemtet
3
- Version: 0.8.9
3
+ Version: 0.8.10
4
4
  Summary: Design parameter optimization using Femtet.
5
5
  License: BSD-3-Clause
6
6
  Author: kazuma.naito
@@ -30,6 +30,7 @@ Requires-Dist: pandas (>=2.2.3,<3.0.0)
30
30
  Requires-Dist: plotly (>=5.22.0,<6.0.0)
31
31
  Requires-Dist: psutil (>=5.9.6,<6.0.0)
32
32
  Requires-Dist: pywin32 (>=306,<307) ; sys_platform == "win32"
33
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
33
34
  Requires-Dist: scipy (>=1.11.4,<2.0.0)
34
35
  Requires-Dist: torch (>=2.5.1,<2.6.0) ; sys_platform != "linux"
35
36
  Requires-Dist: torch (>=2.5.1,<2.6.0) ; sys_platform == "linux"
@@ -0,0 +1 @@
1
+ __version__ = "0.8.10"
@@ -7,7 +7,7 @@ msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: PROJECT VERSION\n"
9
9
  "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
10
- "POT-Creation-Date: 2025-01-29 15:47+0900\n"
10
+ "POT-Creation-Date: 2025-02-19 13:47+0900\n"
11
11
  "PO-Revision-Date: 2024-07-22 14:05+0900\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language: ja\n"
@@ -16,7 +16,7 @@ msgstr ""
16
16
  "MIME-Version: 1.0\n"
17
17
  "Content-Type: text/plain; charset=utf-8\n"
18
18
  "Content-Transfer-Encoding: 8bit\n"
19
- "Generated-By: Babel 2.16.0\n"
19
+ "Generated-By: Babel 2.17.0\n"
20
20
 
21
21
  #: pyfemtet/_message/messages.py:30
22
22
  msgid "hello!"
@@ -542,6 +542,14 @@ msgstr "ひとつの設計変数に対する目的関数の変化"
542
542
  msgid "The vertical axis is objective, and the horizontal axis is parameter."
543
543
  msgstr "縦軸は目的関数、横軸は設計変数です。"
544
544
 
545
+ #: pyfemtet/_message/messages.py:201
546
+ msgid "The importance of parameters evaluated by fANOVA"
547
+ msgstr "fANOVA に基づくパラメータ重要度"
548
+
549
+ #: pyfemtet/_message/messages.py:202
550
+ msgid "The normalized relative importance of parameters. Please note that the importance is calculated from the overall relationship of the input-output response, rather than from a specific solution."
551
+ msgstr "相対的なパラメータの重要度です。この重要度は特定の解におけるものではなく、入力-出力応答全体の関係から計算されていることに注意してください。"
552
+
545
553
  #~ msgid "The magnitude relationship is incorrect. "
546
554
  #~ msgstr ""
547
555
 
@@ -8,14 +8,14 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: PROJECT VERSION\n"
10
10
  "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
11
- "POT-Creation-Date: 2025-01-29 15:47+0900\n"
11
+ "POT-Creation-Date: 2025-02-19 13:47+0900\n"
12
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "MIME-Version: 1.0\n"
16
16
  "Content-Type: text/plain; charset=utf-8\n"
17
17
  "Content-Transfer-Encoding: 8bit\n"
18
- "Generated-By: Babel 2.16.0\n"
18
+ "Generated-By: Babel 2.17.0\n"
19
19
 
20
20
  #: pyfemtet/_message/messages.py:30
21
21
  msgid "hello!"
@@ -541,3 +541,11 @@ msgstr ""
541
541
  msgid "The vertical axis is objective, and the horizontal axis is parameter."
542
542
  msgstr ""
543
543
 
544
+ #: pyfemtet/_message/messages.py:201
545
+ msgid "The importance of parameters evaluated by fANOVA"
546
+ msgstr ""
547
+
548
+ #: pyfemtet/_message/messages.py:202
549
+ msgid "The normalized relative importance of parameters. Please note that the importance is calculated from the overall relationship of the input-output response, rather than from a specific solution."
550
+ msgstr ""
551
+
@@ -198,4 +198,5 @@ class Message:
198
198
  DETAIL_PAGE_CONTOUR_DESCRIPTION = _('The axes are parameters, and the color shows objective value.')
199
199
  DETAIL_PAGE_SLICE_HEADER = _('The response of an objective versus one parameter')
200
200
  DETAIL_PAGE_SLICE_DESCRIPTION = _('The vertical axis is objective, and the horizontal axis is parameter.')
201
-
201
+ DETAIL_PAGE_IMPORTANCE_HEADER = _('The importance of parameters evaluated by fANOVA')
202
+ DETAIL_PAGE_IMPORTANCE_DESCRIPTION = _('The normalized relative importance of parameters. Please note that the importance is calculated from the overall relationship of the input-output response, rather than from a specific solution.')
@@ -13,15 +13,15 @@ __all__ = [
13
13
  ]
14
14
 
15
15
 
16
- def parse_excel(book_path, sheet_name, keyword, required, optional) -> pd.DataFrame:
16
+ def parse_excel(book_path, sheet_name, keyword, required, optional, raise_if_no_keyword=True) -> pd.DataFrame:
17
17
  """Excel シートからパラメータを取得します。
18
18
 
19
19
  シートのパースプロセスは以下の通りです。
20
20
 
21
21
  1. シート全体 (A1 セルから、値が入力されている最終セルまで) をデータに取り込みます。
22
- 2. すべてのセルが空白である列をデータから除きます。
23
- 3. すべてのセルが空白である行をデータから除きます。
24
- 4. 最も左上(上が優先)にある keyword に一致するセルより上および左の行・列をデータから除きます。
22
+ 2. 最も左上(上が優先)にある keyword に一致するセルより上および左の行・列をデータから除きます。
23
+ 3. その時点のデータの上から順に見てすべてのセルが空白である行以下の行をデータから除きます。
24
+ 4. すべてのセルが空白である列をデータから除きます。
25
25
 
26
26
  Args:
27
27
  book_path: Excel book のパス。
@@ -29,6 +29,7 @@ def parse_excel(book_path, sheet_name, keyword, required, optional) -> pd.DataFr
29
29
  keyword (str): 必ず含まれるべき、表データの最初の列名として使う文字列。
30
30
  required (list[str]): 必ず含まれるべき、表データの列名として使う文字列のリスト。
31
31
  optional (list[str]): 表データの列名として使ってよい文字列のリスト。
32
+ raise_if_no_keyword (bool, optional): 指定されたシートに keyword が含まれない場合エラーにするかどうか。
32
33
 
33
34
  Returns:
34
35
 
@@ -41,21 +42,31 @@ def parse_excel(book_path, sheet_name, keyword, required, optional) -> pd.DataFr
41
42
  # 読み込み
42
43
  df = pd.read_excel(book_path, sheet_name, header=None)
43
44
 
44
- # NaN のみからなる列を削除する
45
- valid_columns = [col for col in df.columns if df[col].notna().sum()]
46
- df = df[valid_columns]
47
-
48
- # NaN のみからなる行を削除する
49
- valid_rows = [row for row in df.index if df.loc[row].notna().sum()]
50
- df = df.loc[valid_rows]
51
-
52
45
  # 「変数名」を左上とする表にする
53
- df: pd.DataFrame
54
46
  idx = np.where(df.values == keyword)
47
+ if len(idx[0]) == 0:
48
+ if raise_if_no_keyword:
49
+ raise RuntimeError(f'keyword "{keyword}" is lacked in {sheet_name}. ')
50
+ else:
51
+ return pd.DataFrame()
52
+
55
53
  r = idx[0][0]
56
54
  c = idx[1][0]
57
55
  df = pd.DataFrame(df.iloc[1+r:, c:].values, columns=df.iloc[r, c:].values)
58
56
 
57
+ # NaN のみからなる行を最初に見つけるまでデータに追加する
58
+ valid_rows = []
59
+ for row in df.index:
60
+ if df.loc[row].notna().sum():
61
+ valid_rows.append(row)
62
+ else:
63
+ break
64
+ df = df.loc[valid_rows]
65
+
66
+ # NaN のみからなる列を削除する
67
+ valid_columns = [col for i, col in enumerate(df.columns) if df.iloc[:, i].notna().sum()]
68
+ df = df[valid_columns]
69
+
59
70
  # パースが成功しているかチェックする
60
71
  lack = True
61
72
  for col in df.columns:
@@ -76,8 +87,15 @@ class ParseBase:
76
87
  OPTIONAL_COLUMNS = []
77
88
 
78
89
  @classmethod
79
- def parse(cls, book_path, sheet_name) -> pd.DataFrame:
80
- return parse_excel(book_path, sheet_name, cls.KEYWORD, cls.REQUIRED_COLUMNS, cls.OPTIONAL_COLUMNS)
90
+ def parse(cls, book_path, sheet_name, raise_if_no_keyword=True) -> pd.DataFrame:
91
+ return parse_excel(
92
+ book_path,
93
+ sheet_name,
94
+ cls.KEYWORD,
95
+ cls.REQUIRED_COLUMNS,
96
+ cls.OPTIONAL_COLUMNS,
97
+ raise_if_no_keyword,
98
+ )
81
99
 
82
100
 
83
101
  class ParseAsParameter(ParseBase):
@@ -139,6 +139,7 @@ class FEMOpt:
139
139
  self.monitor_host_record = None
140
140
  self._hv_reference = None
141
141
  self._extra_space_dir = None
142
+ self._opt_exceptions = []
142
143
 
143
144
  # multiprocess 時に pickle できないオブジェクト参照の削除
144
145
  def __getstate__(self):
@@ -925,6 +926,7 @@ class FEMOpt:
925
926
  sleep(1) # monitor が terminated 状態で少なくとも一度更新されなければ running のまま固まる
926
927
 
927
928
  # 全ての Exception を再表示
929
+ self._opt_exceptions = opt_exceptions
928
930
  for i, opt_exception in enumerate(opt_exceptions):
929
931
  if opt_exception is not None:
930
932
  print()
@@ -325,7 +325,7 @@ class Function:
325
325
  args = self.args
326
326
  # Femtet 特有の処理
327
327
  if isinstance(fem, FemtetInterface):
328
- args = (fem.Femtet, *args)
328
+ args = (fem.object_passed_to_functions, *args)
329
329
  return float(self.fun(*args, **self.kwargs))
330
330
 
331
331
  def _restore_constants(self):
@@ -0,0 +1,163 @@
1
+ # for meta script
2
+ import os
3
+ import pyfemtet
4
+
5
+ if __name__ == '__main__':
6
+ print(f'pyfemtet {pyfemtet.__version__} starting.')
7
+
8
+ from pyfemtet._message.messages import encoding
9
+
10
+ from fire import Fire
11
+ import yaml
12
+
13
+ # for concrete script
14
+ from pyfemtet.opt import FEMOpt
15
+ from pyfemtet.opt.interface import *
16
+ from pyfemtet.opt.optimizer import *
17
+ from optuna.samplers import *
18
+ from pyfemtet.opt.interface._femtet_excel import FemtetWithExcelSettingsInterface
19
+
20
+
21
+ # fore debug
22
+ class ContentContext:
23
+
24
+ def __init__(self, content_):
25
+ self.content = content_
26
+
27
+ def __enter__(self):
28
+ return self.content
29
+
30
+ def __exit__(self, exc_type, exc_val, exc_tb):
31
+ pass
32
+
33
+
34
+ def main(
35
+ yaml_path: str = None,
36
+
37
+ interface_class: str = None, # including parameter definition excel
38
+ interface_kwargs: str = None, # including Parametric Analysis Output
39
+ optimizer_class: str = None,
40
+ optimizer_kwargs: str = None,
41
+ femopt_kwargs: str = None,
42
+ seed: str = 'null',
43
+ optimize_kwargs: str = None,
44
+ ):
45
+ """
46
+
47
+ Args:
48
+ yaml_path:
49
+ If this argument is passed, the other arguments will be ignored
50
+ and load by .yaml file.
51
+ The yaml file must contain the other arguments.
52
+
53
+ interface_class: FemtetWithExcelSettingsInterface or SurrogateModelInterface.
54
+ interface_kwargs: See documentation of each interface class.
55
+ optimizer_class: OptunaOptimizer or ScipyOptimizer.
56
+ optimizer_kwargs: See documentation of each optimizer class.
57
+ femopt_kwargs: See documentation of FEMOpt.
58
+ seed: int or None.
59
+ optimize_kwargs: See documentation of FEMOpt.optimize().
60
+
61
+ """
62
+
63
+ if yaml_path is not None:
64
+ if os.path.isfile(yaml_path):
65
+ context = open(yaml_path, 'r', encoding='utf-8')
66
+ else:
67
+ print('debug mode')
68
+ context = ContentContext(yaml_path)
69
+ with context as f:
70
+ d = yaml.safe_load(f)
71
+ interface_class = yaml.safe_dump(d['interface_class'], allow_unicode=True)
72
+ interface_kwargs = yaml.safe_dump(d['interface_kwargs'], allow_unicode=True)
73
+ optimizer_class = yaml.safe_dump(d['optimizer_class'], allow_unicode=True)
74
+ optimizer_kwargs = yaml.safe_dump(d['optimizer_kwargs'], allow_unicode=True)
75
+ femopt_kwargs = yaml.safe_dump(d['femopt_kwargs'], allow_unicode=True)
76
+ seed = yaml.safe_dump(d['seed'], allow_unicode=True)
77
+ optimize_kwargs = yaml.safe_dump(d['optimize_kwargs'], allow_unicode=True)
78
+
79
+ Interface = eval(yaml.safe_load(interface_class))
80
+ interface_kwargs_ = yaml.safe_load(interface_kwargs)
81
+
82
+ Optimizer = eval(yaml.safe_load(optimizer_class))
83
+ optimizer_kwargs_ = yaml.safe_load(optimizer_kwargs)
84
+
85
+ femopt_kwargs_ = yaml.safe_load(femopt_kwargs)
86
+
87
+ seed_ = yaml.safe_load(seed)
88
+
89
+ optimize_kwargs_ = yaml.safe_load(optimize_kwargs)
90
+
91
+ fem = Interface(**interface_kwargs_)
92
+ opt = Optimizer(**optimizer_kwargs_)
93
+ femopt = FEMOpt(fem=fem, opt=opt, **femopt_kwargs_)
94
+ femopt.set_random_seed(seed_)
95
+ femopt.optimize(**optimize_kwargs_)
96
+
97
+
98
+ # if __name__ == '__main__':
99
+ # Fire(main)
100
+
101
+
102
+ # for debugging file input
103
+ if __name__ == '__main__':
104
+ os.chdir(os.path.dirname(__file__))
105
+ path = 'sample.yaml'
106
+ main(yaml_path=path)
107
+
108
+
109
+ # for debugging yaml input
110
+ # if __name__ == '__main__':
111
+ # content = r"""
112
+ # interface_class: FemtetInterface
113
+ # interface_kwargs:
114
+ # femprj_path: C:\日本語ファイル.femprj
115
+ # optimizer_class: OptunaOptimizer
116
+ # optimizer_kwargs:
117
+ # sampler_class: TPESampler
118
+ # sampler_kwargs:
119
+ # n_startup_trials: 10
120
+ # femopt_kwargs:
121
+ # history_path: sample.csv
122
+ # optimize_kwargs:
123
+ # n_trials: 15
124
+ # confirm_before_exit: False
125
+ # seed: null
126
+ # """
127
+ #
128
+ # main(yaml_path=content)
129
+
130
+
131
+ # for debugging CLI input
132
+ # if __name__ == '__main__':
133
+ #
134
+ # interface_kwargs = dict(
135
+ # femprj_path=r'sample.femprj',
136
+ # parametric_output_indexes_use_as_objective={0: 0, 1: 'minimize'}
137
+ # )
138
+ # optimizer_kwargs = dict(
139
+ # sampler_class='TPESampler',
140
+ # sampler_kwargs=dict(
141
+ # n_startup_trials=10,
142
+ # )
143
+ # )
144
+ # femopt_kwargs = dict(
145
+ # history_path='sample.csv'
146
+ # )
147
+ #
148
+ # seed = None
149
+ #
150
+ # optimize_kwargs = dict(
151
+ # n_trials=15,
152
+ # confirm_before_exit=False,
153
+ # )
154
+ #
155
+ # main(
156
+ # interface_class='FemtetWithExcelSettingsInterface',
157
+ # interface_kwargs=yaml.safe_dump(interface_kwargs, allow_unicode=True),
158
+ # optimizer_class='OptunaOptimizer',
159
+ # optimizer_kwargs=yaml.safe_dump(optimizer_kwargs, allow_unicode=True),
160
+ # femopt_kwargs=yaml.safe_dump(femopt_kwargs, allow_unicode=True),
161
+ # seed=yaml.safe_dump(femopt_kwargs, allow_unicode=True),
162
+ # optimize_kwargs=yaml.safe_dump(optimize_kwargs, allow_unicode=True),
163
+ # )
@@ -0,0 +1,14 @@
1
+  interface_class: FemtetInterface
2
+ interface_kwargs:
3
+ femprj_path: C:\日本語ファイル.femprj
4
+ optimizer_class: OptunaOptimizer
5
+ optimizer_kwargs:
6
+ sampler_class: TPESampler
7
+ sampler_kwargs:
8
+ n_startup_trials: 10
9
+ femopt_kwargs:
10
+ history_path: sample.csv
11
+ optimize_kwargs:
12
+ n_trials: 15
13
+ confirm_before_exit: False
14
+ seed: null
@@ -25,7 +25,7 @@ from pyfemtet.opt.interface._surrogate._base import SurrogateModelInterfaceBase
25
25
  from pyfemtet.opt.interface._surrogate._singletaskgp import PoFBoTorchInterface
26
26
 
27
27
 
28
- __all__ =[
28
+ __all__ = [
29
29
  'FEMInterface',
30
30
  'NoFEM',
31
31
  'FemtetInterface',
@@ -24,18 +24,27 @@ class FEMInterface(ABC):
24
24
 
25
25
  """
26
26
 
27
+ kwargs = None
28
+
27
29
  def __init__(
28
30
  self,
29
31
  **kwargs
30
32
  ):
31
33
  # restore のための情報保管
32
- self.kwargs = kwargs
34
+ if self.kwargs is None:
35
+ self.kwargs = kwargs
36
+ else:
37
+ self.kwargs.update(kwargs)
33
38
 
34
39
  @abstractmethod
35
40
  def update(self, parameters: pd.DataFrame) -> None:
36
41
  """Updates the FEM analysis based on the proposed parameters."""
37
42
  raise NotImplementedError('update() must be implemented.')
38
43
 
44
+ @property
45
+ def object_passed_to_functions(self):
46
+ return self
47
+
39
48
  def check_param_value(self, param_name) -> float or None:
40
49
  """Checks the value of a parameter in the FEM model (if implemented in concrete class)."""
41
50
  pass
@@ -50,13 +59,13 @@ class FEMInterface(ABC):
50
59
  pass
51
60
 
52
61
  def load_parameter(self, opt) -> None: # opt: AbstractOptimizer
53
- raise NotImplementedError()
62
+ pass
54
63
 
55
64
  def load_objective(self, opt) -> None: # opt: AbstractOptimizer
56
- raise NotImplementedError()
65
+ pass
57
66
 
58
67
  def load_constraint(self, opt) -> None: # opt: AbstractOptimizer
59
- raise NotImplementedError()
68
+ pass
60
69
 
61
70
  def _setup_before_parallel(self, client) -> None:
62
71
  """Preprocessing before launching a dask worker (if implemented in concrete class).
@@ -55,36 +55,36 @@ class ExcelInterface(FEMInterface):
55
55
  input_xlsm_path (str or Path):
56
56
  設計変数の定義を含む Excel ファイルのパスを指定
57
57
  します。
58
-
58
+
59
59
  input_sheet_name (str):
60
60
  設計変数の定義を含むシートの名前を指定します。
61
-
61
+
62
62
  output_xlsm_path (str or Path, optional):
63
63
  目的関数の定義を含む Excel ファイルのパスを指定
64
64
  します。指定しない場合は ``input_xlsm_path`` と
65
65
  同じと見做します。
66
-
66
+
67
67
  output_sheet_name (str, optional):
68
68
  目的関数の定義を含む含むシートの名前を指定します。
69
69
  指定しない場合は ``input_sheet_name`` と同じと見
70
70
  做します。
71
-
71
+
72
72
  procedure_name (str, optional):
73
73
  Excel マクロ関数名を指定します。指定しない場合は
74
74
  ``FemtetMacro.FemtetMain`` と見做します。
75
-
75
+
76
76
  procedure_args (list or tuple, optional):
77
77
  Excel マクロ関数に渡す引数をリストまたはタプルで
78
78
  指定します。
79
-
79
+
80
80
  connect_method (str, optional):
81
81
  Excel との接続方法を指定します。 'auto' または
82
82
  'new' が利用可能です。デフォルトは 'auto' です。
83
-
83
+
84
84
  procedure_timeout (float or None, optional):
85
85
  Excel マクロ関数のタイムアウト時間を秒単位で指定
86
86
  します。 None の場合はタイムアウトなしとなります。
87
-
87
+
88
88
  setup_xlsm_path (str or Path, optional):
89
89
  セットアップ時に呼ぶ関数を含む xlsm のパスです。
90
90
  指定しない場合は ``input_xlsm_path`` と
@@ -135,7 +135,7 @@ class ExcelInterface(FEMInterface):
135
135
  Attributes:
136
136
  input_xlsm_path (Path):
137
137
  設計変数の定義を含む Excel ファイルのパス。
138
-
138
+
139
139
  input_sheet_name (str):
140
140
  設計変数の定義を含むシートの名前。
141
141
 
@@ -257,7 +257,7 @@ class ExcelInterface(FEMInterface):
257
257
  self.output_sheet_name = output_sheet_name if output_sheet_name is not None else input_sheet_name
258
258
  self.constraint_xlsm_path = str(input_xlsm_path) if constraint_xlsm_path is None else str(constraint_xlsm_path)
259
259
  self.constraint_sheet_name = constraint_sheet_name or self.input_sheet_name
260
- self.procedure_name = procedure_name or 'FemtetMacro.FemtetMain'
260
+ self.procedure_name = procedure_name
261
261
  self.procedure_args = procedure_args or []
262
262
  assert connect_method in ['new', 'auto']
263
263
  self.connect_method = connect_method
@@ -271,7 +271,8 @@ class ExcelInterface(FEMInterface):
271
271
  self.setup_procedure_name = setup_procedure_name
272
272
  self.setup_procedure_args = setup_procedure_args or []
273
273
 
274
- self.teardown_xlsm_path = str(input_xlsm_path) if teardown_xlsm_path is None else str(teardown_xlsm_path) # あとで取得する
274
+ self.teardown_xlsm_path = str(input_xlsm_path) if teardown_xlsm_path is None else str(
275
+ teardown_xlsm_path) # あとで取得する
275
276
  self.teardown_procedure_name = teardown_procedure_name
276
277
  self.teardown_procedure_args = teardown_procedure_args or []
277
278
 
@@ -516,7 +517,8 @@ class ExcelInterface(FEMInterface):
516
517
  self.sh_constraint = sh
517
518
  break
518
519
  else:
519
- raise RuntimeError(f'Sheet {self.constraint_sheet_name} does not exist in the book {self.wb_constraint.Name}.')
520
+ raise RuntimeError(
521
+ f'Sheet {self.constraint_sheet_name} does not exist in the book {self.wb_constraint.Name}.')
520
522
 
521
523
  # ===== setup =====
522
524
  # 開く (setup)
@@ -618,18 +620,19 @@ class ExcelInterface(FEMInterface):
618
620
  self.update_parameter(parameters)
619
621
 
620
622
  # マクロ実行
621
- try:
622
- with watch_excel_macro_error(self.excel, timeout=self.procedure_timeout):
623
- self.excel.Run(
624
- f'{self.procedure_name}',
625
- *self.procedure_args
626
- )
623
+ if self.procedure_name is not None:
624
+ try:
625
+ with watch_excel_macro_error(self.excel, timeout=self.procedure_timeout):
626
+ self.excel.Run(
627
+ f'{self.procedure_name}',
628
+ *self.procedure_args
629
+ )
627
630
 
628
- # 再計算
629
- self.excel.CalculateFull()
631
+ # 再計算
632
+ self.excel.CalculateFull()
630
633
 
631
- except com_error as e:
632
- raise SolveError(f'Failed to run macro {self.procedure_name}. The original message is: {e}')
634
+ except com_error as e:
635
+ raise SolveError(f'Failed to run macro {self.procedure_name}. The original message is: {e}')
633
636
 
634
637
  def quit(self):
635
638
  if self.terminate_excel_when_quit:
@@ -655,7 +658,8 @@ class ExcelInterface(FEMInterface):
655
658
  self.excel.CalculateFull()
656
659
 
657
660
  except com_error as e:
658
- raise RuntimeError(f'Failed to run macro {self.teardown_procedure_args}. The original message is: {e}')
661
+ raise RuntimeError(
662
+ f'Failed to run macro {self.teardown_procedure_args}. The original message is: {e}')
659
663
 
660
664
  # 不具合の原因になる場合があるので参照設定は解除しないこと
661
665
  # self.remove_femtet_ref_xla(self.wb_input)
@@ -791,11 +795,14 @@ class ExcelInterface(FEMInterface):
791
795
  opt.variables.add_expression(fixed_prm)
792
796
 
793
797
  def load_objective(self, opt):
794
- from pyfemtet.opt.optimizer import AbstractOptimizer, logger
798
+ from pyfemtet.opt.optimizer import AbstractOptimizer
795
799
  from pyfemtet.opt._femopt_core import Objective
796
800
  opt: AbstractOptimizer
797
801
 
798
- df = ParseAsObjective.parse(self.output_xlsm_path, self.output_sheet_name)
802
+ df = ParseAsObjective.parse(
803
+ self.output_xlsm_path,
804
+ self.output_sheet_name,
805
+ )
799
806
 
800
807
  for i, row in df.iterrows():
801
808
 
@@ -827,22 +834,19 @@ class ExcelInterface(FEMInterface):
827
834
  kwargs=dict(),
828
835
  )
829
836
 
830
- def load_constraint(self, opt):
831
- from pyfemtet.opt.optimizer import AbstractOptimizer, logger
837
+ def load_constraint(self, opt, raise_if_no_keyword=False):
838
+ from pyfemtet.opt.optimizer import AbstractOptimizer
832
839
  from pyfemtet.opt._femopt_core import Constraint
833
840
  opt: AbstractOptimizer
834
841
 
835
- # TODO:
836
- # constraint optional である。
837
- # 現在は実装していないが、シートから問題を取得するよりよいロジックができたら
838
- # (つまり、同じシートからパラメータと拘束を取得出来るようになったら)__init__ 内で
839
- # constraint に None が与えられたのか故意に input_sheet_name と同じシート名を
840
- # 与えられたのか分別できる実装に変えてそのチェック処理をここに反映する。
841
- # constraint_sheet_name が指定されていない場合何もしない
842
- if (self.constraint_sheet_name == self.input_sheet_name) and is_same_path(self.input_xlsm_path, self.constraint_xlsm_path):
843
- return
844
-
845
- df = ParseAsConstraint.parse(self.constraint_xlsm_path, self.constraint_sheet_name)
842
+ # constraint は optional であるが
843
+ # __init__ input_sheet_name を入れられるので
844
+ # ここで constraint が実際に与えられているか判断する
845
+ df = ParseAsConstraint.parse(
846
+ self.constraint_xlsm_path,
847
+ self.constraint_sheet_name,
848
+ raise_if_no_keyword=raise_if_no_keyword,
849
+ )
846
850
 
847
851
  for i, row in df.iterrows():
848
852
 
@@ -877,7 +881,8 @@ class ExcelInterface(FEMInterface):
877
881
  calc_before_solve = True
878
882
  if ParseAsConstraint.calc_before_solve in df.columns:
879
883
  _calc_before_solve = row[ParseAsConstraint.calc_before_solve]
880
- calc_before_solve = True if is_cell_value_empty(_calc_before_solve) else bool(_calc_before_solve) # bool or NaN
884
+ calc_before_solve = True if is_cell_value_empty(_calc_before_solve) else bool(
885
+ _calc_before_solve) # bool or NaN
881
886
 
882
887
  if use:
883
888
  # constraint を作る
@@ -892,6 +897,7 @@ class ExcelInterface(FEMInterface):
892
897
  using_fem=not calc_before_solve,
893
898
  )
894
899
 
900
+ # TODO: femopt_core.Function の仕様を変えたらここも変える
895
901
  def objective_from_excel(self, name: str):
896
902
  r = 1 + search_r(self.output_xlsm_path, self.output_sheet_name, name)
897
903
  c = 1 + search_c(self.output_xlsm_path, self.output_sheet_name, ParseAsObjective.value)
@@ -192,7 +192,8 @@ class FemtetInterface(FEMInterface):
192
192
  # subprocess で restore するための情報保管
193
193
  # パスなどは connect_and_open_femtet での処理結果を反映し
194
194
  # メインで開いた解析モデルが確実に開かれるようにする
195
- super().__init__(
195
+ FEMInterface.__init__(
196
+ self,
196
197
  femprj_path=self.femprj_path,
197
198
  model_name=self.model_name,
198
199
  open_result_with_gui=self.open_result_with_gui,
@@ -201,6 +202,10 @@ class FemtetInterface(FEMInterface):
201
202
  **kwargs
202
203
  )
203
204
 
205
+ @property
206
+ def object_passed_to_functions(self):
207
+ return self.Femtet
208
+
204
209
  def use_parametric_output_as_objective(self, number: int, direction: str | float = 'minimize') -> None:
205
210
  """Use output setting of Femtet parametric analysis as an objective function.
206
211
 
@@ -234,7 +239,6 @@ class FemtetInterface(FEMInterface):
234
239
  self.kwargs['parametric_output_indexes_use_as_objective'] = self.parametric_output_indexes_use_as_objective
235
240
 
236
241
 
237
-
238
242
  def __del__(self):
239
243
  self.quit()
240
244
  # CoUninitialize() # Win32 exception occurred releasing IUnknown at 0x0000022427692748