Beispiel #1
1
 def draw_Q(self, a, b, da):
     t = Task1(a, b)
     x1 = []
     y1 = []
     x2 = []
     y2 = []
     while a < b:
         x1.append(a)
         x2.append(a)
         y1.append(t.calculate_q())
         y2.append(t.calculate_qx())
         a += da
         t.reload(a, b)
     gp.s([x1, y1], filename='tmp1.dat')
     gp.s([x2, y2], filename='tmp2.dat')
     gp.c('set xlabel "Значение а"')
     gp.c('set ylabel "Значение функции"')
     gp.c(
         'set title "Графики зависимостей показателей Q и Q* от значений a"'
     )
     gp.c('set yrange [0:5]')
     gp.c(
         'plot "tmp1.dat" u 1:2 w i title "VarN(a)", "tmp2.dat" u 1:2 w i title "VarN*(a)"'
     )
     gp.pdf("Q.pdf")
Beispiel #2
0
    def draw_D(self, a, b, da):
        t = Task1(a, b)
        x1 = []
        y1 = []
        x2 = []
        y2 = []
        while a < b:
            x1.append(a)
            x2.append(a)
            y1.append(t.calculate_Dw())
            y2.append(t.calculate_Dv())
            a += da
            t.reload(a, b)
        gp.s([x1, y1], filename='tmp1.dat')
        gp.s([x2, y2], filename='tmp2.dat')
        gp.c('set xlabel "Значение а"')
        gp.c('set ylabel "Значение функции"')
        gp.c(
            'set title "Графики зависимостей показателей Dw и Dv от значений a"'
        )
        gp.c('set yrange [0:5]')
        gp.c(
            'plot "tmp1.dat" u 1:2 w l title "Dw(a)", "tmp2.dat" u 1:2 w l title "Dv(a)"'
        )
        gp.pdf("D.pdf")


# g = Graphics()
# g.draw_D(0.1, 0.7, 0.001)
# t = Task1(0.3,0.4)
# print(t.calculate_VarN())
def main(*args):
    try:

        dv_file = int(sys.argv[1])
        cxn = labrad.connect()
        dv = cxn.data_vault
        dv.cd(['', 'he_level'])
        dv.open(dv_file)
        x, y = dv.get_ex_t()
        x = np.array(x)
        xp = np.zeros(len(x))
        y = np.array(y)
        for k in range(0, len(x)):
            structtime = time.localtime(x[k])
            xp[k] = structtime.tm_hour + float(structtime.tm_min) / 60

        gp.s(
            [xp, y]
        )  #,filename='"C:\\Users\\Feldman Lab\\code\\Setup_BF122019\\LabRAD-Device-Electrical_Measurement-ONline_Software-pyqt5\\DEMONS GUI\\Scripts\\tmp.dat"')
        title = time.strftime("%a, %d %b %Y", time.localtime(x[0]))
        time.sleep(2)
        gp.c(
            'set terminal wxt size 500,500 position -1900,400 enhanced persist'
        )
        gp.c('set title ' + '"' + title + '"')
        gp.c('set xlabel "hours"')
        gp.c('set ylabel "percent"')
        gp.c('plot "tmp.dat" w lp')

    except Exception as e:
        print(e)
Beispiel #4
0
    def __init__(self):
        self.input = open("23.in", "r")
        self.output = open("23.dat", "w+")
        self.inputContents = self.input.readlines()
        self.nanobots = {}
        # self.coordsInRange = {}

        self.min = [float('+inf'), float('+inf'), float('+inf')]
        self.max = [float('-inf'), float('-inf'), float('-inf')]

        gp.c("set term x11 size 1280, 720")

        for line in self.inputContents:
            a = line.strip().split(">, r=")
            b = a[0].split("=<")
            c = b[1].split(",")
            coord = tuple(int(x) for x in c)

            self.nanobots[coord] = int(a[1])

            for i in range(3):
                self.min[i] = min(coord[i] - self.nanobots[coord], self.min[i])
                self.max[i] = max(coord[i] + self.nanobots[coord], self.max[i])

            self.output.write("{}\t{}\t{}".format(coord[0], coord[1],
                                                  coord[2]))
Beispiel #5
0
def gp_set_terminal(t):
    if t == 'svg':
        gp.c(
            'set terminal svg size 600,480 font "Helvetica,16" background "#ffffff" enhanced'
        )
    elif t == 'png':
        gp.c('set term pngcairo enhanced font "Helvetica,12"')
    else:
        print('Terminal `%s\' not supported' % t)
