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

@@ -110,44 +110,69 @@ class ParametricResultCSVProcessor:
110
110
  df['row_num'] = range(2, len(df) + 2) # row=0 は header, excel は 1 始まり
111
111
 
112
112
  # 「結果出力設定番号」カラムが存在するか
113
- if '結果出力設定番号' in df.columns: # TODO: 英語版対応
113
+ key = '結果出力設定番号'
114
+ key_en = ' Output setting Number'
114
115
 
115
- # 与えられた output_number に関連する行だけ抜き出し
116
- # エラーがあるかどうかチェックする
117
- idx = df['結果出力設定番号'] == parametric_output_index + 1
118
- pdf = df[idx]
116
+ def get_pdf(key_, key_en_):
117
+ if key_ in df.columns:
119
118
 
120
- # 結果出力設定番号 カラムが存在しない
121
- else:
122
- # output_number に関係なくエラーがあればエラーにする
123
- pdf = df
119
+ # 与えられた output_number に関連する行だけ抜き出し
120
+ # エラーがあるかどうかチェックする
121
+ idx = df[key_] == parametric_output_index + 1
122
+ pdf_ = df[idx]
123
+
124
+ elif key_en_ in df.columns:
125
+ idx = df[key_en_] == parametric_output_index + 1
126
+ pdf_ = df[idx]
127
+
128
+ # 結果出力設定番号 カラムが存在しない
129
+ else:
130
+ # output_number に関係なくエラーがあればエラーにする
131
+ pdf_ = df
132
+
133
+ return pdf_
134
+
135
+ pdf = get_pdf(key, key_en)
124
136
 
125
137
  # エラーの有無を確認
126
- if 'エラー' in pdf.columns: # TODO: 英語版対応
127
- is_no_error = np.all(pdf['エラー'].isna().values)
128
-
129
- if not is_no_error:
130
- error_message_row_numbers = pdf['row_num'][~pdf['エラー'].isna()].values.astype(str)
131
- error_messages = pdf['エラー'][~pdf['エラー'].isna()].values.astype(str)
132
-
133
- def add_st_or_nd_or_th(n_: int):
134
- if n_ == 1:
135
- return f'{n_}st'
136
- elif n_ == 2:
137
- return f'{n_}nd'
138
- elif n_ == 3:
139
- return f'{n_}rd'
140
- else:
141
- return f'{n_}th'
142
-
143
- error_msg = f'Error message(s) from {os.path.basename(table_csv_path)}: ' + ', '.join(
144
- [f'({add_st_or_nd_or_th(row)} row) {message}'
145
- for row, message in zip(error_message_row_numbers, error_messages)])
138
+ key = 'エラー'
139
+
140
+ def handle_error(key_):
141
+ if key_ in pdf.columns:
142
+ is_no_error_ = np.all(pdf[key_].isna().values)
143
+
144
+ if not is_no_error_:
145
+ error_message_row_numbers = pdf['row_num'][~pdf[key_].isna()].values.astype(str)
146
+ error_messages = pdf[key_][~pdf[key_].isna()].values.astype(str)
147
+
148
+ def add_st_or_nd_or_th(n_: int):
149
+ if n_ == 1:
150
+ return f'{n_}st'
151
+ elif n_ == 2:
152
+ return f'{n_}nd'
153
+ elif n_ == 3:
154
+ return f'{n_}rd'
155
+ else:
156
+ return f'{n_}th'
157
+
158
+ error_msg_ = f'Error message(s) from {os.path.basename(table_csv_path)}: ' + ', '.join(
159
+ [f'({add_st_or_nd_or_th(row)} row) {message}'
160
+ for row, message in zip(error_message_row_numbers, error_messages)])
161
+ else:
162
+ error_msg_ = None
163
+
164
+ return is_no_error_, error_msg_
165
+
146
166
  else:
147
- error_msg = None
167
+ return None, 'NO_KEY'
168
+
169
+ is_no_error, error_msg = handle_error(key)
148
170
 
