Example #1
0
def droneWitch():
    # print("2")
    count = 0
    witch_list = []
    while True:
        #print("3")
        beacon = []
        beacon = sort.sorting()
        # print("beacon on: "+str(beacon))

        mapping = node()

        witch = alarm(beacon, mapping)
        witch_list.append(witch)

        if witch != None:
            count = count + 1

        if count == 10:
            location = most_common(witch_list)
            return location
Example #2
0
while True:
    fire_sensor = int(sensor())
    print("sensor status: " + str(fire_sensor))
    if (fire_sensor == 0):
        ToWeb(2, 0)
    if (fire_sensor == 1):
        print("fire detected")
        break

count = 0

witch_list = []

while True:
    beacon = []
    beacon = sort.sorting()
    print("beacon on: " + str(beacon))

    mapping = node()

    witch = alarm(beacon, mapping)
    witch_list.append(witch)

    if witch != None:
        count = count + 1
    if count == 10:
        break

    print("fire at node: " + str(witch))

location = most_common(witch_list)
#!/bin/src/python3

from read import read_files
from count import count_products
from sort import sorting
from write import write_files

orders_path = './input/order_products.csv'
products_path = './input/products.csv'
products = read_files(orders_path, products_path)

departments = count_products(products)

sorting(departments)

output_path = './output/report.csv'
write_files(output_path, departments)

#!/usr/bin/python3 

from read import read_file
from sort import sorting
from write import write_file


# read in the input dataset
file_name = './input/itcont.txt'
list_drug, list_number, list_cost = read_file(file_name)

# sort the list
drug_sorted, number_sorted, cost_sorted = sorting(list_drug, list_number, list_cost)

# write the output dataset
file_write = './output/top_cost_drug.txt'
write_file(file_write, drug_sorted, number_sorted, cost_sorted)
Example #5
0
                        prob = all_genes[pname] * ws[pname]
                else:

                    prob = 0
                    cntg = 0
                    for g in genes:
                        if (g in all_genes):
                            prob += all_genes[g] * ws[g]
                        cntg += 1
                    prob = prob / cntg

                pathway.update_protein_prob(p, prob)

            myprism_trim_parser = prism_trim_parser()
            myprism_trim_parser.__init__()
            path_prob = myprism_trim_parser.calculate_prob(
                pathway, degs, all_genes)
            print '\n'
            print path_prob
            randomf = open('./data/temp/p' + pathway.id + '.txt', 'w')
            randomf.write(pathway.id + '\t' + pathway.title + '\t' +
                          str(path_prob) + '\n')
            randomf.close()

if (random_build == 'ALL'):
    mysorting = sorting()
    mysorting.sort(out_file)
else:
    mysorting = sorting()
    mysorting.sort_stored_random(out_file)