Beispiel #6
0
def init( ):
    global camkii_
    # initlialize gnuplot.
    with open( 'tmp.dat', 'w' ) as f:
        f.write( '1 1 1 1 1' )
    pg.c( 'set terminal x11' )
    pg.c( 'set xrange [0:500]; set yrange [0:500]; set zrange [0:500]' )
    pg.c( 'set ticslevel 0' )
    pg.c( 'set view 240,30' )
    pg.c( 'splot "tmp.dat" u 1:2:3:5 with p pt variable notitle' )
Beispiel #7
0
    def plotData(self, xmin=0, xmax=0, filename=''):

        if not xmin == xmax == 0:
            gp.c("set xrange [%f:%f]" % (xmin, xmax))

        gp.s(self.dataArray, "plot.dat")
        gp.c("plot 'plot.dat' u 1:2 w lp t 'Data'")

        if len(filename) > 0:
            gp.pdf(filename)
Beispiel #8
0
def init( ):
    # initlialize gnuplot.
    # Replot does not work in multiplot mode.
    with open( tmp_file_, 'w' ) as f:
        f.write( '1 1 1 1 1' )
    pg.c( 'set terminal x11 noraise' )
    pg.c( 'set xrange [0:500]; set yrange [0:500]; set zrange [0:500]' )
    pg.c( 'set ticslevel 0' )
    pg.c( 'set view 240,30' )
    pg.c( 'splot "%s" u 1:2:3:4:5 with p pt variable notitle' % tmp_file_ )
    return True
Beispiel #9
0
def init():
    # initlialize gnuplot.
    # Replot does not work in multiplot mode.
    with open(tmp_file_, 'w') as f:
        f.write('1 1 1 1 1')
    pg.c('set terminal x11 noraise')
    pg.c('set xrange [0:500]; set yrange [0:500]; set zrange [0:500]')
    pg.c('set ticslevel 0')
    pg.c('set view 240,30')
    pg.c('splot "%s" u 1:2:3:4:5 with p pt variable notitle' % tmp_file_)
    return True
Beispiel #10
0
def main():
    # X = np.arange(10)
    # Y = np.sin(X / (2 * np.pi))
    # Z = Y ** 2.0
    X = Y = np.array(list(range(10)))
    Z = np.array(X**3)
    Z2 = np.array(X**4)
    gp.s([X, Y, Z, Z2])
    gp.c('splot "tmp.dat" using 1:2:3 with lines')
    gp.c('replot "tmp.dat" u 1:2:4 w lines')
    # gp.c('splot "tmp.dat" using 1:2:3:($3+$4) with zerrorfill')
    # gp.c('replot "tmp.dat" u 1:3 w lp')
    gp.p('myfigure.ps')
Beispiel #11
0
def plot(pos):
    global init_
    if not init_:
        init()
        init_ = True

    if len(pos) < 1:
        print('No data')
        return False

    with open(tmp_file_, 'w') as f:
        for l in pos:
            f.write(l)

    pg.c('replot')
    return True
Beispiel #12
0
def simulate_step( i ):
    global camkiis_, grid_
    global dt_

    # Update the state of each camkii
    temp = camkiis_[:]
    [ cam.step( camkiis_ ) for cam in temp ]

    if i % 100 == 0:
        np.savetxt( "tmp.dat", np.array( pos_ ) )
        pg.c( 'set title "Time=%.3f"'% (i*dt_) )
        pg.c( 'replot' )

    if i % 100 == 0:
        outfile = os.path.join( image_dir_, '%08d.png' % i )
        save_gnuplot( i, outfile  )
Beispiel #13
0
def plot( pos ):
    global init_
    if not init_:
        init( )
        init_ = True

    if len( pos ) < 1:
        print( 'No data' )
        return False

    with open( tmp_file_, 'w' ) as f:
        for l in pos:
            f.write( l )

    pg.c( 'replot' )
    return True
Beispiel #14
0
    def load_and_go(self, gpFolder=False):
        '''
        # gpfolder is a switch to make gnuplot change folder if required
        simply executes the sub definitions
        loads data,
        normalizes to SI units,
        calculates differential resistances
        '''
        self.loaddata()
        self.loadCcor()
        self.norm_to_SI()
        self.make_cvals()
        if not os.path.exists(self.resultfolder):
            os.makedirs(self.resultfolder)

        if gpFolder:
            gp.c('cd "' + self.resultfolder + '"')
Beispiel #15
0
def plot_elo_ratings(elo_r):
    import numpy as np
    try:
        import PyGnuplot as gp
    except:
        print("Skip plotting the graph as PyGnuplot is not installed.")
        return
    import tempfile
    assert isinstance(elo_r, collections.OrderedDict)

    X = np.arange(len(elo_r))
    Y = np.array([r for r in elo_r.values()])

    with tempfile.NamedTemporaryFile() as fp:
        gp.s([X, Y], filename=fp.name)
        gp.c('plot "{}" u 1:2 notitle w lp'.format(fp.name))
        input('press any key to continue')
