def MolecularToolsMainMenu(DataUser): """ Menu and Prompt screens for menu driven user interface Main Menu String Current Options: A - Update Status: provides user with what the number of compounds in a group that have been completed for a particular level of theory and basis set combination. B - Compare Methods: allows user to compare various computed properties such as energy and coordinates for different methods - Query Data: pulls data from database for later use. C - Model Data: uses machine learning to construct a data model using neural networks. D - Test Query: Test connection to database. U - Update Data: Allows users with the priviledge to create or insert data the option to do so. """ import MenuTools MMName = 'MAIN MENU' MMOptions = [['A', 'Update Status'], ['B', 'Compare Methods'], ['C', 'Model Molecular Data'], ['D', 'Model Health Data'], ['Q', 'Quit']] if DataUser.Update: MMOptions.append(['U', 'Update Molecule Database']) MMOptions.append(['V', 'Update Health Database']) MMString = MenuTools.CreateMenu(MMName, MMOptions) # User prompt string connected to Main Menu PromptString = 'Please select an option from Main Menu: ' # Control code for Main Menu Option = '' while (Option != 'Q') and (Option != 'q'): # Output menu and prompt print(MMString) Option = input(PromptString) # Option A: Update status if Option == 'A': UpdateStatus.UpdateStatus(DataUser) elif Option == 'B': CompareMethods.CompareMethods(DataUser) elif Option == 'C': MolecularModelData.ModelData(DataUser) elif Option == 'D': HealthModelData.ModelData(DataUser) elif (Option == 'Q') or (Option == 'q'): print('Exiting Data Tools') elif (Option == 'U') and DataUser.Update: MolecularDatabase.UpdateMenu(DataUser) elif (Option == 'V') and DataUser.Update: HealthDatabase.UpdateMenu(DataUser) # if the user does not select a valid option, a warning is # printed and the menu and command prompt is reprinted. else: print('Input not recognized.')
def compare_prerecorded_files(): print("Compare pre-recorded tests") for file in DataUtility.TEST_FILE_LIST: print("#####################################################################################") print("File: " + file.filename) data_handler = DataHandlers.FileDataHandler(file) recognized_gesture = CompareMethods.cross_correlation_comparison(data_handler) print("Gesture: " + Gesture.gesture_to_string(file.gesture)) print("Regcognized Gesture: " + Gesture.gesture_to_string(recognized_gesture)) print("\n\n\n")
def writePlayerInfo(): #create csv file with prefixed header tags out = open(playerprofilepath,'a') tags = 'Player,From,To,Pos,Ht,Wt,DOB,College\n' out.write(tags) out.close() print("starting to get all players information...") urls = CompareMethods.getPlayersIndexUrls(True) for url in urls: href = mainurl + url PlayerInfo.getPlayerInfo(True, href, playerprofilepath) print ('Player Info All Done!') return;
def writePlayerInfo(): #create csv file with prefixed header tags out = open(playerprofilepath,'a') tags = 'Player,From,To,Pos,Ht,Wt,DOB,College\n' out.write(tags) out.close() print("starting to get all players information...") urls = CompareMethods.getPlayersIndexUrls(True) for url in urls: href = mainurl + url #active players #PlayerInfo.getPlayerInfo(True, href, activeplayerprofilepath) #players since 2000 PlayerInfo.getPlayerInfoSinceYear(href,playerprofilepath,year) print ('Player Info All Done!') return;
def writePlayerStats(): out = open(playerstatspath,'a') tags = 'Name,Season,Age,Tm,Lg,Pos,G,GS,MP,FG,FGA,FG%,3P,3PA,3P%,2P,2PA,2P%,eFG%,FT,FTA,FT%,ORB,DRB,TRB,AST,STL,BLK,TOV,PF,PTS\n'; out.write(tags) out.close() print("starting to get all players stats...") infile=csv.reader(open(playerurlspath,'rb'), delimiter=',') urls = [] if infile: infile.next() for row in infile: urls.extend(row) for url in urls: href = mainurl + url PlayerStats.getPlayerStats(href, playerstatspath) else: urls = CompareMethods.getPlayerUrls(True) for url in urls: href = mainurl + url PlayerStats.getPlayerStats(href, playerstatspath) print ('Stats All Done!') return;
def writePlayerSalary(): salaryout = open(playersalarypath,'a') salarytags = 'Name,Season,Team,Lg,Salary\n'; salaryout.write(salarytags) salaryout.close() print("starting to get all players salary...") infile=csv.reader(open(playerurlspath,'rb'), delimiter=',') urls = [] if infile: infile.next() for row in infile: urls.extend(row) for url in urls: href = mainurl + url PlayerSalary.getPlayerSalary(href, playersalarypath) else: urls = CompareMethods.getPlayerUrls(True) for url in urls: href = mainurl + url PlayerSalary.getPlayerSalary(href, playersalarypath) print ('Salary All Done!') return;