Ejemplo n.º 1
0
def main():
    total = 0
    data = getdata("input.txt")
    for entry in data:
        fuel = calcfuel(entry)
        total_for_entry = fuel
        while calcfuel(fuel) > 0:
            fuel = calcfuel(fuel)
            total_for_entry += fuel
        total += total_for_entry
    return total
Ejemplo n.º 2
0
def dashboard():
    try:
        p = []
        p = getdata()
        #print(p)
        values = map(int, p)
        appl = appplication()
        infrs = infrastructure()
        sys = sysbuild()
        db = Database()
        NSA = NetSecArch()
        FN = FND()
        CodeR = CR()
        SecCo = SC()
        print(appl)
        print(infrs)
        legend = 'Vulnerability frequency By type'
        legend2 = 'Web application vulnerabilities'
        labels = ["Critical", "High", "Medium", "Low", "Informational"]
        labels2 = ["Critical", "High", "Medium", "Low", "Informational"]
        return render_template('template.html',
                               value1=p[0],
                               value2=p[1],
                               value3=p[2],
                               value4=p[3],
                               value5=p[4],
                               values=values,
                               labels=labels,
                               legend=legend,
                               labels2=labels2,
                               appl=appl,
                               infr=infrs,
                               legend2=legend2)

    except Exception as e:
        print(e)
Ejemplo n.º 3
0
 def acquireData(self):
     self.data = functions.getdata(self.spectrometer)
     return self.data
Ejemplo n.º 4
0
def main():
    lines = getdata()
    intersections = getintersections(lines[0], lines[1])
    closest = getclosestintersection(intersections)
Ejemplo n.º 5
0
    header_data = infile.readline()
finally:
    infile.close()
header_data = header_data.split()
header_data = [item.lower() for item in header_data]

# get data from file
# important to notice: pandas.read_csv are faster than numpy.genfromtxt
data = pd.read_csv(file, delimiter='\t', header=1,
                   names=header_data, engine='c', decimal=',')
# data = data[data != 0]

# initialize Checkbarlist for dialog later
Checkbarlist = ['save plots?']

[puv, puv_time, pv, time, filt_dat, current, r_spec] = getdata(data)
# plt.plot(r_spec)
# plt.show()

# write data in seperate vatiables for better readability
for i in range(0, len(header_data)):
    if header_data[i] == 'time':
        time = np.array(data['time'], dtype=pd.Series)
    elif header_data[i] == 'current':
        # current = np.array(data['current'], dtype=pd.Series)
        Checkbarlist.append('current')
    elif header_data[i] == 'r_spec':
        # r_spec = np.array(data['r_spec'], dtype=pd.Series)
        Checkbarlist.append('r_spec')
    elif header_data[i] == 'puv':
        # puv = np.array(data['puv'], dtype=pd.Series)
Ejemplo n.º 6
0
    total = dist()
    totaltime = timerun()
    adjusted = adjust(totaltime)
    finalpace = calcpace(adjusted, total)
    convertedpace = converttime(finalpace)
    impress = toprint(convertedpace)
elif option == '2':
    total = dist()
    totaltime = timerun()
    adjusted = adjust(totaltime)
    calctemp = predictrun(adjusted, total)
    convertedtemprun = converttime(calctemp)
    impress = toprint(convertedtemprun)
elif option == '3':
    createtable()
    thedate = date()
    total = dist()
    totaltime = timerun()
    adjusted = adjust(totaltime)
    finalpace = calcpace(adjusted, total)
    convertedpace = converttime(finalpace)
    obs = observations()
    escrever = setdata(thedate, total, totaltime, convertedpace, obs)
elif option == '4':
    getdata()
    deletedata()
elif option == '5':
    getdata()
else:
    invalidoption_text()
else:
    sys.exit('It is recommened to use Linux! (or Windows if you have to)')

# check if user aborted file selection
if file == '':
    sys.exit('no file to load data from!')

# datalength = list(range(100))

# get data frprofile nuom file
# important to notice: pandas.read_csv are faster than numpy.genfromtxt
data = pd.read_csv(file, delimiter='\t', header=0, engine='c', decimal=',')

# use the rawdata on function getdata to split profiles and smooth it
[raw_dat, raw_time, raw_pv, raw_pv_time, filt_dat, current_dat,
 r_spec_dat] = getdata(data)

# save raw_d and raw_pv for further computations
np.save('filt_dat', filt_dat)
np.save('raw_dat', raw_dat)
np.save('raw_pv', raw_pv)
np.save('raw_time', raw_time)
np.save('raw_pv_time', raw_pv_time)
# exit()

# from compute_delta_cp_and_e_ht_as_function import delta_cp_and_e_ht
# from functions import delta_cp_and_e_ht
# print(np.shape(raw_time))
# exit()

(epsht, delta_cp, f_epsht, f_delta_cp, c_puv) = \
Ejemplo n.º 8
0
Archivo: ch2.py Proyecto: vlbin/aoc19
def main():
	lines = getdata()
	intersections = getintersections(lines[0], lines[1])
	print(leaststeps(lines, intersections))
Ejemplo n.º 9
0
def main():
    data = getdata("input.txt")
    total = 0
    for entry in data:
        total += calcfuel(entry)
    return total