pyfemtet 0.9.6__py3-none-any.whl → 1.0.0__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.
- pyfemtet/__init__.py +6 -1
- pyfemtet/_i18n/1. make_pot_and_update_po.bat +8 -0
- pyfemtet/_i18n/2. build_mo.bat +5 -0
- pyfemtet/_i18n/__init__.py +4 -0
- pyfemtet/_i18n/babel.cfg +2 -0
- pyfemtet/_i18n/i18n.py +37 -0
- pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +1020 -0
- pyfemtet/_i18n/locales/messages.pot +987 -0
- pyfemtet/{_message → _i18n}/messages.py +128 -41
- pyfemtet/_util/closing.py +19 -0
- pyfemtet/_util/dask_util.py +89 -7
- pyfemtet/_util/df_util.py +46 -0
- pyfemtet/_util/excel_macro_util.py +8 -3
- pyfemtet/_util/excel_parse_util.py +43 -23
- pyfemtet/_util/femtet_access_inspection.py +120 -0
- pyfemtet/{_femtet_config_util/autosave.py → _util/femtet_autosave.py} +7 -0
- pyfemtet/_util/femtet_exit.py +105 -0
- pyfemtet/_util/femtet_version.py +20 -0
- pyfemtet/_util/helper.py +103 -0
- pyfemtet/_util/process_util.py +107 -0
- pyfemtet/_util/str_enum.py +44 -0
- pyfemtet/core.py +15 -47
- pyfemtet/dispatch_extensions/__init__.py +8 -11
- pyfemtet/dispatch_extensions/_impl.py +42 -198
- pyfemtet/logger/__init__.py +8 -1
- pyfemtet/logger/_impl.py +5 -6
- pyfemtet/opt/__init__.py +3 -17
- pyfemtet/opt/exceptions.py +45 -0
- pyfemtet/opt/femopt.py +621 -0
- pyfemtet/opt/history/__init__.py +11 -0
- pyfemtet/opt/history/_history.py +1416 -0
- pyfemtet/opt/history/_hypervolume.py +169 -0
- pyfemtet/opt/history/_optimality.py +79 -0
- pyfemtet/opt/interface/__init__.py +17 -24
- pyfemtet/opt/interface/_base_interface.py +222 -0
- pyfemtet/opt/interface/_excel_interface/__init__.py +3 -0
- pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
- pyfemtet/opt/interface/_excel_interface/excel_interface.py +997 -0
- pyfemtet/opt/interface/_femtet_interface/__init__.py +3 -0
- pyfemtet/opt/interface/{_femtet_parametric.py → _femtet_interface/_femtet_parametric.py} +20 -12
- pyfemtet/opt/interface/{_femtet.py → _femtet_interface/femtet_interface.py} +508 -353
- pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +5 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +230 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +98 -0
- pyfemtet/opt/interface/{_femtet_with_nx → _femtet_with_nx_interface}/update_model.py +1 -3
- pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +5 -0
- pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +142 -0
- pyfemtet/opt/interface/_solidworks_interface/__init__.py +5 -0
- pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +227 -0
- pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +8 -0
- pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +150 -0
- pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +298 -0
- pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +18 -0
- pyfemtet/opt/interface/_with_excel_settings/__init__.py +61 -0
- pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +134 -0
- pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- pyfemtet/opt/meta_script/__main__.py +58 -36
- pyfemtet/opt/optimizer/__init__.py +7 -9
- pyfemtet/opt/optimizer/_base_optimizer.py +911 -0
- pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +9 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +63 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +796 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +7 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +18 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +244 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +1249 -0
- pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
- pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +1 -0
- pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +383 -0
- pyfemtet/opt/prediction/__init__.py +7 -0
- pyfemtet/opt/prediction/_botorch_utils.py +133 -0
- pyfemtet/opt/prediction/_gpytorch_modules_extension.py +142 -0
- pyfemtet/opt/prediction/_helper.py +155 -0
- pyfemtet/opt/prediction/_model.py +118 -0
- pyfemtet/opt/problem/problem.py +304 -0
- pyfemtet/opt/problem/variable_manager/__init__.py +20 -0
- pyfemtet/opt/problem/variable_manager/_string_as_expression.py +115 -0
- pyfemtet/opt/problem/variable_manager/_variable_manager.py +295 -0
- pyfemtet/opt/visualization/history_viewer/__main__.py +5 -0
- pyfemtet/opt/visualization/{_base.py → history_viewer/_base_application.py} +18 -13
- pyfemtet/opt/visualization/history_viewer/_common_pages.py +150 -0
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/alert_region.py +10 -5
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/control_femtet.py +16 -13
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/main_graph.py +117 -47
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/pm_graph.py +159 -138
- pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +173 -0
- pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +291 -0
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dbc.py +1 -1
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dcc.py +1 -1
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/html.py +1 -1
- pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +5 -0
- pyfemtet/opt/visualization/{result_viewer/application.py → history_viewer/result_viewer/_application.py} +6 -6
- pyfemtet/opt/visualization/{result_viewer/pages.py → history_viewer/result_viewer/_pages.py} +106 -82
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +18 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +45 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
- pyfemtet/opt/visualization/plotter/main_figure_creator.py +536 -0
- pyfemtet/opt/visualization/plotter/pm_graph_creator.py +359 -0
- pyfemtet/opt/worker_status.py +120 -0
- {pyfemtet-0.9.6.dist-info → pyfemtet-1.0.0.dist-info}/METADATA +23 -24
- pyfemtet-1.0.0.dist-info/RECORD +172 -0
- pyfemtet-1.0.0.dist-info/entry_points.txt +3 -0
- pyfemtet/_femtet_config_util/exit.py +0 -59
- pyfemtet/_message/1. make_pot.bat +0 -11
- pyfemtet/_message/2. make_mo.bat +0 -6
- pyfemtet/_message/__init__.py +0 -5
- pyfemtet/_message/babel.cfg +0 -2
- pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +0 -570
- pyfemtet/_message/locales/messages.pot +0 -551
- pyfemtet/_warning.py +0 -87
- pyfemtet/brep/_impl.py +0 -18
- pyfemtet/opt/_femopt.py +0 -1007
- pyfemtet/opt/_femopt_core.py +0 -1169
- pyfemtet/opt/_test_utils/control_femtet.py +0 -39
- pyfemtet/opt/_test_utils/hyper_sphere.py +0 -24
- pyfemtet/opt/_test_utils/record_history.py +0 -130
- pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
- pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
- pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -291
- pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -22
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj +0 -0
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +0 -99
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +0 -102
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -60
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -57
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -100
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -90
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
- pyfemtet/opt/interface/_base.py +0 -101
- pyfemtet/opt/interface/_excel_interface.py +0 -984
- pyfemtet/opt/interface/_femtet_excel.py +0 -141
- pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -3
- pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -178
- pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -298
- pyfemtet/opt/interface/_surrogate/__init__.py +0 -5
- pyfemtet/opt/interface/_surrogate/_base.py +0 -129
- pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -71
- pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -71
- pyfemtet/opt/interface/_surrogate_excel.py +0 -102
- pyfemtet/opt/optimizer/_base.py +0 -376
- pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -220
- pyfemtet/opt/optimizer/_optuna/_optuna.py +0 -434
- pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -1914
- pyfemtet/opt/optimizer/_scipy.py +0 -159
- pyfemtet/opt/optimizer/_scipy_scalar.py +0 -127
- pyfemtet/opt/optimizer/parameter.py +0 -113
- pyfemtet/opt/prediction/_base.py +0 -61
- pyfemtet/opt/prediction/single_task_gp.py +0 -119
- pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -29
- pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -135
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -131
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -96
- pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -74
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -58
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +0 -52
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -138
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -60
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -61
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -58
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -58
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -29
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -129
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -125
- pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -93
- pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -70
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -57
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +0 -52
- pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -138
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -58
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -59
- pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -56
- pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -56
- pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -332
- pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -201
- pyfemtet/opt/visualization/_process_monitor/application.py +0 -226
- pyfemtet/opt/visualization/_process_monitor/pages.py +0 -406
- pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
- pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
- pyfemtet-0.9.6.dist-info/RECORD +0 -158
- pyfemtet-0.9.6.dist-info/entry_points.txt +0 -3
- /pyfemtet/{_femtet_config_util → opt/problem}/__init__.py +0 -0
- /pyfemtet/{brep → opt/visualization/history_viewer}/__init__.py +0 -0
- /pyfemtet/opt/{_test_utils → visualization/history_viewer/_complex_components}/__init__.py +0 -0
- /pyfemtet/opt/{optimizer/_optuna → visualization/history_viewer/_process_monitor}/__init__.py +0 -0
- /pyfemtet/opt/{optimizer/_optuna/_botorch_patch → visualization/history_viewer/_wrapped_components}/__init__.py +0 -0
- /pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/str_enum.py +0 -0
- /pyfemtet/opt/visualization/{result_viewer → history_viewer/result_viewer}/.gitignore +0 -0
- /pyfemtet/opt/visualization/{_complex_components → history_viewer/result_viewer}/__init__.py +0 -0
- /pyfemtet/opt/visualization/{_process_monitor → plotter}/__init__.py +0 -0
- /pyfemtet/opt/{samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj → wat_ex14_parametric_jp.femprj} +0 -0
- {pyfemtet-0.9.6.dist-info → pyfemtet-1.0.0.dist-info}/LICENSE +0 -0
- {pyfemtet-0.9.6.dist-info → pyfemtet-1.0.0.dist-info}/LICENSE_THIRD_PARTY.txt +0 -0
- {pyfemtet-0.9.6.dist-info → pyfemtet-1.0.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
7
|
+
from dash import Output, Input, State, callback_context, no_update, ALL
|
|
8
|
+
from dash.exceptions import PreventUpdate
|
|
9
|
+
|
|
10
|
+
from pyfemtet.opt.visualization.history_viewer._wrapped_components import html, dcc, dbc
|
|
11
|
+
from pyfemtet.opt.visualization.history_viewer._base_application import *
|
|
12
|
+
from pyfemtet.opt.visualization.history_viewer._complex_components.main_graph import *
|
|
13
|
+
|
|
14
|
+
from pyfemtet.opt.worker_status import *
|
|
15
|
+
from pyfemtet._i18n import Msg, _
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from pyfemtet.opt.visualization.history_viewer._process_monitor._application import ProcessMonitorApplication
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
'HomePage',
|
|
23
|
+
'WorkerPage',
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DBC_COLUMN_STYLE_CENTER = {
|
|
28
|
+
'display': 'flex',
|
|
29
|
+
'justify-content': 'center',
|
|
30
|
+
'align-items': 'center',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
DBC_COLUMN_STYLE_RIGHT = {
|
|
34
|
+
'display': 'flex',
|
|
35
|
+
'justify-content': 'right',
|
|
36
|
+
'align-items': 'right',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class HomePage(AbstractPage):
|
|
41
|
+
application: ProcessMonitorApplication
|
|
42
|
+
|
|
43
|
+
def __init__(self, title, rel_url, application: ProcessMonitorApplication):
|
|
44
|
+
super().__init__(title, rel_url, application)
|
|
45
|
+
|
|
46
|
+
def setup_component(self):
|
|
47
|
+
# main graph
|
|
48
|
+
# noinspection PyAttributeOutsideInit
|
|
49
|
+
self.main_graph: MainGraph = MainGraph()
|
|
50
|
+
self.add_subpage(self.main_graph)
|
|
51
|
+
|
|
52
|
+
# entire optimization status
|
|
53
|
+
# noinspection PyAttributeOutsideInit
|
|
54
|
+
self.entire_status_message = html.H4(
|
|
55
|
+
Msg.DEFAULT_STATUS_ALERT,
|
|
56
|
+
className='alert-heading',
|
|
57
|
+
id='optimization-entire-status-message',
|
|
58
|
+
)
|
|
59
|
+
# noinspection PyAttributeOutsideInit
|
|
60
|
+
self.entire_status = dbc.Alert(
|
|
61
|
+
children=self.entire_status_message,
|
|
62
|
+
id='optimization-entire-status',
|
|
63
|
+
color='secondary',
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# keep axis range
|
|
67
|
+
button_label = _(
|
|
68
|
+
en_message='Keep {y_or_xy} ranges',
|
|
69
|
+
jp_message='{y_or_xy} 範囲を維持',
|
|
70
|
+
y_or_xy='Y' if len(self.application.history.obj_names) == 1 else 'XY'
|
|
71
|
+
)
|
|
72
|
+
# noinspection PyAttributeOutsideInit
|
|
73
|
+
self.toggle_keep_graph_range_button = dbc.Checkbox(
|
|
74
|
+
label=button_label,
|
|
75
|
+
class_name='form-switch',
|
|
76
|
+
id='toggle-keep-range',
|
|
77
|
+
value=False,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# interrupt button
|
|
81
|
+
# noinspection PyAttributeOutsideInit
|
|
82
|
+
self.interrupt_button = dbc.Button(
|
|
83
|
+
children=Msg.LABEL_INTERRUPT,
|
|
84
|
+
color='danger',
|
|
85
|
+
id='interrupt-optimization-button',
|
|
86
|
+
disabled=True,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# sync interval
|
|
90
|
+
# noinspection PyAttributeOutsideInit
|
|
91
|
+
self.interval = dcc.Interval(id='process-monitor-home-interval', interval=3000)
|
|
92
|
+
|
|
93
|
+
def setup_layout(self):
|
|
94
|
+
""""""
|
|
95
|
+
"""
|
|
96
|
+
=======================
|
|
97
|
+
| | ---------------- |
|
|
98
|
+
| | | | |
|
|
99
|
+
| | | Main Graph | |
|
|
100
|
+
| | | | |
|
|
101
|
+
| | ---------------- |
|
|
102
|
+
| | [stop][interrupt]<---- Buttons
|
|
103
|
+
| | ---------------- |
|
|
104
|
+
| | | Status | |
|
|
105
|
+
| ^| ---------------- |
|
|
106
|
+
==|====================
|
|
107
|
+
|
|
|
108
|
+
SideBar
|
|
109
|
+
"""
|
|
110
|
+
self.layout = dbc.Container(
|
|
111
|
+
children=[
|
|
112
|
+
self.interval,
|
|
113
|
+
self.main_graph.layout,
|
|
114
|
+
self.entire_status,
|
|
115
|
+
dbc.Row(
|
|
116
|
+
children=[
|
|
117
|
+
dbc.Col(self.toggle_keep_graph_range_button),
|
|
118
|
+
dbc.Col(self.interrupt_button, style=DBC_COLUMN_STYLE_RIGHT),
|
|
119
|
+
],
|
|
120
|
+
),
|
|
121
|
+
]
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
def setup_callback(self):
|
|
125
|
+
# setup callback of subpages
|
|
126
|
+
super().setup_callback()
|
|
127
|
+
|
|
128
|
+
app = self.application.app
|
|
129
|
+
|
|
130
|
+
# ===== Delete Loading Animation =====
|
|
131
|
+
@app.callback(
|
|
132
|
+
Output(self.main_graph.loading.id, self.main_graph.loading.Prop.target_components),
|
|
133
|
+
Input(self.main_graph.graph.id, 'figure'),
|
|
134
|
+
prevent_initial_call=True,
|
|
135
|
+
)
|
|
136
|
+
def disable_loading_animation(_):
|
|
137
|
+
return {}
|
|
138
|
+
|
|
139
|
+
# ===== history data to graph ======
|
|
140
|
+
@app.callback(
|
|
141
|
+
Output(self.main_graph.callback_chain_key.id, self.main_graph.callback_chain_arg_keep_range, allow_duplicate=True), # fire update graph callback
|
|
142
|
+
Input(self.interval.id, self.interval.Prop.n_intervals),
|
|
143
|
+
State(self.toggle_keep_graph_range_button.id, self.toggle_keep_graph_range_button.Prop.value),
|
|
144
|
+
State(self.main_graph.data_length.id, self.main_graph.data_length_prop), # check should update or not
|
|
145
|
+
prevent_initial_call=True,)
|
|
146
|
+
def update_graph(_, keep_range, current_graph_data_length):
|
|
147
|
+
current_graph_data_length = 0 if current_graph_data_length is None else current_graph_data_length
|
|
148
|
+
|
|
149
|
+
if callback_context.triggered_id is None:
|
|
150
|
+
raise PreventUpdate
|
|
151
|
+
|
|
152
|
+
# If new data does not exist, do nothing
|
|
153
|
+
if len(self.application.get_df()) <= current_graph_data_length:
|
|
154
|
+
raise PreventUpdate
|
|
155
|
+
|
|
156
|
+
# fire callback
|
|
157
|
+
return keep_range
|
|
158
|
+
|
|
159
|
+
# ===== show optimization state =====
|
|
160
|
+
@app.callback(
|
|
161
|
+
Output(self.entire_status.id, self.entire_status.Prop.color),
|
|
162
|
+
Output(self.entire_status_message.id, 'children'),
|
|
163
|
+
Input(self.interval.id, self.interval.Prop.n_intervals),
|
|
164
|
+
prevent_initial_call=False,)
|
|
165
|
+
def update_entire_status(*_):
|
|
166
|
+
# get status message
|
|
167
|
+
msg = str(self.application.entire_status.value)
|
|
168
|
+
color = self.application.get_status_color(self.application.entire_status)
|
|
169
|
+
return color, msg
|
|
170
|
+
|
|
171
|
+
# ===== Interrupt Optimization and Control Button Disabled =====
|
|
172
|
+
@app.callback(
|
|
173
|
+
Output(self.interrupt_button.id, self.interrupt_button.Prop.disabled),
|
|
174
|
+
Input(self.interrupt_button.id, self.interrupt_button.Prop.n_clicks),
|
|
175
|
+
prevent_initial_call=False,)
|
|
176
|
+
def interrupt_optimization(*_):
|
|
177
|
+
# If page (re)loaded,
|
|
178
|
+
if callback_context.triggered_id is None:
|
|
179
|
+
# Enable only if the entire_state < INTERRUPTING
|
|
180
|
+
if self.application.entire_status.value < WorkerStatus.interrupting:
|
|
181
|
+
return False
|
|
182
|
+
# Keep disable(default) if process is interrupting or terminating.
|
|
183
|
+
else:
|
|
184
|
+
raise PreventUpdate
|
|
185
|
+
|
|
186
|
+
# If the entire_state < INTERRUPTING, set INTERRUPTING
|
|
187
|
+
if self.application.entire_status.value < WorkerStatus.interrupting:
|
|
188
|
+
self.application.entire_status.value = WorkerStatus.interrupting
|
|
189
|
+
return True
|
|
190
|
+
|
|
191
|
+
# keep disabled
|
|
192
|
+
raise PreventUpdate
|
|
193
|
+
|
|
194
|
+
# ===== TEST CODE =====
|
|
195
|
+
if self.application.is_debug:
|
|
196
|
+
|
|
197
|
+
# # increment status
|
|
198
|
+
# self.layout.children.append(dbc.Button(children='local_status を進める', id='debug-button-1'))
|
|
199
|
+
#
|
|
200
|
+
# @app.callback(Output(self.interval.id, self.interval.Prop.interval),
|
|
201
|
+
# Input('debug-button-1', 'n_clicks'),
|
|
202
|
+
# prevent_initial_call=True)
|
|
203
|
+
# def status_change(*_):
|
|
204
|
+
# self.application.entire_status += 10
|
|
205
|
+
# for i in range(len(self.application.worker_status_list)):
|
|
206
|
+
# self.application.worker_status_list[i] += 10
|
|
207
|
+
# raise PreventUpdate
|
|
208
|
+
|
|
209
|
+
# increment data
|
|
210
|
+
self.layout.children.append(dbc.Button(children='local_data を増やす', id='debug-button-2'))
|
|
211
|
+
|
|
212
|
+
@app.callback(Output(self.interval.id, self.interval.Prop.interval, allow_duplicate=True),
|
|
213
|
+
Input('debug-button-2', 'n_clicks'),
|
|
214
|
+
prevent_initial_call=True)
|
|
215
|
+
def add_data(*_):
|
|
216
|
+
meta_columns = self.application.history._records.column_manager.meta_columns
|
|
217
|
+
df = self.application.local_data
|
|
218
|
+
|
|
219
|
+
new_row = df.iloc[-2:]
|
|
220
|
+
obj_index = np.where(np.array(meta_columns) == 'obj')[0]
|
|
221
|
+
for idx in obj_index:
|
|
222
|
+
new_row.iloc[:, idx] = np.random.rand(len(new_row))
|
|
223
|
+
|
|
224
|
+
df = pd.concat([df, new_row])
|
|
225
|
+
df.trial = np.array(range(len(df)))
|
|
226
|
+
logger.debug(df)
|
|
227
|
+
|
|
228
|
+
self.application.local_data = df
|
|
229
|
+
|
|
230
|
+
raise PreventUpdate
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class WorkerPage(AbstractPage):
|
|
234
|
+
application: ProcessMonitorApplication
|
|
235
|
+
|
|
236
|
+
def __init__(self, title, rel_url, application):
|
|
237
|
+
super().__init__(title, rel_url, application)
|
|
238
|
+
|
|
239
|
+
def setup_component(self):
|
|
240
|
+
# noinspection PyAttributeOutsideInit
|
|
241
|
+
self.interval = dcc.Interval(id='worker-page-interval', interval=1000)
|
|
242
|
+
|
|
243
|
+
# noinspection PyAttributeOutsideInit
|
|
244
|
+
self.worker_status_alerts = []
|
|
245
|
+
for i in range(len(self.application.worker_names)):
|
|
246
|
+
id_worker_alert = f'worker-status-alert-{i}'
|
|
247
|
+
alert = dbc.Alert('worker status here', id=id_worker_alert, color='dark')
|
|
248
|
+
self.worker_status_alerts.append(alert)
|
|
249
|
+
|
|
250
|
+
def setup_layout(self):
|
|
251
|
+
rows = [self.interval]
|
|
252
|
+
rows.extend(
|
|
253
|
+
[dbc.Row([dbc.Col(html.Div(dcc.Loading(alert, id={"type": "loading", "index": i})))])
|
|
254
|
+
for i, alert in enumerate(self.worker_status_alerts)])
|
|
255
|
+
|
|
256
|
+
self.layout = dbc.Container(
|
|
257
|
+
children=rows,
|
|
258
|
+
fluid=True,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
def setup_callback(self):
|
|
262
|
+
app = self.application.app
|
|
263
|
+
|
|
264
|
+
@app.callback(
|
|
265
|
+
[Output(alert.id, 'children') for alert in self.worker_status_alerts],
|
|
266
|
+
[Output(alert.id, 'color') for alert in self.worker_status_alerts],
|
|
267
|
+
Output({"type": "loading", "index": ALL}, "target_components"),
|
|
268
|
+
Input(self.interval.id, 'n_intervals'),
|
|
269
|
+
)
|
|
270
|
+
def update_worker_state(_):
|
|
271
|
+
|
|
272
|
+
ret = []
|
|
273
|
+
|
|
274
|
+
for worker_name, worker_address, worker_status in (
|
|
275
|
+
zip(
|
|
276
|
+
self.application.worker_names,
|
|
277
|
+
self.application.worker_addresses,
|
|
278
|
+
self.application.worker_status_list,
|
|
279
|
+
)):
|
|
280
|
+
worker_status_message = worker_status.value.str()
|
|
281
|
+
ret.append(f'{worker_name} ({worker_address}) is '
|
|
282
|
+
f'{worker_status_message}')
|
|
283
|
+
|
|
284
|
+
ret.extend(
|
|
285
|
+
[self.application.get_status_color(worker_status)
|
|
286
|
+
for worker_status in self.application.worker_status_list])
|
|
287
|
+
ret.append(
|
|
288
|
+
[({} if callback_context.triggered_id is None else no_update)
|
|
289
|
+
for _ in range(len(self.worker_status_alerts))])
|
|
290
|
+
|
|
291
|
+
return tuple(ret)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from pyfemtet.opt.visualization.
|
|
2
|
-
from pyfemtet.opt.visualization.
|
|
3
|
-
from pyfemtet.opt.visualization.
|
|
1
|
+
from pyfemtet.opt.visualization.history_viewer._base_application import *
|
|
2
|
+
from pyfemtet.opt.visualization.history_viewer._common_pages import *
|
|
3
|
+
from pyfemtet.opt.visualization.history_viewer.result_viewer._pages import *
|
|
4
4
|
|
|
5
|
-
from pyfemtet.
|
|
5
|
+
from pyfemtet._i18n import Msg
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class ResultViewerApplication(PyFemtetApplicationBase):
|
|
@@ -36,7 +36,7 @@ def _debug():
|
|
|
36
36
|
g_application.run(debug=True)
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
def
|
|
39
|
+
def result_viewer_main():
|
|
40
40
|
g_application = ResultViewerApplication()
|
|
41
41
|
|
|
42
42
|
g_home_page = HomePage(Msg.PAGE_TITLE_RESULT)
|
|
@@ -52,4 +52,4 @@ def main():
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
if __name__ == '__main__':
|
|
55
|
-
|
|
55
|
+
result_viewer_main()
|
pyfemtet/opt/visualization/{result_viewer/pages.py → history_viewer/result_viewer/_pages.py}
RENAMED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import json
|
|
2
1
|
import os
|
|
3
2
|
import tempfile
|
|
4
3
|
import base64
|
|
5
|
-
|
|
6
|
-
import numpy as np
|
|
7
|
-
import pandas as pd
|
|
8
|
-
import shutil
|
|
4
|
+
from traceback import print_exception
|
|
9
5
|
|
|
10
6
|
from dash import Output, Input, State, callback_context, no_update
|
|
11
7
|
from dash.exceptions import PreventUpdate
|
|
12
8
|
|
|
13
|
-
from pyfemtet.opt.
|
|
14
|
-
|
|
15
|
-
from pyfemtet.opt.visualization.
|
|
16
|
-
from pyfemtet.opt.visualization.
|
|
17
|
-
from pyfemtet.opt.visualization._complex_components.
|
|
18
|
-
from pyfemtet.opt.visualization._complex_components.
|
|
9
|
+
from pyfemtet.opt.history import History
|
|
10
|
+
|
|
11
|
+
from pyfemtet.opt.visualization.history_viewer._wrapped_components import dcc, dbc, html
|
|
12
|
+
from pyfemtet.opt.visualization.history_viewer._base_application import *
|
|
13
|
+
from pyfemtet.opt.visualization.history_viewer._complex_components.main_graph import *
|
|
14
|
+
from pyfemtet.opt.visualization.history_viewer._complex_components.control_femtet import *
|
|
15
|
+
from pyfemtet.opt.visualization.history_viewer._complex_components.alert_region import *
|
|
16
|
+
|
|
17
|
+
from pyfemtet._i18n import Msg, _
|
|
18
|
+
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
__all__ = [
|
|
21
|
+
'HomePage'
|
|
22
|
+
]
|
|
21
23
|
|
|
22
|
-
from pyfemtet._message import Msg
|
|
23
24
|
|
|
25
|
+
# TODO: テスト
|
|
24
26
|
|
|
25
27
|
class HomePage(AbstractPage):
|
|
26
28
|
|
|
@@ -127,7 +129,6 @@ class HomePage(AbstractPage):
|
|
|
127
129
|
@app.callback(
|
|
128
130
|
Output(self.file_picker_button.id, self.file_picker_button.Prop.children),
|
|
129
131
|
Output(self.main_graph.tabs.id, self.main_graph.tabs.Prop.active_tab, allow_duplicate=False),
|
|
130
|
-
# Output(self.femtet_control.connect_femtet_button.id, self.femtet_control.connect_femtet_button.Prop.n_clicks), # automatically connect to femtet is now deprecated because use view-only without femtet license
|
|
131
132
|
Input(self.file_picker.id, self.file_picker.Prop.contents),
|
|
132
133
|
State(self.file_picker.id, self.file_picker.Prop.filename),
|
|
133
134
|
State(self.main_graph.tabs.id, self.main_graph.tabs.Prop.active_tab),
|
|
@@ -154,7 +155,8 @@ class HomePage(AbstractPage):
|
|
|
154
155
|
csv_path = os.path.join(tmp_dir_path, file_name)
|
|
155
156
|
with open(csv_path, 'wb') as f:
|
|
156
157
|
f.write(file_content)
|
|
157
|
-
self.application.history = History(
|
|
158
|
+
self.application.history = History()
|
|
159
|
+
self.application.history.load_csv(csv_path, with_finalize=True)
|
|
158
160
|
|
|
159
161
|
return f'current file: {file_name}', active_tab_id
|
|
160
162
|
|
|
@@ -166,7 +168,7 @@ class HomePage(AbstractPage):
|
|
|
166
168
|
State(self.alert_region.alert_region.id, 'children'),
|
|
167
169
|
prevent_initial_call=True,
|
|
168
170
|
)
|
|
169
|
-
def open_pdt(
|
|
171
|
+
def open_pdt(_1, selection_data, current_alerts):
|
|
170
172
|
# open_pdt allows to open "解析結果単体" without opening any femprj.
|
|
171
173
|
|
|
172
174
|
# check Femtet state
|
|
@@ -175,6 +177,7 @@ class HomePage(AbstractPage):
|
|
|
175
177
|
msg = Msg.ERR_NO_CONNECTION_ESTABLISHED
|
|
176
178
|
alerts = self.alert_region.create_alerts(msg, color='danger', current_alerts=current_alerts)
|
|
177
179
|
return alerts
|
|
180
|
+
assert self.femtet_control.fem is not None
|
|
178
181
|
|
|
179
182
|
# check selection
|
|
180
183
|
if selection_data is None:
|
|
@@ -200,22 +203,37 @@ class HomePage(AbstractPage):
|
|
|
200
203
|
|
|
201
204
|
# check pdt_path in selection_data
|
|
202
205
|
pt = selection_data['points'][0]
|
|
203
|
-
trial = pt['customdata'][0]
|
|
206
|
+
trial = pt['customdata'][0] # TODO: MAIN 以外のデータに対応
|
|
207
|
+
|
|
208
|
+
# construct trial_name
|
|
209
|
+
trial_name = History.get_trial_name(trial=trial, fidelity=None, sub_sampling=None)
|
|
204
210
|
|
|
205
211
|
# get pdt path
|
|
206
|
-
pdt_path = self.femtet_control.fem.
|
|
212
|
+
pdt_path = self.femtet_control.fem._create_path(
|
|
213
|
+
femprj_path, model_name, trial_name, 'pdt',
|
|
214
|
+
)
|
|
207
215
|
|
|
208
216
|
# check pdt exists
|
|
209
217
|
if not os.path.exists(pdt_path):
|
|
210
|
-
msg = (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
218
|
+
msg = _(
|
|
219
|
+
en_message='.pdt file ({pdt_path}) is not found. '
|
|
220
|
+
'Please check the .Results folder. '
|
|
221
|
+
'Note that .pdt file save mode depends on '
|
|
222
|
+
'the `save_pdt` argument of FemtetInterface in optimization script'
|
|
223
|
+
'(default to `all`).',
|
|
224
|
+
jp_message='.pdt file ({pdt_path}) is not found. '
|
|
225
|
+
'Please check the .Results folder. '
|
|
226
|
+
'Note that .pdt file save mode depends on '
|
|
227
|
+
'the `save_pdt` argument of FemtetInterface in optimization script'
|
|
228
|
+
'(default to `all`).',
|
|
229
|
+
pdt_path=pdt_path,
|
|
230
|
+
)
|
|
231
|
+
|
|
215
232
|
alerts = self.alert_region.create_alerts(msg, color='danger')
|
|
216
233
|
return alerts
|
|
217
234
|
|
|
218
235
|
# OpenPDT(PDTFile As String, bOpenWithGUI As Boolean)
|
|
236
|
+
# noinspection PyPep8Naming
|
|
219
237
|
Femtet = self.femtet_control.fem.Femtet
|
|
220
238
|
succeed = Femtet.OpenPDT(pdt_path, True)
|
|
221
239
|
|
|
@@ -234,7 +252,7 @@ class HomePage(AbstractPage):
|
|
|
234
252
|
State(self.alert_region.alert_region.id, 'children'),
|
|
235
253
|
prevent_initial_call=True,
|
|
236
254
|
)
|
|
237
|
-
def update_parameter(
|
|
255
|
+
def update_parameter(_1, selection_data, current_alerts):
|
|
238
256
|
|
|
239
257
|
# check Femtet state
|
|
240
258
|
connection_state = self.femtet_control.check_femtet_state()
|
|
@@ -250,12 +268,27 @@ class HomePage(AbstractPage):
|
|
|
250
268
|
return alerts
|
|
251
269
|
|
|
252
270
|
try:
|
|
271
|
+
# noinspection PyPep8Naming
|
|
253
272
|
Femtet = self.femtet_control.fem.Femtet
|
|
254
273
|
|
|
255
274
|
# check model to open is included in current project
|
|
256
275
|
if (self.femtet_control.fem.femprj_path != Femtet.Project) \
|
|
257
276
|
or (self.femtet_control.fem.model_name not in Femtet.GetAnalysisModelNames_py()):
|
|
258
|
-
|
|
277
|
+
|
|
278
|
+
msg = _(
|
|
279
|
+
en_message='Model {model_name} is not in current project. '
|
|
280
|
+
'Please check opened project. '
|
|
281
|
+
'For example, if you have "Analysis Results '
|
|
282
|
+
'Only" open, please switch the project to '
|
|
283
|
+
'{prj_name}.',
|
|
284
|
+
jp_message='モデル {model_name} は現在のプロジェクトに含まれていません。'
|
|
285
|
+
'開いているプロジェクトを確認してください。例えば「解析結果単体」'
|
|
286
|
+
'を開いている場合、プロジェクトを {prj_name} に切り替えてください。',
|
|
287
|
+
model_name=self.femtet_control.fem.model_name,
|
|
288
|
+
prj_name=os.path.basename(self.femtet_control.fem.femprj_path),
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
259
292
|
alerts = self.alert_region.create_alerts(msg, color='danger', current_alerts=current_alerts)
|
|
260
293
|
return alerts
|
|
261
294
|
|
|
@@ -270,39 +303,40 @@ class HomePage(AbstractPage):
|
|
|
270
303
|
...
|
|
271
304
|
|
|
272
305
|
except Exception as e:
|
|
273
|
-
|
|
274
|
-
|
|
306
|
+
print_exception(e)
|
|
307
|
+
msg = _(
|
|
308
|
+
en_message='Unknown error has occurred in '
|
|
309
|
+
'analysis model compatibility check. '
|
|
310
|
+
'Exception message: {e}',
|
|
311
|
+
jp_message='Unknown error has occurred in '
|
|
312
|
+
'analysis model compatibility check. '
|
|
313
|
+
'Exception message: {e}',
|
|
314
|
+
e=e
|
|
315
|
+
)
|
|
275
316
|
alerts = self.alert_region.create_alerts(msg, color='danger', current_alerts=current_alerts)
|
|
276
317
|
return alerts
|
|
277
318
|
|
|
278
319
|
try:
|
|
279
320
|
# get nth trial from selection data
|
|
280
321
|
pt = selection_data['points'][0]
|
|
281
|
-
trial = pt['customdata'][0]
|
|
322
|
+
trial = pt['customdata'][0] # FIXME: MAIN 以外のデータに対応
|
|
282
323
|
|
|
283
324
|
# get parameter and update model
|
|
284
|
-
df = self.application.
|
|
325
|
+
df = self.application.get_df()
|
|
285
326
|
row = df[df['trial'] == trial]
|
|
286
|
-
|
|
287
|
-
|
|
327
|
+
prm_names = self.application.history.prm_names
|
|
328
|
+
prm_values = row[prm_names].values.ravel()
|
|
329
|
+
x = {name: value for name, value in zip(prm_names, prm_values)}
|
|
288
330
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
parameter = pd.DataFrame(
|
|
293
|
-
dict(
|
|
294
|
-
name=names,
|
|
295
|
-
value=values,
|
|
296
|
-
)
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
self.femtet_control.fem.update_model(parameter)
|
|
331
|
+
self.femtet_control.fem.update_parameter(x)
|
|
332
|
+
self.femtet_control.fem.update_model()
|
|
300
333
|
|
|
301
334
|
Femtet.SaveProject(Femtet.Project, True)
|
|
302
335
|
|
|
303
336
|
return no_update
|
|
304
337
|
|
|
305
338
|
except Exception as e:
|
|
339
|
+
print_exception(e)
|
|
306
340
|
msg = ('Unknown error has occurred in updating model. '
|
|
307
341
|
f'exception message is: {e}')
|
|
308
342
|
alerts = self.alert_region.create_alerts(msg, color='danger', current_alerts=current_alerts)
|
|
@@ -350,11 +384,15 @@ class HomePage(AbstractPage):
|
|
|
350
384
|
femprj_path_history_on_history: str or None = kwargs['femprj_path']
|
|
351
385
|
model_name_on_history: str or None = kwargs['model_name']
|
|
352
386
|
# ├ Femtet-side
|
|
387
|
+
# noinspection PyPep8Naming
|
|
353
388
|
Femtet = self.femtet_control.fem.Femtet
|
|
354
389
|
femprj_path: str = Femtet.Project # it can be '解析結果単体.femprj'
|
|
355
390
|
model_name: str = Femtet.AnalysisModelName
|
|
356
391
|
# └ check
|
|
357
|
-
|
|
392
|
+
if femprj_path_history_on_history is not None:
|
|
393
|
+
is_same_femprj = (femprj_path == femprj_path_history_on_history)
|
|
394
|
+
else:
|
|
395
|
+
is_same_femprj = True
|
|
358
396
|
is_same_model = (model_name == model_name_on_history) if model_name is not None else True
|
|
359
397
|
|
|
360
398
|
# alert
|
|
@@ -631,7 +669,6 @@ class Tutorial(AbstractPage):
|
|
|
631
669
|
@app.callback(
|
|
632
670
|
Output(self.main_graph.tabs, self.main_graph.tabs.Prop.active_tab, allow_duplicate=True),
|
|
633
671
|
Output(self.control_visibility_input_dummy, 'children'),
|
|
634
|
-
# Output(self.femtet_control.connect_femtet_button, 'n_clicks', allow_duplicate=True), # automatically open femtet is now deprecated because enable to use analytical functions without using license.
|
|
635
672
|
Output(alert_region, 'children', allow_duplicate=True),
|
|
636
673
|
Input(self.load_sample_csv_button, 'n_clicks'),
|
|
637
674
|
State(self.main_graph.tabs, self.main_graph.tabs.Prop.active_tab),
|
|
@@ -643,41 +680,44 @@ class Tutorial(AbstractPage):
|
|
|
643
680
|
if callback_context.triggered_id is None:
|
|
644
681
|
raise PreventUpdate
|
|
645
682
|
|
|
646
|
-
#
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
sample_dir = os.path.join(package_root, 'opt', 'samples', 'femprj_sample') # FIXME: locale によってパスを変える
|
|
650
|
-
path = os.path.join(sample_dir, 'wat_ex14_parametric_test_result.reccsv')
|
|
683
|
+
# copy sample files
|
|
684
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
685
|
+
sample_dir = os.path.join(here, 'tutorial_files') # TODO: locale ごとにファイルを用意する
|
|
651
686
|
|
|
652
|
-
|
|
687
|
+
# get sample file
|
|
688
|
+
path = os.path.join(sample_dir, 'tutorial_gau_ex08.csv')
|
|
689
|
+
if not os.path.isfile(path):
|
|
653
690
|
msg = Msg.ERR_SAMPLE_CSV_NOT_FOUND
|
|
654
691
|
alerts = self.home_page.alert_region.create_alerts(msg, color='danger', current_alerts=current_alerts)
|
|
655
692
|
return no_update, no_update, alerts
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
self.application.history = History(destination_file)
|
|
693
|
+
self.application.history = History()
|
|
694
|
+
self.application.history.load_csv(path, with_finalize=True)
|
|
659
695
|
|
|
660
|
-
|
|
661
|
-
if not os.path.
|
|
696
|
+
femprj_path = path.replace('.csv', '_parametric.femprj')
|
|
697
|
+
if not os.path.isfile(femprj_path):
|
|
662
698
|
msg = Msg.ERR_SAMPLE_FEMPRJ_NOT_FOUND
|
|
663
699
|
alerts = self.home_page.alert_region.create_alerts(msg, color='danger', current_alerts=current_alerts)
|
|
664
700
|
return no_update, no_update, alerts
|
|
665
|
-
destination_file = source_file.replace('wat_ex14_parametric', 'tutorial')
|
|
666
|
-
shutil.copyfile(source_file, destination_file)
|
|
667
701
|
|
|
668
|
-
|
|
669
|
-
if not os.path.
|
|
702
|
+
result_folder = femprj_path.replace('.femprj', '.Results')
|
|
703
|
+
if not os.path.isdir(result_folder):
|
|
670
704
|
msg = Msg.ERR_FEMPRJ_RESULT_NOT_FOUND
|
|
671
705
|
alerts = self.home_page.alert_region.create_alerts(msg, color='danger', current_alerts=current_alerts)
|
|
672
706
|
return no_update, no_update, alerts
|
|
673
|
-
destination_folder = source_folder.replace('wat_ex14_parametric', 'tutorial')
|
|
674
|
-
shutil.copytree(source_folder, destination_folder, dirs_exist_ok=True)
|
|
675
707
|
|
|
676
|
-
self.application.history
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
708
|
+
history = self.application.history
|
|
709
|
+
|
|
710
|
+
additional_data = history.additional_data
|
|
711
|
+
additional_data.update(dict(
|
|
712
|
+
femprj_path=femprj_path
|
|
713
|
+
))
|
|
714
|
+
|
|
715
|
+
history.finalize(
|
|
716
|
+
parameters=history._records.column_manager.parameters,
|
|
717
|
+
obj_names=history.obj_names,
|
|
718
|
+
cns_names=history.cns_names,
|
|
719
|
+
sub_fidelity_names=history.sub_fidelity_names,
|
|
720
|
+
additional_data=additional_data,
|
|
681
721
|
)
|
|
682
722
|
|
|
683
723
|
return active_tab, 1, no_update
|
|
@@ -715,19 +755,3 @@ class Tutorial(AbstractPage):
|
|
|
715
755
|
else:
|
|
716
756
|
current_style.update(part)
|
|
717
757
|
return current_style
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
class PredictionModelPage(AbstractPage):
|
|
721
|
-
""""""
|
|
722
|
-
|
|
723
|
-
def __init__(self, title, rel_url, application):
|
|
724
|
-
from pyfemtet.opt.visualization._process_monitor.application import ProcessMonitorApplication
|
|
725
|
-
self.application: ProcessMonitorApplication = None
|
|
726
|
-
super().__init__(title, rel_url, application)
|
|
727
|
-
|
|
728
|
-
def setup_component(self):
|
|
729
|
-
self.rsm_graph: PredictionModelGraph = PredictionModelGraph()
|
|
730
|
-
self.add_subpage(self.rsm_graph)
|
|
731
|
-
|
|
732
|
-
def setup_layout(self):
|
|
733
|
-
self.layout = self.rsm_graph.layout
|