def make_graph(x_input_list, prediction_list, unSeenData_List):
    pg.s([x_input_list, prediction_list, unSeenData_List],
         filename='CNN_output.out')  # save data into a file
    pg.c('set title "CNN Output"; set xlabel "x-axis"; set ylabel "y-axis"')
    #pg.c('set key center top')
    pg.c("plot 'CNN_output.out' u 1 w l t 'x\_input = Test Set'"
         )  # plot test set seen data
    pg.c("replot  'CNN_output.out' u 2 w l  t 'yhat = Predicted value'"
         )  # plot test set CNN predicted data
    pg.c("replot  'CNN_output.out' u 3 w l t 'unSeenData = Correct value'"
         )  # plot test set unseen actual data
Beispiel #17
0
def printGroup(data, clusters):
    f = open("new.plt", "w")
    for i in range(len(data)):
        s = str(clusters[i]) + " " + str(data[i][0]) + " " + str(
            data[i][1]) + "\n"
        f.write(s)
    f.close()
    gp.c('set terminal qt size 500,400 title "Kmeans"')
    gp.c(
        "set palette model RGB defined ( 0 'red', 1 'green', 2 'blue', 3 'black')"
    )
    gp.c("unset key")
    gp.c('plot "new.plt" using 2:3:1 with points palette')
Beispiel #18
0
def main( ):
    Q = [1/6.0] * 6
    results = [ ]
    with open( "tmp.dat", "w" ) as  f:
        for i in range( 10000 ):
            P = generate_probs( )
            d = KL_divergence( P, Q )
            results.append( (P, d, entropy(P) ) )
            f.write( "%g %g\n" % (d, entropy(P)) )

    pg.c( 'set ylabel "H(E)"' )
    pg.c( 'set xlabel "D(E||Q), Q is uniform"' )
    pg.c( 'set terminal pdf; set output "problem2.pdf"; ' )
    pg.c( 'plot "tmp.dat" using 1:2 w p title "KL distance V/S entropy"' )
Beispiel #19
0
def main():
    Q = [1 / 6.0] * 6
    results = []
    with open("tmp.dat", "w") as f:
        for i in range(10000):
            P = generate_probs()
            d = KL_divergence(P, Q)
            results.append((P, d, entropy(P)))
            f.write("%g %g\n" % (d, entropy(P)))

    pg.c('set ylabel "H(E)"')
    pg.c('set xlabel "D(E||Q), Q is uniform"')
    pg.c('set terminal pdf; set output "problem2.pdf"; ')
    pg.c('plot "tmp.dat" using 1:2 w p title "KL distance V/S entropy"')
def Data_Fig(Properties, type, data, name):
    TYPE = type + "-" + data
    #    TYPE2 = "ATOM-"+type

    plot_command1 = "plot " + '"' + type + '_' + data + '" ' + 'u 1:2 w p pt 3 ps 1.2 title "' + TYPE + '"'
    plot_command2 = "replot " + '"' + type + '_' + data + '" ' + 'u 1:3 w l lt 5 lw 1.2 title "' + TYPE + '"'
    #    plot_command_ATOM = "replot "+'"ATOM_'+data +'" '+'u 1:2 w l lt 5 lw 1.8 title "'+TYPE2+'"'
    #    print(plot_command_VASP)
    #    exit ()
    Fig_title = "set title " + '"' + data + '"'
    Fig_name = type + "_" + name + ".eps"

    gp.c(Fig_title)
    if (Properties == "wavefunction"):
        gp.c('set xrange[0:1.5]')
        gp.c('set yrange[-1.5:1.5]')

    gp.c(plot_command1)
    gp.c(plot_command2)
    # gp.c('plot "VASP_WAE" u 1:2 w p pt 3 ps 2 title "VASP-AE"')
    # gp.c(plot_command_ATOM)
    # gp.p('myfigure.ps')
    gp.p(Fig_name)
def plot_ship(corners, name):
    gp.c(f"set label '{name}' at {corners[0,0]}, {corners[0,1]} font',8'")
    gp.c(
        f"set arrow from {corners[1,0]}, {corners[1,1]} to {corners[0,0]}, {corners[0,1]}"
    )
    for idx in range(1, 4):
        gp.c(
            f"set arrow from {corners[idx,0]}, {corners[idx,1]} to {corners[(idx+1)%4,0]}, {corners[(idx+1)%4,1]} nohead"
        )
Beispiel #22
0
def plot_pygnuplot(x, y, filename, data_filename):

    import PyGnuplot as gnu

    gnu.s([x, y], data_filename)
    gnu.c('set terminal pngcairo size 350,262 enhanced font "Verdana,10"')
    gnu.c('set output "' + filename + '"')
    gnu.c('plot "' + data_filename + '" w lp pi -1')

    return
