示例#1
0
menuOptions = np.array(
    ['Load Data', 'Display statistics', 'Generate plots', 'Quit'])
statisticsOptions = np.array(
    ['Mean', 'Variance', 'Standard deviation', 'Cross Correlation'])
plotOptions = np.array(['Contour', 'Surface'])
pd.options.display.float_format = '{:.2E}'.format
data = []

# An infinite loop runs until the User chooses to Quit the program,
# in which case the loop Breaks.
while True:
    # Start of program
    # The menu appears and asks the user to select an option
    print('\n------------Main menu------------\n')

    selection = displayMenu(menuOptions)

    if selection == 1:  # Load wind data

        while True:
            filename = input(
                'Please enter a correct filename for the data turbine_32x32x8192.bin\n or press "q" to escape: '
            )
            if filename == 'q':
                break
            elif not os.path.exists(filename):  # turbine_32x32x8192.bin
                print('\nInvalid filename')
            else:
                ranges = ['Nx', 'Ny', 'Nz']
                for i, val in enumerate(ranges):
                    ranges[i] = get_int_in_range(
示例#2
0
from dataPlot import *

# Menus options
optionsMain = ('Load data.', 'Filter data.', 'Display statistics.',
               'Generate plots.', 'Quit.')
optionsStat = ('Mean Temperature', 'Mean Growth Rate', 'Std Temperature',
               'Std Growth rate', 'Rows', 'Mean Cold Growth Rate',
               'Mean Hot Growth Rate', 'Back to Main Menu')
optionsFilter = ('Temperature range', 'Growth rate range', 'Bacteria species',
                 'Reset all filters', 'Back to Main Menu')
data = np.array([])
f_params = [None, None, None]
f_data = np.array([])

while True:
    sel = displayMenu(optionsMain)

    if sel == 1:
        # Load data
        fileIn = getFilename()
        data = dataLoad(fileIn)
        # Reset filter and filter data
        f_params = [None, None, None]
        f_data = filterData.filterData(data, f_params)
    elif sel == 2:
        # Filter data
        choice = displayMenu(optionsFilter, prompt='Please choose a filter: ')
        if choice == 4:
            f_params = [None, None, None]
        # Back to menu
        elif choice == 5:
from dataLoad import dataLoad
from dataStatistics import dataStatistics
from dataPlot import dataPlot
from bDetection import bDetection
from grateDetection import grateDetection

# Main menu greeting
print("Welcome to the program for bacteria analysis.")
print("Below you can see the Main Menu.")
while True:
    print("\n")
    main_Menu = np.array([
        "Load data", "Filter data", "Display statistics", "Generate plots",
        "Quit"
    ])
    main_choice = displayMenu(main_Menu)

    # 1. Load data.
    if main_choice == 1:
        while True:
            try:
                filename = input("Please enter filename: ")
                print("\n")
                e_freedata = dataLoad(filename.lower())
                data = e_freedata
                break
            except IOError:
                print("IOError: file not found in path.")
                print("Please check filename is correct.")
                print("TIP: Don't forget to add '.txt' at the end.")
                pass
示例#4
0
from LoadData import LoadData
from gradesPlot1 import gradesPlot1
from gradesPlot2 import gradesPlot2
from FinalGradeFunction import computeFinalGrades

# Define menu items
menuItems = np.array([
    "Load data", "Error Handling", "Generate plots", "Display list of grades",
    "Quit"
])
# Define all unfiltered data as an array
grades = np.array([])
# Start
while True:
    # Display menu options and ask user to choose a menu item
    choice = m.displayMenu(menuItems)
    # ------------------------------------------------------------------
    #Made by Suzan
    # 1. Load data
    if choice == 1:

        while True:
            try:
                filename = input("Please input the filename: ")
                # Asking the user for an input
                grades = LoadData(filename)
                # Loading data if filename is correct
                print("Data succesfully loaded")
                break
            except OSError:
                # Printing error message if file is not in the folder
示例#5
0
from displayMenu import displayMenu
from dataStatistics import dataStatistics
from plottingFunction import dataPlot
from plotFunction2 import dataPlot2
from filter import dataFilter, filterArray

menuItems = np.array(["Load Data", "Filter data", "Display statistics", "Generate plots", "Quit"])
filter = np.array([0, -1, -1])
isDataLoaded = False
isRunning = True
data = np.array([])
filtered = np.array([])

while isRunning:

    choice = displayMenu(menuItems)

    # ------------------------------------------------------------------
    if choice == 1:
        data = dataLoad(input("Please enter the name of the file: "))
        filtered = data.copy()
        isDataLoaded = True
    # ------------------------------------------------------------------
    elif choice == 2:
        filter = dataFilter()
        filtered = filterArray(data, filtered, filter)
    # ------------------------------------------------------------------
    elif choice == 3:
        if isDataLoaded:
            print(dataStatistics(filtered, input("Please enter the name of the statistic you would like to calculate:")))
        else:
    'Forbrug pr. minut (ingen aggregering)', 'Forbrug pr. time',
    'Forbrug pr. dag', 'Forbrug pr. måned',
    'Forbrug efter tid på dagen (timegennemsnit)'
])
menuItems4 = np.array(["zone1", "zone2", "zone3", "zone4", "all", "combined"])
print('Welcome to our script')
tekst = False

#
while True:
    print('\n')
    if tekst == False:
        print('No data has been read')
        print('\n')

    choice = displayMenu(menuItems)
    #Hvis man skriver 1 skal man indlæse data, filen skal ligge i program mappe
    if choice == 1:
        while True:
            try:
                fileName = input("Hvilken fil skal indlæses?: ")
                pd.read_csv(fileName)
                while True:
                    try:
                        print("which fmode is wanted?:")
                        choice = displayMenu(menuItems2)

                        if choice == 1:
                            fmode = "drop"

                        elif choice == 2: