From a748d20de22bb22494b49c98d530f3784a27e06f Mon Sep 17 00:00:00 2001 From: sanginnwoo Date: Wed, 7 Dec 2022 23:31:23 +0900 Subject: [PATCH] From SW's laptop --- controller.py | 202 +++++++++++++------ settle_prediction_steps_main.py | 335 ++++++++++++++++---------------- 2 files changed, 308 insertions(+), 229 deletions(-) diff --git a/controller.py b/controller.py index 84c07db..6655b03 100644 --- a/controller.py +++ b/controller.py @@ -5,8 +5,10 @@ Sang Inn Woo, Ph.D. @ Incheon National University Starting Date: 2022-11-10 """ import psycopg2 as pg2 +import sys import numpy as np import settle_prediction_steps_main +import matplotlib.pyplot as plt ''' @@ -20,81 +22,159 @@ fill_height: height of surcharge fill nod: number of date ''' +def settlement_prediction(point_name): -# connect the database -connection = pg2.connect("host=localhost dbname=postgres user=postgres password=lab36981 port=5432") + # connect the database + connection = pg2.connect("host=localhost dbname=postgres user=postgres password=lab36981 port=5432") -# set cursor -cursor = connection.cursor() + # set cursor + cursor = connection.cursor() -# select all monitoring points -postgres_select_query = """SELECT * FROM apptb_surset01""" -cursor.execute(postgres_select_query) -point_record = cursor.fetchall() + # select monitoring data for the monitoring point + postgres_select_query = """SELECT * FROM apptb_surset02 WHERE cons_code='""" \ + + point_name + """' ORDER BY nod ASC""" + cursor.execute(postgres_select_query) + monitoring_record = cursor.fetchall() -# for a monitoring point, set name -point_name = point_record[0][3] + # initialize time, surcharge, and settlement lists + time = [] + surcharge = [] + settlement = [] -# select monitoring data for the monitoring point -postgres_select_query = """SELECT * FROM apptb_surset02 WHERE cons_code='""" \ - + point_name + """' ORDER BY nod ASC""" -cursor.execute(postgres_select_query) -monitoring_record = cursor.fetchall() + # fill lists + for row in monitoring_record: + settlement.append(float(row[6])) + surcharge.append(float(row[8])) + time.append(float(row[12])) -# initialize time, surcharge, and settlement lists -time = [] -surcharge = [] -settlement = [] + # convert lists to np arrays + settlement = np.array(settlement) + surcharge = np.array(surcharge) + time = np.array(time) -# fill list -for row in monitoring_record: - settlement.append(float(row[6])) - surcharge.append(float(row[8])) - time.append(float(row[12])) + # run the settlement prediction and get results + results = settle_prediction_steps_main.run_settle_prediction(point_name=point_name, + np_time=time, + np_surcharge=surcharge, + np_settlement=settlement, + final_step_predict_percent=90, + additional_predict_percent=300, + plot_show=False, + print_values=False, + run_original_hyperbolic=True, + run_nonlinear_hyperbolic=True, + run_weighted_nonlinear_hyperbolic=True, + run_asaoka=True, + run_step_prediction=True, + asaoka_interval=3) -# convert lists to np arrays -settlement = np.array(settlement) -surcharge = np.array(surcharge) -time = np.array(time) + # if there are prediction data for the given data point, delete it first + postgres_delete_query = """DELETE FROM apptb_pred02 WHERE cons_code='""" + point_name + """'""" + cursor.execute(postgres_delete_query) + connection.commit() -# run the settlement prediction and get results -results = settle_prediction_steps_main.run_settle_prediction(point_name=point_name, - np_time=time, - np_surcharge=surcharge, - np_settlement=settlement, - final_step_predict_percent=90, - additional_predict_percent=300, - plot_show=True, - print_values=True, - run_original_hyperbolic=True, - run_nonlinear_hyperbolic=True, - run_weighted_nonlinear_hyperbolic=True, - run_asaoka=True, - run_step_prediction=True, - asaoka_interval=3) + # insert predicted settlement into database + for i in range(5): -# if there are prediction data for the given data point, delete it first -postgres_delete_query = """DELETE FROM apptb_pred02 WHERE cons_code='""" + point_name + """'""" -cursor.execute(postgres_delete_query) -connection.commit() + # get time and settlement arrays + time = results[2 * i] + predicted_settlement = results[2 * i + 1] -time = results[0] -predicted_settlement = results[1] + # for each prediction time + for j in range(len(time)): -for i in range(5): + # construct insert query + postgres_insert_query \ + = """INSERT INTO apptb_pred02 (cons_code, prediction_progress_days, predicted_settlement, prediction_method) """\ + + """VALUES (%s, %s, %s, %s)""" - time = results[2 * i] - predicted_settlement = results[2 * i + 1] + # set data to insert + record_to_insert = (point_name, time[j], predicted_settlement[j], i) - for j in range(len(time)): + # execute the insert query + cursor.execute(postgres_insert_query, record_to_insert) - postgres_insert_query \ - = """INSERT INTO apptb_pred02 (cons_code, prediction_progress_days, predicted_settlement, prediction_method) """\ - + """VALUES (%s, %s, %s, %s)""" - - record_to_insert = (point_name, time[j], predicted_settlement[j], i) - cursor.execute(postgres_insert_query, record_to_insert) - -connection.commit() + # commit changes + connection.commit() + + +def read_database_and_plot(point_name): + + # connect the database + connection = pg2.connect("host=localhost dbname=postgres user=postgres password=lab36981 port=5432") + + # set cursor + cursor = connection.cursor() + + # select monitoring data for the monitoring point + postgres_select_query = """SELECT * FROM apptb_surset02 WHERE cons_code='""" \ + + point_name + """' ORDER BY nod ASC""" + cursor.execute(postgres_select_query) + monitoring_record = cursor.fetchall() + + # initialize time, surcharge, and settlement lists + time_monitored = [] + surcharge_monitored = [] + settlement_monitored = [] + + # fill lists + for row in monitoring_record: + settlement_monitored.append(float(row[6])) + surcharge_monitored.append(float(row[8])) + time_monitored.append(float(row[12])) + + # convert lists to np arrays + settlement_monitored = np.array(settlement_monitored) + surcharge_monitored = np.array(surcharge_monitored) + time_monitored = np.array(time_monitored) + + prediction_method = 0 + # select monitoring data for the monitoring point + postgres_select_query = """SELECT prediction_progress_days, predicted_settlement """ \ + + """FROM apptb_pred02 WHERE cons_code= '""" + point_name \ + + """' and prediction_method = """ + str(prediction_method) \ + + """ ORDER BY prediction_progress_days ASC""" + cursor.execute(postgres_select_query) + prediction_record = cursor.fetchall() + + # initialize time, surcharge, and settlement lists + time_predicted = [] + settlement_predicted = [] + + # fill lists + for row in prediction_record: + time_predicted.append(float(row[0])) + settlement_predicted.append(float(row[1])) + + # convert lists to np arrays + settlement_predicted = np.array(settlement_predicted) + time_predicted = np.array(time_predicted) + + # 그래프 크기, 서브 그래프 개수 및 비율 설정 + fig, axes = plt.subplots(2, 1, figsize=(12, 9), gridspec_kw={'height_ratios': [1, 3]}) + + # 성토고 그래프 표시 + axes[0].plot(time_monitored, surcharge_monitored, color='black', label='surcharge height') + + # 성토고 그래프 설정 + axes[0].set_ylabel("Surcharge height (m)", fontsize=15) + axes[0].set_xlim(left=0) + axes[0].grid(color="gray", alpha=.5, linestyle='--') + axes[0].tick_params(direction='in') + + # 계측 및 예측 침하량 표시 + axes[1].scatter(time_monitored, -settlement_monitored, s=50, + facecolors='white', edgecolors='black', label='measured data') + axes[1].plot(time_predicted, -settlement_predicted, + linestyle='--', color='red', label='Original Hyperbolic') + + + +# python3 controller.py 1_SP-5 +if __name__ == '__main__': + args = sys.argv[1:] + point_name = args[0] + #settlement_prediction(point_name=point_name) + read_database_and_plot(point_name=point_name) diff --git a/settle_prediction_steps_main.py b/settle_prediction_steps_main.py index 0c20328..b29c50a 100644 --- a/settle_prediction_steps_main.py +++ b/settle_prediction_steps_main.py @@ -570,183 +570,182 @@ def run_settle_prediction(point_name, print("Error in Final Settlement (Asaoka): %0.3f" % final_error_asaoka) - - - - # ========================================== # Post-Processing #2 : 그래프 작성 # ========================================== - # 그래프 크기, 서브 그래프 개수 및 비율 설정 - fig, axes = plt.subplots(2, 1, figsize=(12, 9), gridspec_kw={'height_ratios': [1, 3]}) - - # 성토고 그래프 표시 - axes[0].plot(time, surcharge, color='black', label='surcharge height') - - # 성토고 그래프 설정 - axes[0].set_ylabel("Surcharge height (m)", fontsize=15) - axes[0].set_xlim(left=0) - axes[0].grid(color="gray", alpha=.5, linestyle='--') - axes[0].tick_params(direction='in') - - # 계측 및 예측 침하량 표시 - axes[1].scatter(time[0:settle.size], -settle, s=50, - facecolors='white', edgecolors='black', label='measured data') - axes[1].plot(time_hyper, -sp_hyper_original, - linestyle='--', color='red', label='Original Hyperbolic') - axes[1].plot(time_hyper, -sp_hyper_nonlinear, - linestyle='--', color='green', label='Nonlinear Hyperbolic') - axes[1].plot(time_hyper, -sp_hyper_weight_nonlinear, - linestyle='--', color='blue', label='Nonlinear Hyperbolic (Weighted)') - axes[1].plot(time_asaoka, -sp_asaoka, - linestyle='--', color='orange', label='Asaoka') - axes[1].plot(time[step_start_index[0]:], -sp_step[step_start_index[0]:], - linestyle='--', color='navy', label='Nonlinear + Step Loading') - - # 침하량 그래프 설정 - axes[1].set_xlabel("Time (day)", fontsize=15) - axes[1].set_ylabel("Settlement (cm)", fontsize=15) - axes[1].set_ylim(top=0) - axes[1].set_ylim(bottom=-1.5 * settle.max()) - axes[1].set_xlim(left=0) - axes[1].grid(color="gray", alpha=.5, linestyle='--') - axes[1].tick_params(direction='in') - - # 범례 표시 - axes[1].legend(loc=1, ncol=3, frameon=True, fontsize=10) - - # 예측 데이터 사용 범위 음영 처리 - 단계성토 - plt.axvspan(time[step_start_index[0]], final_step_predict_end_date, - alpha=0.1, color='grey', hatch='//') - - # 예측 데이터 사용 범위 음영 처리 - 기존 및 비선형 쌍곡선 - plt.axvspan(final_step_start_date, final_step_predict_end_date, - alpha=0.1, color='grey', hatch='\\') - - # 예측 데이터 사용 범위 표시 화살표 세로 위치 설정 - arrow1_y_loc = 1.3 * min(-settle) - arrow2_y_loc = 1.4 * min(-settle) - - # 화살표 크기 설정 - arrow_head_width = 0.03 * max(settle) - arrow_head_length = 0.01 * max(time) - - # 예측 데이터 사용 범위 화살표 처리 - 단계성토 - axes[1].arrow(time[step_start_index[0]], arrow1_y_loc, - final_step_predict_end_date - time[step_start_index[0]], 0, - head_width=arrow_head_width, head_length=arrow_head_length, - color='black', length_includes_head='True') - axes[1].arrow(final_step_predict_end_date, arrow1_y_loc, - time[step_start_index[0]] - final_step_predict_end_date, 0, - head_width=arrow_head_width, head_length=arrow_head_length, - color='black', length_includes_head='True') - - # 예측 데이터 사용 범위 화살표 처리 - 기존 및 비선형 쌍곡선 - axes[1].arrow(final_step_start_date, arrow2_y_loc, - final_step_predict_end_date - final_step_start_date, 0, - head_width=arrow_head_width, head_length=arrow_head_length, - color='black', length_includes_head='True') - axes[1].arrow(final_step_predict_end_date, arrow2_y_loc, - final_step_start_date - final_step_predict_end_date, 0, - head_width=arrow_head_width, head_length=arrow_head_length, - color='black', length_includes_head='True') - - # Annotation 표시용 공간 설정 - space = max(time) * 0.01 - - # 예측 데이터 사용 범위 범례 표시 - 단계성토 - plt.annotate('Data Range Used (Nonlinear + Step Loading)', xy=(final_step_predict_end_date, arrow1_y_loc), - xytext=(final_step_predict_end_date + space, arrow1_y_loc), - horizontalalignment='left', verticalalignment='center') - - # 예측 데이터 사용 범위 범례 표시 - 기존 및 비선형 쌍곡선 - plt.annotate('Data Range Used (Hyperbolic and Asaoka)', xy=(final_step_predict_end_date, arrow1_y_loc), - xytext=(final_step_predict_end_date + space, arrow2_y_loc), - horizontalalignment='left', verticalalignment='center') - - # RMSE 산정 범위 표시 화살표 세로 위치 설정 - arrow3_y_loc = 0.55 * min(-settle) - - # RMSE 산정 범위 화살표 표시 - axes[1].arrow(final_step_predict_end_date, arrow3_y_loc, - final_step_end_date - final_step_predict_end_date, 0, - head_width=arrow_head_width, head_length=arrow_head_length, - color='black', length_includes_head='True') - axes[1].arrow(final_step_end_date, arrow3_y_loc, - final_step_predict_end_date - final_step_end_date, 0, - head_width=arrow_head_width, head_length=arrow_head_length, - color='black', length_includes_head='True') - - # RMSE 산정 범위 세로선 설정 - axes[1].axvline(x=final_step_end_date, color='silver', linestyle=':') - - # RMSE 산정 범위 범례 표시 - plt.annotate('RMSE Estimation Section', xy=(final_step_end_date, arrow3_y_loc), - xytext=(final_step_end_date + space, arrow3_y_loc), - horizontalalignment='left', verticalalignment='center') - - # RMSE 출력 - mybox = {'facecolor': 'white', 'edgecolor': 'black', 'boxstyle': 'round', 'alpha': 0.2} - plt.text(max(time) * 1.04, 0.20 * min(-settle), - r"$\bf{Root\ Mean\ Squared\ Error}$" - + "\n" + "Original Hyperbolic: %0.3f" % rmse_hyper_original - + "\n" + "Nonlinear Hyperbolic: %0.3f" % rmse_hyper_nonlinear - + "\n" + "Nonlinear Hyperbolic (Weighted): %0.3f" % rmse_hyper_weight_nonlinear - + "\n" + "Asaoka: %0.3f" % rmse_asaoka - + "\n" + "Nonlinear + Step Loading: %0.3f" % rmse_step, - color='r', horizontalalignment='right', - verticalalignment='top', fontsize='10', bbox=mybox) - - # (최종 계측 침하량 - 예측값) 출력 - plt.text(max(time) * 1.04, 0.55 * min(-settle), - r"$\bf{Error\ in\ Final\ Settlement}$" - + "\n" + "Original Hyperbolic: %0.3f" % final_error_hyper_original - + "\n" + "Nonlinear Hyperbolic: %0.3f" % final_error_hyper_nonlinear - + "\n" + "Nonlinear Hyperbolic (Weighted): %0.3f" % final_error_hyper_weight_nonlinear - + "\n" + "Asaoka: %0.3f" % final_error_asaoka - + "\n" + "Nonlinear + Step Loading: %0.3f" % final_error_step, - color='r', horizontalalignment='right', - verticalalignment='top', fontsize='10', bbox=mybox) - - # 파일 이름만 추출 - filename = os.path.basename(point_name) - - # 그래프 제목 표시 - plt.title(filename + ": up to %i%% data used in the final step" % final_step_predict_percent) - - # 그래프 저장 (SVG 및 PNG) - # plt.savefig(output_dir + '/' + filename +' %i percent (SVG).svg' %final_step_predict_percent, bbox_inches='tight') - #plt.savefig(output_dir + '/' + filename + ' %i percent (PNG).png' % final_step_predict_percent, bbox_inches='tight') - - # 그래프 출력 + # 만약 그래프 도시가 필요할 경우, if plot_show: - plt.show() - # 그래프 닫기 (메모리 소모 방지) - plt.close() + # 그래프 크기, 서브 그래프 개수 및 비율 설정 + fig, axes = plt.subplots(2, 1, figsize=(12, 9), gridspec_kw={'height_ratios': [1, 3]}) - # 예측 완료 표시 - print("Settlement prediction is done for " + filename + - " with " + str(final_step_predict_percent) + "% data usage") + # 성토고 그래프 표시 + axes[0].plot(time, surcharge, color='black', label='surcharge height') - # 단계 성토 고려 여부 표시 - is_multi_step = True - if len(step_start_index) == 1: - is_multi_step = False + # 성토고 그래프 설정 + axes[0].set_ylabel("Surcharge height (m)", fontsize=15) + axes[0].set_xlim(left=0) + axes[0].grid(color="gray", alpha=.5, linestyle='--') + axes[0].tick_params(direction='in') - # 반환 + # 계측 및 예측 침하량 표시 + axes[1].scatter(time[0:settle.size], -settle, s=50, + facecolors='white', edgecolors='black', label='measured data') + axes[1].plot(time_hyper, -sp_hyper_original, + linestyle='--', color='red', label='Original Hyperbolic') + axes[1].plot(time_hyper, -sp_hyper_nonlinear, + linestyle='--', color='green', label='Nonlinear Hyperbolic') + axes[1].plot(time_hyper, -sp_hyper_weight_nonlinear, + linestyle='--', color='blue', label='Nonlinear Hyperbolic (Weighted)') + axes[1].plot(time_asaoka, -sp_asaoka, + linestyle='--', color='orange', label='Asaoka') + axes[1].plot(time[step_start_index[0]:], -sp_step[step_start_index[0]:], + linestyle='--', color='navy', label='Nonlinear + Step Loading') - axes[1].plot(time_hyper, -sp_hyper_original, - linestyle='--', color='red', label='Original Hyperbolic') - axes[1].plot(time_hyper, -sp_hyper_nonlinear, - linestyle='--', color='green', label='Nonlinear Hyperbolic') - axes[1].plot(time_hyper, -sp_hyper_weight_nonlinear, - linestyle='--', color='blue', label='Nonlinear Hyperbolic (Weighted)') - axes[1].plot(time_asaoka, -sp_asaoka, - linestyle='--', color='orange', label='Asaoka') - axes[1].plot(time[step_start_index[0]:], -sp_step[step_start_index[0]:], - linestyle='--', color='navy', label='Nonlinear + Step Loading') + # 침하량 그래프 설정 + axes[1].set_xlabel("Time (day)", fontsize=15) + axes[1].set_ylabel("Settlement (cm)", fontsize=15) + axes[1].set_ylim(top=0) + axes[1].set_ylim(bottom=-1.5 * settle.max()) + axes[1].set_xlim(left=0) + axes[1].grid(color="gray", alpha=.5, linestyle='--') + axes[1].tick_params(direction='in') + + # 범례 표시 + axes[1].legend(loc=1, ncol=3, frameon=True, fontsize=10) + + # 예측 데이터 사용 범위 음영 처리 - 단계성토 + plt.axvspan(time[step_start_index[0]], final_step_predict_end_date, + alpha=0.1, color='grey', hatch='//') + + # 예측 데이터 사용 범위 음영 처리 - 기존 및 비선형 쌍곡선 + plt.axvspan(final_step_start_date, final_step_predict_end_date, + alpha=0.1, color='grey', hatch='\\') + + # 예측 데이터 사용 범위 표시 화살표 세로 위치 설정 + arrow1_y_loc = 1.3 * min(-settle) + arrow2_y_loc = 1.4 * min(-settle) + + # 화살표 크기 설정 + arrow_head_width = 0.03 * max(settle) + arrow_head_length = 0.01 * max(time) + + # 예측 데이터 사용 범위 화살표 처리 - 단계성토 + axes[1].arrow(time[step_start_index[0]], arrow1_y_loc, + final_step_predict_end_date - time[step_start_index[0]], 0, + head_width=arrow_head_width, head_length=arrow_head_length, + color='black', length_includes_head='True') + axes[1].arrow(final_step_predict_end_date, arrow1_y_loc, + time[step_start_index[0]] - final_step_predict_end_date, 0, + head_width=arrow_head_width, head_length=arrow_head_length, + color='black', length_includes_head='True') + + # 예측 데이터 사용 범위 화살표 처리 - 기존 및 비선형 쌍곡선 + axes[1].arrow(final_step_start_date, arrow2_y_loc, + final_step_predict_end_date - final_step_start_date, 0, + head_width=arrow_head_width, head_length=arrow_head_length, + color='black', length_includes_head='True') + axes[1].arrow(final_step_predict_end_date, arrow2_y_loc, + final_step_start_date - final_step_predict_end_date, 0, + head_width=arrow_head_width, head_length=arrow_head_length, + color='black', length_includes_head='True') + + # Annotation 표시용 공간 설정 + space = max(time) * 0.01 + + # 예측 데이터 사용 범위 범례 표시 - 단계성토 + plt.annotate('Data Range Used (Nonlinear + Step Loading)', xy=(final_step_predict_end_date, arrow1_y_loc), + xytext=(final_step_predict_end_date + space, arrow1_y_loc), + horizontalalignment='left', verticalalignment='center') + + # 예측 데이터 사용 범위 범례 표시 - 기존 및 비선형 쌍곡선 + plt.annotate('Data Range Used (Hyperbolic and Asaoka)', xy=(final_step_predict_end_date, arrow1_y_loc), + xytext=(final_step_predict_end_date + space, arrow2_y_loc), + horizontalalignment='left', verticalalignment='center') + + # RMSE 산정 범위 표시 화살표 세로 위치 설정 + arrow3_y_loc = 0.55 * min(-settle) + + # RMSE 산정 범위 화살표 표시 + axes[1].arrow(final_step_predict_end_date, arrow3_y_loc, + final_step_end_date - final_step_predict_end_date, 0, + head_width=arrow_head_width, head_length=arrow_head_length, + color='black', length_includes_head='True') + axes[1].arrow(final_step_end_date, arrow3_y_loc, + final_step_predict_end_date - final_step_end_date, 0, + head_width=arrow_head_width, head_length=arrow_head_length, + color='black', length_includes_head='True') + + # RMSE 산정 범위 세로선 설정 + axes[1].axvline(x=final_step_end_date, color='silver', linestyle=':') + + # RMSE 산정 범위 범례 표시 + plt.annotate('RMSE Estimation Section', xy=(final_step_end_date, arrow3_y_loc), + xytext=(final_step_end_date + space, arrow3_y_loc), + horizontalalignment='left', verticalalignment='center') + + # RMSE 출력 + mybox = {'facecolor': 'white', 'edgecolor': 'black', 'boxstyle': 'round', 'alpha': 0.2} + plt.text(max(time) * 1.04, 0.20 * min(-settle), + r"$\bf{Root\ Mean\ Squared\ Error}$" + + "\n" + "Original Hyperbolic: %0.3f" % rmse_hyper_original + + "\n" + "Nonlinear Hyperbolic: %0.3f" % rmse_hyper_nonlinear + + "\n" + "Nonlinear Hyperbolic (Weighted): %0.3f" % rmse_hyper_weight_nonlinear + + "\n" + "Asaoka: %0.3f" % rmse_asaoka + + "\n" + "Nonlinear + Step Loading: %0.3f" % rmse_step, + color='r', horizontalalignment='right', + verticalalignment='top', fontsize='10', bbox=mybox) + + # (최종 계측 침하량 - 예측값) 출력 + plt.text(max(time) * 1.04, 0.55 * min(-settle), + r"$\bf{Error\ in\ Final\ Settlement}$" + + "\n" + "Original Hyperbolic: %0.3f" % final_error_hyper_original + + "\n" + "Nonlinear Hyperbolic: %0.3f" % final_error_hyper_nonlinear + + "\n" + "Nonlinear Hyperbolic (Weighted): %0.3f" % final_error_hyper_weight_nonlinear + + "\n" + "Asaoka: %0.3f" % final_error_asaoka + + "\n" + "Nonlinear + Step Loading: %0.3f" % final_error_step, + color='r', horizontalalignment='right', + verticalalignment='top', fontsize='10', bbox=mybox) + + # 파일 이름만 추출 + filename = os.path.basename(point_name) + + # 그래프 제목 표시 + plt.title(filename + ": up to %i%% data used in the final step" % final_step_predict_percent) + + # 그래프 저장 (SVG 및 PNG) + # plt.savefig(output_dir + '/' + filename +' %i percent (SVG).svg' %final_step_predict_percent, bbox_inches='tight') + #plt.savefig(output_dir + '/' + filename + ' %i percent (PNG).png' % final_step_predict_percent, bbox_inches='tight') + + # 그래프 출력 + if plot_show: + plt.show() + + # 그래프 닫기 (메모리 소모 방지) + plt.close() + + # 예측 완료 표시 + print("Settlement prediction is done for " + filename + + " with " + str(final_step_predict_percent) + "% data usage") + + # 단계 성토 고려 여부 표시 + is_multi_step = True + if len(step_start_index) == 1: + is_multi_step = False + + # 반환 + + axes[1].plot(time_hyper, -sp_hyper_original, + linestyle='--', color='red', label='Original Hyperbolic') + axes[1].plot(time_hyper, -sp_hyper_nonlinear, + linestyle='--', color='green', label='Nonlinear Hyperbolic') + axes[1].plot(time_hyper, -sp_hyper_weight_nonlinear, + linestyle='--', color='blue', label='Nonlinear Hyperbolic (Weighted)') + axes[1].plot(time_asaoka, -sp_asaoka, + linestyle='--', color='orange', label='Asaoka') + axes[1].plot(time[step_start_index[0]:], -sp_step[step_start_index[0]:], + linestyle='--', color='navy', label='Nonlinear + Step Loading') return [time_hyper, sp_hyper_original, time_hyper, sp_hyper_nonlinear, @@ -756,7 +755,7 @@ def run_settle_prediction(point_name, rmse_hyper_original, rmse_hyper_nonlinear, rmse_hyper_weight_nonlinear, rmse_asaoka, rmse_step, final_error_hyper_original, final_error_hyper_nonlinear, final_error_hyper_weight_nonlinear, - final_error_asaoka, final_error_step, is_multi_step] + final_error_asaoka, final_error_step] ''' run_settle_prediction(input_file='data/2-5_No.39.csv',