Beispiel #23
0
def plot3dMSR(uc_3):

    hyperPoints = cdf.getMSR_ND(uc_s, N=190)

    gp.s(np.transpose(hyperPoints), filename="plot3dMSR.dat")
    gp.c('set ticslevel 0')
    gp.c('unset key')
    gp.figure('0')
    c_plot = 'splot "plot3dMSR.dat" with lines ' 
    print c_plot                   
    gp.c(c_plot)
def Data_compare_Fig(Properties, data, name):
    TYPE1 = "VASP-" + data
    TYPE2 = "ATOM-" + data

    plot_command_VASP = "plot " + '"VASP_' + data + '" ' + 'u 1:2 w p pt 1 lw 1.0 title "' + TYPE1 + '"'
    plot_command_ATOM = "replot " + '"ATOM_' + data + '" ' + 'u 1:2 w l lt 3 lw 1.5 title "' + TYPE2 + '"'
    #    plot_command_ATOM = "replot "+'"VASP_'+data +'" '+'u 1:3 w l lt 5 lw 1.8 title "'+TYPE2+'"'
    #    print(plot_command_VASP)
    #    exit ()
    Fig_title = "set title " + '"' + name + '"'
    Fig_name = name + ".eps"

    gp.c(Fig_title)
    gp.c('set xrange[0:3.0]')
    if (Properties == "waefunction"):
        gp.c('set yrange[-1:1.5]')
    elif (Properties == "wpsfunction"):
        gp.c('set yrange[-0.5:1.5]')
    elif (Properties == "density" and data == "PCORE"):
        gp.c('set yrange[0:1]')
    elif (Properties == "density" and data == "CORE"):
        gp.c('set yrange[0:9]')
    elif (Properties == "potential" and data == "POTAE"):
        gp.c('set yrange[-50: 5000]')
    elif (Properties == "potential" and data == "POTPS"):
        gp.c('set yrange[-50:20]')
    elif (Properties == "potential" and data == "POTPSC"):
        gp.c('set yrange[-500:100]')
    else:
        #       gp.c('set yrange[-50:250]')
        gp.c('set yrange[0:4]')
    gp.c(plot_command_VASP)
    gp.c(plot_command_ATOM)
    # gp.c('plot "VASP_WAE" u 1:2 w p pt 3 ps 2 title "VASP-AE"')
    # gp.c(plot_command_ATOM)
    # gp.p('myfigure.ps')
    gp.p(Fig_name)
Beispiel #25
0
def loop(frame, extremum=False):
    # Calculate values
    m = f_1.subs(x, x0)
    y0 = f.subs(x, x0)
    s = m * x + f.subs(x, x0) - m * x0
    Dx = R / sqrt(1 + m**2)
    dx1, dx2 = x0 - Dx / 2.0, x0 + Dx / 2.0

    # Gnuplot stuff
    gp.c('set output "frames/{:03d}.png"'.format(frame))
    gp.c('unset arrow')
    gp.c('unset label')
    gp.c(
        'set object 2 rect from graph 0,1 to graph 0.5,0.81 front fc rgb "white"'
    )
    gp.c(
        'set label "f\'(x)={:0.2f}" at graph 0.05, 0.9 tc rgb "blue" front font "Hershey/Symbol_Math, 40"'
        .format(float(m)))
    if extremum:
        y_2 = f_2.subs(x, x0)
        if y_2 < 0:
            type = 'maximum'
        elif y_2 == 0:
            type = 'inflection'
        else:
            type = 'minimum'
        gp.c(
            'set label "{}" at graph 0.05, 0.83 tc rgb "red" front font "Hershey/Symbol_Math, 40"'
            .format(type))
    gp.c('set arrow from {},{} to {},{} lw 1 dt 1 lc rgb "gray" nohead'.format(
        x0, ymin, x0, ymax))
    gp.c('set arrow from {},{} to {},{} lw 1 dt 1 lc rgb "gray" nohead'.format(
        xmin, y0, xmax, y0))
    gp.c('plot {} notitle lw 3 lc rgb "#FF0000",\\'.format(f))
    gp.c('[{}:{}] {} notitle lw 3 lc rgb "#0000FF",\\'.format(dx1, dx2, s))
    gp.c('"-" u 1:2:3 with circles fill solid lc rgb "#0000FF" notitle')
    gp.c('{} {} 0.02'.format(x0, y0))
    gp.c('e')
    gp.c('unset label')
Beispiel #26
0
# Function stuff
x = symbols('x')
f = (x**3 - x) * exp(-x**2 / 2) * x**2 / 2
f_1 = diff(f, x)
f_1_zeros = sorted([zero.evalf() for zero in solve(f_1, x)])
f_2 = diff(f_1, x)

# Parameters
xmin, xmax = -3, 3
ymin, ymax = -3, 3
N = 300
R = 0.5
pause_length = 50