149
- else:
150
- raise RuntimeError('Internal Error! Parametric Analysis '
171
+ if error_msg == 'NO_KEY':
172
+ key = ' Error'
173
+ is_no_error, error_msg = handle_error(key)
174
+ if error_msg == 'NO_KEY':
175
+ assert False, ('Internal Error! Parametric Analysis '
151
176
  'output csv has no error column.')
152
177
 
153
178
  return is_no_error, error_msg
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyfemtet
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Design parameter optimization using Femtet.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -43,7 +43,7 @@ pyfemtet/opt/interface/_excel_interface/__init__.py,sha256=bFOmY18-j4RJc_dHQMe62
43
43
  pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm,sha256=TM1CEOC5XtU7qYKNnHScO02kdtXT-gc5y29m2hatsm0,114259
44
44
  pyfemtet/opt/interface/_excel_interface/excel_interface.py,sha256=Sghavj7bcslQ5ue9xJzV6DdBfhv6XKn-XxKD-T39KEo,39854
45
45
  pyfemtet/opt/interface/_femtet_interface/__init__.py,sha256=snQruC8Rl_5rFeVmiqw9lmzdJ5mL42HpIlHIn5ytd8s,77
46
- pyfemtet/opt/interface/_femtet_interface/_femtet_parametric.py,sha256=dEe6udq2CBpXAcKCye90sXC0UVKok14LORitobc8DK8,10282
46
+ pyfemtet/opt/interface/_femtet_interface/_femtet_parametric.py,sha256=Om2S1hd90nQSuOXf1ylUJiILcxVhLiCOL4dc34lJzdM,10946
47
47
  pyfemtet/opt/interface/_femtet_interface/femtet_interface.py,sha256=ptvklQdKwSq9sW712Y4-sO4nTZPVfjrDdBToGOyQoIE,45717
48
48
  pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py,sha256=ppeoWVSmVsTmDNKpuFRVTnhjcoefQVEog3-FRiKpEe4,104
49
49
  pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py,sha256=IPIoNMtcJmtiv7eM3yDMWDOynTf0mXd-438LoDVqZCU,8628
@@ -174,9 +174,9 @@ pyfemtet/opt/visualization/plotter/parallel_plot_creator.py,sha256=VRhT0CUG1mCHD
174
174
  pyfemtet/opt/visualization/plotter/pm_graph_creator.py,sha256=7EwmoJlnHwDrpw65NchiA63FIjgGTLq6vTcpTzrSnJo,11841
175
175
  pyfemtet/opt/wat_ex14_parametric_jp.femprj,sha256=dMwQMt6yok_PbZLyxPYdmg5wJQwgQDZ4RhS76zdGLGk,177944
176
176
  pyfemtet/opt/worker_status.py,sha256=simvPa1AkO1idmPXrF5WjYVEBx3tO7hLhbM3J1rFjdo,3824
177
- pyfemtet-1.2.1.dist-info/METADATA,sha256=xZOqdfjtSbf1ZCNoG2Z3nwC4SJpNkPBaa_zaUzDk0Uk,3410
178
- pyfemtet-1.2.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
179
- pyfemtet-1.2.1.dist-info/entry_points.txt,sha256=Tsb_l_8Z6pyyq2tRfuKiwfJUV3nq_cHoLS61foALtsg,134
180
- pyfemtet-1.2.1.dist-info/licenses/LICENSE,sha256=LWUL5LlMGjSRTvsalS8_fFuwS4VMw18fJSNWFwDK8pc,1060
181
- pyfemtet-1.2.1.dist-info/licenses/LICENSE_THIRD_PARTY.txt,sha256=8_9-cgzTpmeuCqItPZb9-lyAZcH2Qp9sZTU_hYuOZIQ,191
182
- pyfemtet-1.2.1.dist-info/RECORD,,
177
+ pyfemtet-1.2.2.dist-info/METADATA,sha256=N9PmEhNuXhmfN8fAt-HBRWGuHgxuJRfSeepHIJgkZxY,3410
178
+ pyfemtet-1.2.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
179
+ pyfemtet-1.2.2.dist-info/entry_points.txt,sha256=Tsb_l_8Z6pyyq2tRfuKiwfJUV3nq_cHoLS61foALtsg,134
180
+ pyfemtet-1.2.2.dist-info/licenses/LICENSE,sha256=LWUL5LlMGjSRTvsalS8_fFuwS4VMw18fJSNWFwDK8pc,1060
181
+ pyfemtet-1.2.2.dist-info/licenses/LICENSE_THIRD_PARTY.txt,sha256=8_9-cgzTpmeuCqItPZb9-lyAZcH2Qp9sZTU_hYuOZIQ,191
182
+ pyfemtet-1.2.2.dist-info/RECORD,,