def transform_prompt(assigned_axes, plottype): choice = 0 while choice >= 0: # Prompt user to choose an axis to apply a formula to choice = get_axis_to_transform() # -1 means exit if choice < 0: break # Get the formula formula = get_formula() # Get the transformed data transformed_data = transform_data(formula, choice, assigned_axes) # Plot the new data handle_plot_choice(plottype, transformed_data) # Ask the user for the export type export_type = show_export_prompt(transformed = True) # Export data in plot if export_type == 1: fileutils.export_plot_data(transformed_data) # Export data in plot + the original axis elif export_type == 2: fileutils.export_plot_data_with_original_axis(assigned_axes[choice], transformed_data) else: continue
def main(): while True: # Ask for filepath filepath = input("Enter the path to the file you want to analyze.") # Parse specified file try: axes_dictionary = fileutils.load_csv(filepath) # If file does not exist, jump back to specifying filepath again except IOError: print("File not found, please enter the correct path to your file, using forward slashes instead of backslashes.") continue # Prompt the user to specify a plot type plottype = get_plot_type() # Let the user choose a data type for the x-, y- and z-axis assigned_axes = assign_axes(axes_dictionary) # Make the plot handle_plot_choice(plottype, assigned_axes) export_type = show_export_prompt(transformed = False) if export_type == 1: fileutils.export_plot_data(assigned_axes) else: return # Ask the user if he wants to apply a formula to one of the axes transform_prompt(assigned_axes, plottype) # Make sure we exit after plotting break