# Gnuplot stuff
gp.c('set term png size 900, 900')
gp.c('set sample 1500')
gp.c('set xrange[{}:{}]'.format(xmin, xmax))
gp.c('set yrange[{}:{}]'.format(ymin, ymax))
gp.c('set xlabel "x" font "Hershey/Symbol_Math, 20"')
gp.c('set ylabel "y" font "Hershey/Symbol_Math, 20" rotate by 0')
gp.c('set size square')

# Generate frames
zero = f_1_zeros.pop(0)

xs = np.linspace(xmin, xmax, N)
dxs = xs[1] - xs[0]
frame = 0
for x0 in xs:
    # Check if point is, or closest to, a zero of the derivative
Beispiel #27
0
import PyGnuplot as gp, numpy as np
from datetime import datetime

#now = datetime.now()
#f = open('temperature.txt', 'a')
#f.write(now.strftime('%H:%M') + ' ' + str(22.5) + '\n')

fig = 'myfig'
output_filename = fig + '.png'
data_filename = 'test.txt'

gp.c('set term "png"')
gp.c('set output "' + output_filename + '"')
gp.c('set xdata time')
gp.c('set timefmt "%s"')
gp.c('set format x "%H:%M"')
gp.c('set autoscale y')
gp.c('set xtics rotate by 300')
gp.c('plot "< tail -n 120 ' + data_filename +
     '" using 1:2 notitle lt rgb "red" w lp')
Beispiel #28
0
import PyGnuplot as gp
import numpy as np

#gp.c("set terminal png size 400,300; set output 'xyz.png'")
gp.c('set grid')
gp.c('set style fill transparent solid 0.5 noborder')
gp.c('set title "Result";set xlabel "x-axis";set ylabel "y-axis"')
gp.c('set yrange [0:6000];set key center top')
gp.c('set xrange [10:100];set key center top')
gp.c("set style fill patter 2 border")
gp.c(
    "plot 'feasible_budget.txt' using 1:($2):($4) with filledcurves lc 7 title 'Region 1"
)
gp.c(
    "replot 'feasible_budget.txt' using 1:($3):($4) with filledcurves lc 3 title 'Region 2"
)
#gp.c("plot 'budgetfm.py' using 1:$2:$3 with filledcurves lc 10 title 'region 1")
gp.c(
    "replot 'feasible_budget.txt' using 1:($2) with linespoints lc 18 lw 2 title 'Random"
)
gp.c(
    "replot 'feasible_budget.txt' using 1:($3) with linespoints lc 15 lw 2 title 'Budget"
)
gp.c(
    "replot 'feasible_budget.txt' using 1:($4) with linespoints lc 25 lw 2 title 'Greedya"
)
gp.c(
    "replot 'feasible_budget.txt' using 1:($5) with linespoints lc 12 lw 2 title 'utility"
)
Beispiel #29
0
def plot_graphs_modes_markers(agreg_step):
    '''Funkce vykreslí grafy podle dat ve vstupních souborech a uloží je ve formátu PDF do složky output/graphs'''

    agreguj_data_rezie_modes_markers(agreg_step)
    #priprav_data_pro_sloupcovy_graf_rezie_nizky_bitrate_modes_markers()
    #priprav_data_pro_sloupcovy_graf_rezie_vysoky_bitrate_modes_markers()
    '''# histogram rezie pro nizky bitrate
    pg.c('set xlabel "ZABEZPEČENÍ"; set ylabel "REŽIE ZABEZPEČENÍ [ % ]"')
    pg.c('unset key; set style data histogram; set style fill solid border; set style histogram clustered')
    pg.c("plot for [COL=2:3] 'output/graphs_data/agreg/histogram_nizky_bitrate_rezie_modes_markers.dat' using COL:xticlabels(1) title columnheader")
    pg.pdf('output/graphs/histogram_rezie_nizky_bitrate_modes_markers.pdf')

    # histogram rezie pro vysoky bitrate
    pg.c('set xlabel "ZABEZPEČENÍ"; set ylabel "REŽIE ZABEZPEČENÍ [ % ]"')
    pg.c('unset key; set style data histogram; set style fill solid border; set style histogram clustered')
    pg.c("plot for [COL=2:3] 'output/graphs_data/agreg/histogram_vysoky_bitrate_rezie_modes_markers.dat' using COL:xticlabels(1) title columnheader")
    pg.pdf('output/graphs/histogram_rezie_vysoky_bitrate_modes_markers.pdf')'''

    # Kolik % velikosti souboru zabírají markery v závislosti na bitrate
    pg.c('set xlabel "BITRATE"; set ylabel "REŽIE ZABEZPEČENÍ [ % ]"')
    pg.c('set yrange [0:65]; set xrange [0:2.5]; set key right top')
    pg.c("plot '" + str(graphs_data_bitrate_rezie_sop_eph_agreg_filename) +
         "' title 'SOP + EPH'  with lines lw 3")
    pg.c(
        "replot '" +
        str(graphs_data_bitrate_rezie_vsechny_mody_sop_eph_agreg_filename) +
        "' title 'Líné paralelní zpracování + SEGMARK + SOP + EPH'  with lines lw 3"
    )
    pg.pdf('output/graphs/bitrate_rezie_zabezpeceni_modes_markers.pdf')

    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_failed_na_poskozeni_bez_ochrany_filename,
        graphs_data_failed_na_poskozeni_bez_ochrany_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_failed_na_poskozeni_vsechny_mody_sop_eph_filename,
        graphs_data_failed_na_poskozeni_vsechny_mody_sop_eph_agreg_filename)

    # Kolik % velikosti souboru zabírají markery v závislosti na bitrate a měnících se PRECINCTS a sop+eph pro layers=12
    pg.c(
        'set key right bottom; set xlabel "POŠKOZENÍ [ % ]"; set ylabel "POČET NEDEKOMPRIMOVATELNÝCH SOUBORŮ [ % ]"'
    )
    #pg.c('set yrange [0.5:1]; set xrange [0:0.1]; set key right')
    pg.c('set yrange [0:100]; set xrange [-0.00005:0.0205]; set key right')
    pg.c("plot '" + str(graphs_data_fails_mode_none_agreg_filename) +
         "' title 'Bez ochrany'  with lines lw 3")
    pg.c("replot '" +
         str(graphs_data_failed_na_poskozeni_sop_eph_agreg_filename) +
         "' title 'SOP + EPH'  with lines lw 3")
    #pg.c("replot '" + str(graphs_data_failed_na_poskozeni_sop_eph_segmark_agreg_filename) + "' title 'SOP, EPH, SEGMARK'  with lines linestyle 5")
    pg.c("replot '" +
         str(graphs_data_fails_mode_lazyparallelsegmark_agreg_filename) +
         "' title 'Líné paralelní zpracování + SEGMARK'  with lines lw 3")
    pg.c(
        "replot '" +
        str(graphs_data_failed_na_poskozeni_vsechny_mody_sop_eph_agreg_filename
            ) +
        "' title 'Líné paralelní zpracování + SEGMARK + SOP + EPH'  with lines lw 3"
    )
    pg.pdf('output/graphs/poskozeni_neuspesne_soubory_modes_markers.pdf')
