Example #1
0
def axiom_achievers(axiom_instances, state):

    axioms_from_pre = defaultdict(list)
    for ax in axiom_instances:
        for p in ax.preconditions:
            assert isinstance(p, Atom)
            axioms_from_pre[p].append(ax)

    axiom_from_eff = {}
    queue = deque()
    for head, val in state.items():
        if not isinstance(head.function, Predicate) or (val != True):
            continue
        eval = initialize(head, val)
        if isinstance(eval, Atom) and (eval not in axiom_from_eff):
            axiom_from_eff[eval] = None
            queue.append(eval)
    while queue:
        pre = queue.popleft()
        for ax in axioms_from_pre[pre]:
            if (ax.effect not in axiom_from_eff) and all(
                    p in axiom_from_eff for p in ax.preconditions):

                axiom_from_eff[ax.effect] = ax
                queue.append(ax.effect)
    return axiom_from_eff
    def test_start_up(self):
        """
        Testing game startup by checking if the username has be sucessfully entered and 
        the game has been started
        """
        username = "******"
        question_list = functions.initialize(username)

        self.assertEqual(question_list['username'], username)
Example #3
0
def evals_from_state(state):
    return {initialize(*item) for item in state.items()}
Example #4
0
#03/10/17 - Tim - Added integration with functions.py. Now can read temp., pressure, Volt, and Curr
#03/13/17 - Tim - Plots pressure and creates text files. Added headers to Volt and Press
#05/11/17 - Tim - Changed plots to reflect new temp sensors, fixed print to file for temps, set alarm to 0

#TO DO

RX202_lookup = np.loadtxt(
    'RX-202A Mean Curve.tbl')  #202 ADR sensor look up table
#RX202_lookup = np.loadtxt('RX-102A Mean Curve.tbl') #102 300mK/ 1K sensors
RX202_interp = interpolate.interp1d(
    RX202_lookup[:, 1], RX202_lookup[:, 0], fill_value=0., bounds_error=False
)  # interpolates the temperature when in between lookup table values
#test = np.float(RX202_interp(4000))
#RX202_temps = RX202_interp(-linear_bridge*1000)

lines, colors, labels, plots = initialize()

