File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -1173,6 +1173,33 @@ def print_data_tabular(
1173
1173
1174
1174
display_or_print_df (filtered_column_df , file )
1175
1175
1176
+
1177
+ def save_data_to_tsv (
1178
+ self ,
1179
+ file : IO [str ],
1180
+ ) -> None :
1181
+ """
1182
+ Stores the underlying EventBlocks in tsv format to facilitate copy-paste into spreadsheets.
1183
+
1184
+ Args:
1185
+ file: Which IO stream to print to. Do not use stdout, as tab separator is not preserved.
1186
+
1187
+ Returns:
1188
+ None
1189
+ """
1190
+ combined_df = self .to_dataframe ()
1191
+
1192
+ # Filter out some columns and rows for better readability when printing
1193
+ filtered_column_df = combined_df .drop (columns = EXCLUDED_COLUMNS_WHEN_PRINTING )
1194
+ for filter_name in EXCLUDED_EVENTS_WHEN_PRINTING :
1195
+ filtered_column_df = filtered_column_df [
1196
+ ~ filtered_column_df ["event_name" ].str .contains (filter_name )
1197
+ ]
1198
+ filtered_column_df .reset_index (drop = True , inplace = True )
1199
+
1200
+ filtered_column_df .to_csv (file , sep = "\t " )
1201
+
1202
+
1176
1203
# TODO: write unit test
1177
1204
def find_total_for_module (self , module_name : str ) -> float :
1178
1205
"""
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ def main() -> None:
43
43
required = False ,
44
44
help = "Provide an optional buffer file path." ,
45
45
)
46
+ parser .add_argument (
47
+ "--tsv_path" ,
48
+ required = False ,
49
+ help = "Provide an optional tsv file path." ,
50
+ )
46
51
parser .add_argument ("--compare_results" , action = "store_true" )
47
52
48
53
args = parser .parse_args ()
@@ -55,6 +60,8 @@ def main() -> None:
55
60
target_time_scale = TimeScale (args .target_time_scale ),
56
61
)
57
62
inspector .print_data_tabular ()
63
+ if args .tsv_path :
64
+ inspector .save_data_to_tsv (args .tsv_path )
58
65
if args .compare_results :
59
66
for event_block in inspector .event_blocks :
60
67
if event_block .name == "Execute" :
You can’t perform that action at this time.
0 commit comments