Beispiel #30
0
 def _draw(
         self,
         points,  # ([x1,y1],filename,functionname), ...
         xl='Значения a',
         yl='Значения функции',
         title='заголовок',
         yrange='[0:5]',
         xrange='[-1:1]',
         out_file='file.pdf'):
     gp.c('set xlabel "' + xl + '"')
     gp.c('set ylabel "' + yl + '"')
     gp.c('set title "' + title + '"')
     gp.c('set yrange ' + yrange)
     gp.c('set xrange ' + xrange)
     plotstr = 'plot '
     for q in points:
         gp.s([q[0][0], q[0][1]], filename=q[1])
         plotstr += '"' + q[1] + '" u 1:2 w l title "' + q[2] + '", '
     plotstr = plotstr.strip(', ')
     gp.c(plotstr)
Beispiel #31
0
        Experiments(matrix,run_bench).run()


#if gArg.filebench == 'varmail':

    plot_str = "plot"
    plot_str += " [:"+gArg.x_range + "]"
    plot_str += " [:"+gArg.y_range + "]"
    plot_str += " 'tmp.out' u 1:2"
    plot_value = " lc rgb \#000 t"


    if gArg.plot_type == 'dot':  
        x,y = parse_dmesg(0)
        pg.s([x,y], filename='tmp.out')
        pg.c('set title "Execution time for the number of access threads"; set xlabel "Access Thread Number"; set ylabel "Millisecond"')
        pg.c('set grid')
        plot_str += plot_value+" '"+gArg.plot_type+"'"
#pg.c(plot_str)
        pg.c("plot [:33] [:] 'tmp.out' u 1:2 lc rgb 'black' t 'dot'")

    elif gArg.plot_type == 'median':
        kernlog_filter = run_benchmark(1);
        y,z,average,max_t_updates = parse_dmesg(1,kernlog_filter)
        print ( 'average' , average )
        x = np.arange(max_t_updates)
        pg.s([x,z], filename='tmp.out')
        pg.c('set title "Execution time for the number of access threads"; set xlabel "Access Thread Number"; set ylabel "Millisecond"')
        pg.c('set grid')
        plot_str += " w l"+plot_value+" '"+gArg.plot_type+"'"
