Skip to content

Commit decf4be

Browse files
committed
Cleanup auto data selection
1 parent 61602f2 commit decf4be

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

Tools/parametric_model/generate_parametric_model.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,39 +77,35 @@ def start_model_estimation(config, log_path, data_selection="none", plot=False):
7777
"directory and models/__init__.py?".format(model_class)
7878
raise AttributeError(error_str)
7979

80-
visual_dataframe_selector_config_dict = {
81-
"x_axis_col": "timestamp",
82-
"sub_plt1_data": ["q0", "q1", "q2", "q3"],
83-
"sub_plt2_data": ["u0", "u1", "u2", "u3"],
84-
"sub_plt3_data": []
85-
}
86-
87-
if data_handler.estimate_forces == True:
88-
visual_dataframe_selector_config_dict["sub_plt3_data"].append("fisher_information_force")
89-
90-
if data_handler.estimate_moments == True:
91-
visual_dataframe_selector_config_dict["sub_plt3_data"].append("fisher_information_rot")
92-
9380
model.load_dataframes(data_df)
9481
model.prepare_regression_matrices()
9582
model.compute_fisher_information()
9683

9784
# Interactive data selection
9885
if data_selection=="interactive":
9986
from visual_dataframe_selector.data_selector import select_visual_data
100-
model.data_df = select_visual_data(model.data_df,visual_dataframe_selector_config_dict)
101-
model.n_samples = model.data_df.shape[0]
102-
# Automatic data selection (WIP)
103-
elif data_selection=="auto":
87+
visual_dataframe_selector_config_dict = {
88+
"x_axis_col": "timestamp",
89+
"sub_plt1_data": ["q0", "q1", "q2", "q3"],
90+
"sub_plt2_data": ["u0", "u1", "u2", "u3"],
91+
"sub_plt3_data": []
92+
}
93+
94+
if data_handler.estimate_forces == True:
95+
visual_dataframe_selector_config_dict["sub_plt3_data"].append("fisher_information_force")
96+
97+
if data_handler.estimate_moments == True:
98+
visual_dataframe_selector_config_dict["sub_plt3_data"].append("fisher_information_rot")
99+
100+
model.load_dataframes(select_visual_data(model.data_df,visual_dataframe_selector_config_dict))
101+
elif data_selection=="auto": # Automatic data selection (WIP)
104102
from active_dataframe_selector.data_selector import ActiveDataSelector
105103
# The goal is to identify automatically the most relevant parts of a log.
106104
# Currently the draft is designed to choose the most informative 10% of the logs with regards to
107105
# force and moment parameters. This threshold is currently not validated at all and the percentage
108106
# can vary drastically from log to log.
109-
110107
data_selector = ActiveDataSelector(model.data_df)
111-
model.data_df = data_selector.select_dataframes(10)
112-
model.n_samples = model.data_df.shape[0]
108+
model.load_dataframes(data_selector.select_dataframes(10))
113109

114110
model.estimate_model()
115111

0 commit comments

Comments
 (0)