# turn on alarm on for certain values
#                     4K P.T--4K HTS--50K HTS--Black Body--50K P.T.--50K Plate--ADR Shield--4He Pump--3He Pump--4He Switch--3 He Switch--300 mK Shield--ADK Switch--4-1K Switch--1K Shield--3He Head--4He Head--ADR--
Alarm_on = np.array((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
Alarm_value = np.array((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))

sleep_interval = 10.  #seconds change back
Alarm = 0  # 0 for off 1 for on

now = datetime.datetime.now()
date_str = str(now)[0:10]
# we want the file prefix to reflect the date in which the temperature data is taken
file_prefix = "C:/Users/tycho/Desktop/White_Cryo_Code/Temps/" + date_str
file_suffix = ''
file_prefix2 = "C:/Users/tycho/Desktop/White_Cryo_Code/Voltage_Current/" + date_str
Example #5
0
def CAS_simulation(input_initial_values_file):
    # set simulation parameters
    functions.set_parameters()

    # create python objects for walkers and balls
    if gv.enhanced_sampling_flag == 2:
        walker_list = [None] * (gv.num_balls_limit * gv.num_walkers_for_sc * 2)
        temp_walker_list = [None] * (gv.num_balls_limit *
                                     gv.num_walkers_for_sc * 2)
    else:
        walker_list = [None] * (gv.num_balls_limit * gv.num_walkers * 2)
        temp_walker_list = [None] * (gv.num_balls_limit * gv.num_walkers * 2)
    vacant_walker_indices = []
    balls = np.zeros(
        (1, gv.num_cvs +
         3))  # ball coordinates / ball radius / ball key / # of walkers
    ball_to_walkers = {}
    key_to_ball = {}
    ball_clusters_list = {}

    # create walkers and their directories
    functions.initialize(input_initial_values_file, walker_list)

    for step_num in range(gv.max_num_steps):
        # reset ball objects so that balls are newly created at every step
        if gv.balls_flag == 0:
            balls = np.zeros((1, gv.num_cvs + 3))
            ball_to_walkers = {}
            key_to_ball = {}
            ball_clusters_list = {}
            gv.current_num_balls = 0

        print 'running   ' + str(step_num + 1) + '-th step'

        # first, run simulation
        t0 = time()
        functions.m_simulation(walker_list)

        # second, create balls and assign walkers to balls
        t1 = time()
        if gv.enhanced_sampling_flag == 1:
            new_balls = functions.threshold_binning(step_num, walker_list,
                                                    temp_walker_list, balls,
                                                    ball_to_walkers,
                                                    key_to_ball)
        else:
            new_balls = functions.binning(step_num, walker_list,
                                          temp_walker_list, balls,
                                          ball_to_walkers, key_to_ball)

        # third, perform spectral clustering if enhanced_sampling_flag = 2
        if gv.enhanced_sampling_flag == 2 and gv.num_balls_for_sc <= gv.num_occupied_balls and gv.sc_performed == 0:
            functions.spectral_clustering(step_num, temp_walker_list,
                                          new_balls, ball_clusters_list)
            # fourth, resample walkers for every ball
            if gv.sc_performed == 1:
                functions.resampling_for_sc(walker_list, temp_walker_list,
                                            new_balls, ball_to_walkers,
                                            ball_clusters_list,
                                            vacant_walker_indices)
            else:
                functions.resampling(walker_list, temp_walker_list, new_balls,
                                     ball_to_walkers, vacant_walker_indices)
        else:
            functions.resampling(walker_list, temp_walker_list, new_balls,
                                 ball_to_walkers, vacant_walker_indices)

        # finally, output the results in text files
        functions.print_status(step_num, walker_list, new_balls,
                               ball_to_walkers, ball_clusters_list,
                               key_to_ball)
        balls = new_balls
        t2 = time()

        os.chdir(gv.main_directory + '/CAS')
        f = open('time_record.txt', 'a')
        f.write(
            str(step_num + 1) + '-th step: ' + 'simulation time: ' +
            str(t1 - t0) + ' ' + 'post-processing time: ' + str(t2 - t1) +
            '\n')
        f.close()
Example #6
0
def CAS_simulation(input_initial_values_file):
    # set simulation parameters
    functions.set_parameters()

    # create python objects for walkers and balls
    if gv.enhanced_sampling_flag == 2:
        walker_list = [None]*(gv.num_balls_limit*gv.num_walkers_for_sc*2)
        temp_walker_list = [None]*(gv.num_balls_limit*gv.num_walkers_for_sc*2)
    else:
        walker_list = [None]*(gv.num_balls_limit*gv.num_walkers*2)
        temp_walker_list = [None]*(gv.num_balls_limit*gv.num_walkers*2)
    vacant_walker_indices = []
    balls = np.zeros((1, gv.num_cvs+3))  # ball coordinates / ball radius / ball key / # of walkers
    ball_to_walkers = {}
    key_to_ball = {}
    ball_clusters_list = {}

    # create walkers and their directories
    new_balls = functions.initialize(input_initial_values_file, walker_list, temp_walker_list, balls, ball_to_walkers,
                                     vacant_walker_indices)
    balls = new_balls

    for step_num in range(gv.initial_step_num, gv.initial_step_num + gv.max_num_steps):
        # reset ball objects so that balls are newly created at every step
        if gv.balls_flag == 0 and step_num != gv.initial_step_num:
            balls = np.zeros((1, gv.num_cvs+3))
            ball_to_walkers = {}
            key_to_ball = {}
            ball_clusters_list = {}
            gv.current_num_balls = 0

        if gv.simulation_flag != 0 and step_num == gv.initial_step_num:
            pass
        else:
            gv.first_walker = 0
            gv.last_walker = gv.total_num_walkers-1
        print 'running   ' + str(step_num+1) + '-th step'
        os.chdir(gv.main_directory)
        f = open('bash_script_input_file.txt', 'w')
        f.write(str(gv.first_walker))
        f.write(' first_' + str(gv.last_walker) + '_last')
        f.close()

        # first, run simulation or clean up with bash script
        t0 = time()
        if (gv.simulation_flag == 3 or gv.simulation_flag == 4) and step_num == gv.initial_step_num:
            pass
        elif gv.simulation_flag == 2 and step_num == gv.initial_step_num:
            os.system('./clean_up.sh')
        else:
            os.system('./simulations.sh')

        # second, create balls and assign walkers to balls
        t1 = time()
        if gv.enhanced_sampling_flag == 1:
            new_balls = functions.threshold_binning(step_num, walker_list, temp_walker_list, balls, ball_to_walkers,
                                                    key_to_ball)
        else:
            new_balls = functions.binning(step_num, walker_list, temp_walker_list, balls, ball_to_walkers, key_to_ball)

        # third, perform spectral clustering if enhanced_sampling_flag = 2
        if gv.enhanced_sampling_flag == 2 and gv.num_balls_for_sc <= gv.num_occupied_balls \
                and step_num != gv.initial_step_num and gv.sc_performed == 0:
            functions.spectral_clustering(step_num, temp_walker_list, new_balls,  ball_clusters_list)
            # fourth, resample walkers for every ball
            if gv.sc_performed == 1:
                functions.resampling_for_sc(walker_list, temp_walker_list, new_balls, ball_to_walkers,
                                            ball_clusters_list, vacant_walker_indices)
            else:
                functions.resampling(walker_list, temp_walker_list, new_balls, ball_to_walkers, vacant_walker_indices)
        else:
            functions.resampling(walker_list, temp_walker_list, new_balls, ball_to_walkers, vacant_walker_indices)

        # finally, output the results in text files
        functions.print_status(step_num, walker_list, new_balls, ball_to_walkers, ball_clusters_list, key_to_ball)
        balls = new_balls
        t2 = time()

        os.chdir(gv.main_directory+'/CAS')
        f = open('time_record.txt', 'a')
        f.write(str(step_num+1) + '-th step: ' + 'simulation time: ' + str(t1-t0) + ' ' + 'post-processing time: ' +
                str(t2-t1) + '\n')
        f.close()
Example #7
0
def questions(username):

    #Set up page
    title = "Question Game"
    description = "Welcome {0}!".format(username.capitalize())

    #Find out the length of the game
    game_length = functions.get_file_length()

    #Logic for every time the check button is pressed
    if request.method == 'POST':

        form = request.form
        """
        Starts the game with default values when you access play the game 
        from the start game page
        """
        if form.get('start-game') == 'true':

            data = functions.initialize(username)

            return render_template('questions.html',
                                   data=data,
                                   title=title,
                                   description=description)

        else:

            try:
                question_index = int(request.form.get('question_index'))
                score = int(request.form.get('current_score'))
                question = functions.get_question(question_index)

                # Check whether the answer is correct
                user_answer = request.form.get('user_answer').lower().strip()
                real_answer = question['english'].lower()
                real_question = question['spanish'].lower()
                correct = user_answer == real_answer
                """
                Main Game Logic
                """
                while question_index < game_length:

                    #Correct Questions
                    if correct:
                        #increment score and question index
                        question_index += 1
                        score += 1

                        #Displays message to my html when I get a question correct
                        flash(
                            'The translation of {0} is {1}'.format(
                                real_question, real_answer), 'success')

                        #Load Next Question
                        next_question = functions.get_question(question_index)

                    #Incorrect Questions
                    else:
                        #Increment question index
                        question_index += 1

                        #Displays message to my html when I get a question wrong
                        flash(
                            'The translation of {0} is {1}. You said {2}'.
                            format(real_question, real_answer,
                                   user_answer), 'error')

                        #Load Next Question
                        next_question = functions.get_question(question_index)

                    #Setting up question information to be rendered to html
                    if next_question is not None:
                        data = {
                            'question_index': question_index,
                            'english': next_question['english'],
                            'spanish': next_question['spanish'],
                            'username': username,
                            'current_score': score,
                            'length': game_length
                        }
                        return render_template('questions.html',
                                               data=data,
                                               title=title,
                                               description=description)

                    else:
                        #Clears the messages
                        session.pop('_flashes', None)

                #Set the score
                functions.set_high_score(username, score)

                return render_template(
                    'scores.html',
                    scores=functions.get_high_score(),
                    title="Game Over",
                    description="{0} your score is: {1}".format(
                        username.capitalize(), score))

            #Game restart error handling
            except Exception as e:
                print("Error : {}".format(e))

    # Redirect to the homepage with an error if using GET
    return redirect('/')
Example #8
0
    
    if '20190703' in gps_csv:
        print("Completed 20190703")
        continue
    if '20190704' in gps_csv:
        print("Completed 20190704")
        continue
    if '20190706' in gps_csv:
        print("Completed 20190706")
        continue
    
    
    print(csv_name, 'START ', str( datetime.now() ))
 
    # 1. remove old data and create necessary directories
    initialize()

    # 2. ananymize ap_id column to int value ,   clip points within boundary
    #gdf_probe_clipped, gdf_target = get_points_within_target_region (gps_csv, anonymize=True, display_plot = False)
    gdf_probe_clipped, gdf_target = get_points_within_target_region (gps_csv, anonymize=False, display_plot = False)
    
    #print('----2 done----')
    
    
    # 3. Preprocess: cleaning data & applying sampling
    df_sample = preprocess_data()
    #print('----3 done----')

    # 4. map matching with osm roads using graphhopper
    df_mapped_route = map_match_csv2gpx_multithread(df_sample) # multithreaded
    
send_url = 'http://freegeoip.net/json'

#Application API Keys from Internet of Things Service from IBM Bluemix
username = "******"
password = "******"

temp = username.split("-")
organization = temp[1]
#any string for type e.g. "JavaDevice"
deviceType = "Pi"

deviceId = str(hex(int(get_mac())))[2:]
deviceId = 'gateway_'+deviceId[:-1]

deviceCli = functions.initialize(username, password, organization, deviceType, deviceId)
deviceCli.connect()

#r = requests.get(send_url)
#j = json.loads(r.text)
#lat = j['latitude']
#lon = j['longitude']

#Manyata Tech Park IBM
lat = 13.048291
lon = 77.620382

#EGL IBM
#lat = 12.951432
#lon = 77.643296
Example #10
0
import dataTypes

# stub: add code to ask user for
# - life table
# - initial population size
# - initial demographics
# -model run time (in breeding cycles)
lifeTable = [[0, 1, 0], [1, 0.75, 4], [2, 0.4, 5]]
lifeTable_wrightFisher = [[0, 1, 1]]
pop_size = 100
initialDemographics = [0.25, 0.5, 0.25]
maxYears = 10

# a history of every organism that has ever lived (and then died)
organismRecordList = []

# list of organism that are alive.
currentlyAliveList = []

# DEBUGGING OUTPUT
for ageCohort in lifeTable:
    print("age : ", ageCohort[0], ", survival probability : ", ageCohort[1],
          ", mean fertility : ", ageCohort[2])

# step 1: create generation 1.
initialize(organismRecordList, currentlyAliveList, pop_size,
           initialDemographics)

for i in currentlyAliveList:
    print(i)
def main():
    global per

    initialize()

    input("\nPress enter to generate your population: ")
    print("\n")

    per = {x: Susceptible() for x in range(1, config.initPop + 1)}
    for x in per:
        print(str(x) + ": " + str(per[x]))

    for x in range(1, config.initPop + 1):
        globals()["per" + str(x)] = Susceptible()
        totalID.append(globals()["per" + str(x)].getID())
        susceptID.append(globals()["per" + str(x)].getID())

    for y in range(1, config.zombiePop + 1):
        globals()["per" + str(y)].changeStatus("Zombie")

    endVal = len(totalID) + 1
    for x in range(1, endVal):
        print(str(x) + ": " + str(globals()["per" + str(x)]))

    input("\nPress enter to run simulation: ")
    print("\n")

    config.susceptPop = len(susceptID)
    runSim = True
    while runSim:
        #while config.time < 672:
        #print("\nTime {}".format(time))

        for x in range(1, endVal):
            globals()["per" + str(x)].walk()
            if globals()["per" + str(x)].getStatus() == "Susceptible":
                globals()["per" + str(x)].buildDefense()
            if globals()["per" + str(x)].getStatus() == "Infected" or globals(
            )["per" + str(x)].getStatus() == "Recovered":
                globals()["per" + str(x)].determineFate()
                if globals()["per" + str(x)].getStatus() == "Removed":
                    globals()["per" + str(x)].setCOD("Died of infection")
            if globals()["per" + str(x)].getStatus() == "Immune":
                globals()["per" + str(x)].developCure()

        for x in range(1, endVal):
            for y in range(1, endVal):
                if globals()["per" + str(x)] == globals()["per" + str(y)]:
                    if globals()["per" +
                                 str(x)].getStatus() == "Zombie" and globals()[
                                     "per" +
                                     str(y)].getStatus() == "Susceptible":
                        globals()["per" + str(x)].bite(globals()["per" +
                                                                 str(y)])
                    if globals()["per" +
                                 str(x)].getStatus() == "Zombie" and globals()[
                                     "per" + str(y)].getStatus() == "Immune":
                        globals()["per" + str(x)].bite(globals()["per" +
                                                                 str(y)])

        for x in range(1, endVal):
            for y in range(1, endVal):
                if globals()["per" + str(x)] == globals()["per" + str(y)]:
                    if globals()["per" +
                                 str(x)].getStatus() == "Immune" and globals()[
                                     "per" + str(y)].getStatus() == "Zombie":
                        globals()["per" + str(x)].heal(globals()["per" +
                                                                 str(y)])
                    if globals()["per" +
                                 str(x)].getStatus() == "Immune" and globals()[
                                     "per" + str(y)].getStatus() == "Infected":
                        globals()["per" + str(x)].heal(globals()["per" +
                                                                 str(y)])

        susceptList.append(len(susceptID))
        zombieList.append(len(zombieID))
        removeList.append(len(removeID))
        infectList.append(len(infectID))
        recoverList.append(len(recoverID))
        immuneList.append(len(immuneID))

        config.time += 1
        if len(zombieID) == 0 and len(infectID) == 0:
            config.endScene = 1
            runSim = False
        if len(susceptID) == 0 and len(immuneID) == 0 and len(recoverID) == 0:
            config.endScene = 2
            runSim = False
        if config.time >= 1500:
            config.endScene = 3
            runSim = False

    for x in range(1, endVal):
        print(str(x) + ": " + str(globals()["per" + str(x)]))

    input("\nPress enter to display graphs:")

    fileName = "simulation--{}-{}-{}--{}-{}-{}.pdf".format(
        now.year, now.month, now.day, now.hour, now.minute, now.second)
    pp = PdfPages(fileName)

    plt.plot(susceptList, label="Susceptible")
    plt.plot(zombieList, label="Zombie")
    plt.legend()
    plt.xlabel("Time (hours)")
    plt.ylabel("Number of People")
    pp.savefig()
    plt.show()

    plt.plot(immuneList, label="Immune")
    plt.plot(removeList, label="Removed")
    plt.legend()
    plt.xlabel("Time (hours)")
    plt.ylabel("Number of People")
    pp.savefig()
    plt.show()

    while True:
        try:
            summary = input(
                "\nWould you like to view the simulation summary? (Y/N): ")
            if summary not in ['N', 'n', 'Y', 'y']:
                raise ValueError
        except ValueError:
            print("\nPlease enter 'Y' or 'N'\n")
        else:
            break

    if summary in ['N', 'n']:
        pp.close()
    elif summary in ['Y', 'y'] and config.endScene == 1:
        end = "\n\nThe simulation lasted for {} hours. It ended because the Zombie and Infected population both reached zero.\n\
There are {} people of class Immune and {} people of class Susceptible. {} {} Recovering. \n\n".format(
            config.time, len(immuneID), len(susceptID), len(recoverID),
            config.p1 if (len(recoverID) == 1) else config.p2)
        print(end)
    elif summary in ['Y', 'y'] and config.endScene == 2:
        end = "\n\nThe simulation lasted for {} hours. It ended because the Susceptible, Immune, and Recovering populations all reached zero.\n\
There are {} people of class Zombie and {} people of class Infected.\n\n".format(
            config.time, len(zombieID), len(infectID))
        print(end)
    elif summary in ['Y', 'y'] and config.endScene == 3:
        end = "\n\nThe simulation lasted for the maximum alloted time, {} hours.\n\
There are {} Susceptible's, {} Zombie's, {} Immune's, {} Recovered and {} Removed.".format(
            config.time, len(susceptID), len(zombieID), len(immuneID),
            len(recoverID), len(removeID))
        print(end)

    firstPage = plt.figure(figsize=(11.69, 8.27))
    firstPage.clf()
    firstPage.text(0.5,
                   0.5,
                   end,
                   transform=firstPage.transFigure,
                   size=12,
                   ha="center")
    pp.savefig()
    plt.close()
    pp.close()

    input("Press enter to end the simulation.")
Example #12
0
def CAS_simulation(input_initial_values_file):
    # set simulation parameters.
    functions.set_parameters()

    # create python objects for walkers and macrostates.
    # walker_list keeps track of previous information whereas temp_walker_list keeps track of current/new information.
    if gv.enhanced_sampling_flag == 2:
        walker_list = [None]*(gv.num_balls_for_sc*gv.num_walkers*100)
        temp_walker_list = [None]*(gv.num_balls_for_sc*gv.num_walkers*100)
    else:
        walker_list = [None]*(gv.num_balls_limit*gv.num_walkers*2)
        temp_walker_list = [None]*(gv.num_balls_limit*gv.num_walkers*2)

    # balls is recorded in the following order: ball coordinates / ball radius / ball key / # of walkers
    balls = np.zeros((1, gv.num_cvs+3))
    balls_array = np.zeros((1, gv.num_cvs))
    # maps ball coordinates to walkers
    ball_to_walkers = {}

    # create walkers and their directories.
    balls, balls_array = functions.initialize(input_initial_values_file, walker_list, temp_walker_list, balls,
                                              balls_array, ball_to_walkers)

    for step_num in range(gv.initial_step_num, gv.initial_step_num + gv.max_num_steps):
        # reset macrostate objects so that macrostates are newly created at every step.
        if gv.balls_flag == 0 and step_num != gv.initial_step_num:
            balls = np.zeros((1, gv.num_cvs+3))
            balls_array = np.zeros((1, gv.num_cvs))
            ball_to_walkers = {}
            gv.current_num_balls = 0

        if gv.simulation_flag != 0 and step_num == gv.initial_step_num:
            pass
        else:
            gv.first_walker = 0
            gv.last_walker = gv.total_num_walkers-1
        print 'running ' + str(step_num+1) + '-th step'
        os.chdir(gv.main_directory)
        f = open('bash_script_input_file.txt', 'w')
        f.write(str(gv.first_walker))
        f.write(' first_' + str(gv.last_walker) + '_last')
        f.close()

        # first, run simulation or clean up unfinished processes with bash script.
        t0 = time()
        if (gv.simulation_flag == 3 or gv.simulation_flag == 4) and step_num == gv.initial_step_num:
            pass
        elif gv.simulation_flag == 2 and step_num == gv.initial_step_num:
            os.system('./clean_up.sh')
        else:
            os.system('./simulations.sh')

        # second, create macrostates and assign or bin walkers to macrostates.
        t1 = time()
        if gv.enhanced_sampling_flag == 1:
            balls, balls_array = functions.threshold_binning(step_num, walker_list, temp_walker_list, balls,
                                                             balls_array, ball_to_walkers)
        else:
            balls, balls_array = functions.binning(step_num, walker_list, temp_walker_list, balls, balls_array,
                                                   ball_to_walkers)

        t2 = time()
        # third, perform spectral clustering if enhanced_sampling_flag = 2.
        if gv.enhanced_sampling_flag == 2 and gv.num_balls_for_sc <= gv.num_occupied_balls and gv.sc_performed == 0 \
                and gv.sc_start == -1:
            # start fixing macrostates from this point on until we finish calculating the transition matrix
            gv.balls_flag = 1
            gv.sc_start = step_num
        if gv.enhanced_sampling_flag == 2 and gv.sc_performed == 0 and gv.sc_start != -1:
            functions.calculate_trans_mat_for_sc(step_num, temp_walker_list, balls, balls_array)
        if gv.enhanced_sampling_flag == 2 and gv.sc_performed == 1 and gv.sc_start != -1:
            ball_clusters_list = functions.spectral_clustering(step_num, balls)
            # fourth, resample walkers for every macrostate.
            if gv.sc_performed == 1:
                balls = functions.resampling_for_sc(walker_list, temp_walker_list, balls, ball_to_walkers,
                                                    ball_clusters_list)
            else:
                balls = functions.resampling(step_num, walker_list, temp_walker_list, balls, ball_to_walkers)
        else:
            balls = functions.resampling(step_num, walker_list, temp_walker_list, balls, ball_to_walkers)

        # finally, output the results as text files.
        balls = functions.print_status(step_num, walker_list, balls, ball_to_walkers)
        t3 = time()

        os.chdir(gv.main_directory+'/CAS')
        f = open('time_record.txt', 'a')
        f.write(str(step_num+1) + '-th step: simulation time: ' + str(t1-t0) + ' binning time: ' + str(t2-t1) +
                ' resampling time: ' + str(t3-t2) + '\n')
        f.close()
Example #13
0
    + Increased Storage in the Text Box within Datalocker
    + Windows are now Transient to each other;You cant interact with the root window until the child window is closed
    - This also fixes the issue of having multiple of the same window open
'''

# Change this text if program is modified or updated
version = "Encryptor v.16"

# Import Function.py and other modules
import functions as imp
import tkinter as tk
from tkinter import messagebox
from cryptography.fernet import Fernet

#Creating Missing Files
imp.initialize()


# Finish Button Command for Data Locker
def finish_button():
    txt = textbox.get('1.0',tk.END)
    imp.encrypt_and_store(txt, username)
    messagebox.showinfo('Info',"Data Saved in File! You may close the program safely now")
    
# The Data Locker Window
def Data_Locker():
    window = tk.Toplevel()
    window.title("Your Data Locker")
    window.iconbitmap(r"iconlocked.ico")
    window.resizable(0,0)
    tk.Label(window,text = "Your Data Locker",font = ('Consolas',24)).grid(row = 1,column = 0,columnspan = 2)
Example #14
0
# Made by:		Jose Lorenzo Castro
# Date made:	10 Aug 2019
#!/usr/bin/env python

import os
import sqlite3
from flask import Flask, request, render_template

import functions as fun

app = Flask(__name__)

#fun.cleanSlate()
fun.initialize()
#test = fun.findTwoVar('Student', 'Castro', 'Jose Lorenzo')
#if (test):
#    print ('Found Record')
#else:
#    print ('Sadness')


@app.route('/')
def index():
    return render_template("home.html")


@app.route('/add')
def addDir():
    return render_template("add/add.html")