#pg.c(plot_str)
import sys
import time
import math
import random
import PyGnuplot as gp
'''
gp.c('set dgrid3d 30,30')
gp.c('set hidden3d')
gp.c('set xrange [-100:100]')
gp.c('set yrange [-100:100]')
gp.c('set xzeroaxis')
gp.c('set yzeroaxis')
gp.c('set ticslevel 0')
gp.c('splot "123.txt" u 1:2:3 with linespoints pt 1')
'''
gp.c('set dgrid3d 30,30')
gp.c('set xrange [-10:10]')
gp.c('set yrange [-10:10]')
gp.c('set ticslevel 0')
gp.c('splot "123.txt" u 1:2:3 with linespoints pt 1')
Beispiel #33
0
import numpy as np
import PyGnuplot as pg

x = np.arange(1000) / 20.0
y1 = x - 25
y2 = y1 * np.sin(x - 25)

pg.s([x, y1, y2], filename='example.out')  # save data into a file t.out
pg.c('set title "example.pdf"; set xlabel "x-axis"; set ylabel "y-axis"')
pg.c('set yrange [-25:25]; set key center top')
pg.c("plot 'example.out' u 1:2 w l t 'y=x-25")  # plot fist part
pg.c("replot 'example.out' u 1:3 w l t 'y=(x-25)*sin(x-25)'")
pg.c("replot 'example.out' u 1:(-$2) w l t 'y=25-x'")
pg.pdf('example.pdf')  # export figure into a pdf file
Beispiel #34
0
def plotSNfit(result, vc, pidx, digi='D1'):
    ''' result : fitting results
        vc, variable carrier
        pidx power index
        digi = 'D1' or 'D2'
        '''
    vc.Tz = result.params['Tz'].value

    if digi == 'D1':
        f = vc.f1
        T = result.params['T1'].value
        G = result.params['G1'].value
        Tn = result.params['Tn1'].value
        data = np.array(vc.cPD1[pidx]) * 1.0

    if digi == 'D2':
        f = vc.f2
        T = result.params['T2'].value
        G = result.params['G2'].value
        Tn = result.params['Tn2'].value
        data = np.array(vc.cPD2[pidx]) * 1.0

    if digi == 'D12':
        f = vc.f1
        T = result.params['T12'].value
        G = result.params['G12'].value
        Tn = result.params['Tn12'].value
        data = np.array(vc.cPD3[pidx]) * 1.0

    if digi == 'D12c':
        f = vc.f1
        T = result.params['T12c'].value
        G = result.params['G12c'].value
        Tn = result.params['Tn12c'].value
        data = np.array(vc.cPD4[pidx]) * 1.0

    factor = f*h*vc.B*G  # factor to photon #
    SNf = fitfunc(G, Tn, T, f, vc)
    Amp = G*vc.B*kB*Tn

    title2 = (digi + ', RF-Drive ' + str(vc.d2.lin[pidx]) + ' G ' + str(np.round(G/1e7, 2)) +
              'e7 = ' + str(np.round(np.log10(G)*10.0, 2)) + 'dB  T ' + str(np.round(Tn, 2)) + 'K')
    dataname = digi + '_' + str(vc.d2.lin[pidx]) + '.dat'
    gp.c('')
    gp.figure()
    # gp.c('clear')
    gp.s([vc.I*1e6, (data)/factor, (SNf)/factor, np.ones_like(data)*Amp/factor],
         filename=vc.resultfolder+dataname)
    gp.c('set title "' + title2 + '"')
    gp.c('set xrange[-19:19]')
    gp.c('set key center top')
    gp.c('plot "' + dataname + '" u 1:2 w l t "Data" ')
    gp.c('replot "' + dataname + '" u 1:3 w l t "Fit" ')
    gp.c('replot "' + dataname + '" u 1:4 w l t "Amplifier Noise" ')
    gp.c('save "' + dataname[:-3] + 'gn"')
    gp.pdf(dataname[:-3]+'pdf')
    print dataname[:-3]+'pdf'
import PyGnuplot as gp
import numpy as np

gp.c('set term postscript eps size 9,8 color blacktext "Helvetica" 49')
gp.c("set output 'greedy_random.eps'")
gp.c('set key left')
gp.c(
    'set title "Comparision between FMTM-FSA and MTM-FSA";set xlabel "Number of Users";set ylabel "Total Maximum Lateness in hours"'
)
gp.c('set yrange [0:690000000]')
gp.c("set style line 2 lc rgb 'black' lt 1 lw 100")
#gp.c('set border 4')
gp.c("set style fill solid 1 border lt -1")
gp.c('set boxwidth 0.1')
gp.c(
    "plot 'greedy_random1.txt' using ($0):2:xtic(1) with boxes title 'FMTM-FSA' lc rgb '#fde725', \
	''using ($0+0.1):3 with boxes title 'MTM-FSA' lc rgb '#e56b5d'")
