63 lines
2.3 KiB
Python
63 lines
2.3 KiB
Python
import sys
|
|
from py.arguments import Arguments
|
|
from py.modell import *
|
|
|
|
if not sys.argv[1:]:
|
|
print("Usage: python3 main.py <path to csv>")
|
|
sys.exit(1)
|
|
|
|
def main():
|
|
|
|
repeat = True
|
|
args = Arguments(sys.argv[1], "v", False, False)
|
|
args.set_mode("v")
|
|
args.set_information(False)
|
|
args.set_graph(False)
|
|
|
|
while repeat:
|
|
print("Currently selected setting:")
|
|
print(f"File: {args.get_file_path()}")
|
|
print(f"Mode: {args.get_mode()}")
|
|
print(f"Display information: {args.get_information()}")
|
|
print(f"Display graphs: {args.get_graph()}")
|
|
|
|
prompt = input("Change settings [y / exit / blank]: ")
|
|
|
|
if prompt == "y":
|
|
try:
|
|
args.set_file_path(input("Change file <path to file>: "))
|
|
args.set_mode(input("Change mode [v, a, c]: "))
|
|
args.set_information(eval(input("Display information [True / False]: ")))
|
|
args.set_graph(eval(input("Display graphs [True / False]: ")))
|
|
except ValueError as error:
|
|
print(f"Value {error}")
|
|
elif prompt == "exit":
|
|
quit()
|
|
|
|
# use verctor length of (x,y) as feature
|
|
if args.get_mode() == "v":
|
|
load_dataframe = make_dataframe(lambda df: df)
|
|
features = make_features(radius)
|
|
score = make_score_function(lambda x, y: [np.sqrt(x**2 + y**2)])
|
|
# use absoult values of (x,y) as feature
|
|
elif args.get_mode() == "a":
|
|
load_dataframe = make_dataframe(lambda df: df.abs())
|
|
features = make_features(xy)
|
|
score = make_score_function(lambda x, y: [x, y])
|
|
# use unaltered values of (x,y) as feature
|
|
elif args.get_mode() == "c":
|
|
load_dataframe = make_dataframe(lambda df: df)
|
|
features = make_features(xy)
|
|
score = make_score_function(lambda x, y: [x, y])
|
|
# default use vector length
|
|
else:
|
|
load_dataframe = make_dataframe(lambda df: df)
|
|
features = make_features(radius)
|
|
score = make_score_function(lambda x, y: [np.sqrt(x**2 + y**2)])
|
|
|
|
print("\n")
|
|
|
|
apply_model(load_dataframe(args.get_file_path()), features, score, args.get_information(), args.get_graph())
|
|
|
|
if __name__ == "__main__":
|
|
main() |