Beispiel #36
0
def plot_graphs_modes(agreg_step):
    '''Funkce vykreslí grafy podle dat ve vstupních souborech a uloží je ve formátu PDF do složky output/graphs'''

    agreguj_data_rezie_modu(agreg_step)
    #priprav_data_pro_sloupcovy_graf_rezie_nizky_bitrate_modes()
    #priprav_data_pro_sloupcovy_graf_rezie_vysoky_bitrate_modes()
    '''# histogram rezie pro nizky bitrate
    pg.c('set xlabel "ZABEZPEČENÍ"; set ylabel "REŽIE ZABEZPEČENÍ [ % ]"')
    pg.c('unset key; set style data histogram; set style fill solid border; set style histogram clustered')
    pg.c("plot for [COL=2:3] 'output/graphs_data/agreg/histogram_nizky_bitrate_rezie_modes.dat' using COL:xticlabels(1) title columnheader")
    pg.pdf('output/graphs/histogram_rezie_nizky_bitrate_modes.pdf')

    # histogram rezie pro vysoky bitrate
    pg.c('set xlabel "ZABEZPEČENÍ"; set ylabel "REŽIE ZABEZPEČENÍ [ % ]"')
    pg.c('unset key; set style data histogram; set style fill solid border; set style histogram clustered')
    pg.c("plot for [COL=2:3] 'output/graphs_data/agreg/histogram_vysoky_bitrate_rezie_modes.dat' using COL:xticlabels(1) title columnheader")
    pg.pdf('output/graphs/histogram_rezie_vysoky_bitrate_modes.pdf')'''

    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_all_filename,
        graphs_data_fails_mode_all_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_none_filename,
        graphs_data_fails_mode_none_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_bypass_filename,
        graphs_data_fails_mode_bypass_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_parallel_filename,
        graphs_data_fails_mode_parallel_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_lazyparallel_filename,
        graphs_data_fails_mode_lazyparallel_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_ertermsegmark_filename,
        graphs_data_fails_mode_ertermsegmark_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_segmark_filename,
        graphs_data_fails_mode_segmark_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_bypasssegmark_filename,
        graphs_data_fails_mode_bypasssegmark_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_parallelsegmark_filename,
        graphs_data_fails_mode_parallelsegmark_agreg_filename)
    agreguj_data_nedekomprimovatelnych_souboru(
        graphs_data_fails_mode_lazyparallelsegmark_filename,
        graphs_data_fails_mode_lazyparallelsegmark_agreg_filename)

    pg.c(
        'set key right bottom; set xlabel "POŠKOZENÍ [ % ]"; set ylabel "POČET NEDEKOMPRIMOVATELNÝCH SOUBORŮ [ % ]"'
    )
    # pg.c('set yrange [0.5:1]; set xrange [0:0.1]; set key right')
    pg.c('set yrange [0:100]; set xrange [-0.00005:0.0205]; set key right')

    pg.c("plot '" + str(graphs_data_fails_mode_none_agreg_filename) +
         "' title 'Žádný mód'  with lines lw 3")
    pg.c("replot '" + str(graphs_data_fails_mode_bypass_agreg_filename) +
         "' title 'Liné zpracování'  with lines lw 3")
    pg.c("replot '" + str(graphs_data_fails_mode_parallel_agreg_filename) +
         "' title 'Paralelní zpracování'  with lines lw 3")
    #pg.c("replot '" + str(graphs_data_fails_mode_lazyparallel_agreg_filename) + "' title 'Líné paralelní zpracování'  with lines linestyle 4")
    pg.c("replot '" +
         str(graphs_data_fails_mode_ertermsegmark_agreg_filename) +
         "' title 'ERTERM + SEGMARK'  with lines lw 3")
    #pg.c("replot '" + str(graphs_data_fails_mode_segmark_agreg_filename) + "' title 'SEGMARK'  with lines linestyle 6")
    #pg.c("replot '" + str(graphs_data_fails_mode_bypasssegmark_agreg_filename) + "' title 'BYPASS, SEGMARK'  with lines linestyle 7")
    #pg.c("replot '" + str(graphs_data_fails_mode_parallelsegmark_agreg_filename) + "' title 'Paralelní zpracování + SEGMARK'  with lines linestyle 8")
    pg.c("replot '" +
         str(graphs_data_fails_mode_lazyparallelsegmark_agreg_filename) +
         "' title 'Líné paralelní zpracování + SEGMARK' with lines lw 3")
    #pg.c("replot '" + str(graphs_data_fails_mode_all_agreg_filename) + "' title 'Všechny módy'  with lines linestyle 12")

    pg.pdf('output/graphs/poskozeni_neuspesne_soubory_modes.pdf')