コード例 #1
0
def einlesen(x):
    for i in range(3):
        x.readline()

    for i in x:
        s=i.split()
        data[int(s[1]),int(s[0])]+=1
        if int(s[2]) == 1:
            ssd[0]+=1
        if int(s[2]) == 2:
            ssd[1]+=1   
        if int(s[2]) == 3:
            ssd[2]+=1
#    print ssd[0]
#    print ssd[1]
#    print ssd[2]
    global datagrid
    global data2grid
    datagrid=GridData(data)
    data2grid=GridData(data)
コード例 #2
0
 def __init__(self, data, title, color_range=None):
     self.G = Gnuplot(persist=True)
     self.G('set border 4095 lt 1.000')
     self.G('set view map')
     self.G('set samples 50,50')
     self.G('set isosamples 50,50')
     self.G('unset surface')
     self.G('set style data pm3d')
     self.G('set style function pm3d')
     self.G('set ticslevel 0')
     self.G('set terminal x11')
     self.G('set pm3d at b')
     if color_range:
         self.G('set cbrange [%d:%d]' % color_range)
     self.data = data
     self.gdata = GridData(self.data)
     self.change_title(title)
     self.change_data(data)
     return
コード例 #3
0
        for i, val in enumerate(k):
            dcr[step, i] = float(val)
        print dcr[step]
        for i in range(127):
            s = datain.readline()

    step, tof = nonzero(dcr)
    dcrcounts = dcr[step, tof]
    save = zeros([3, len(step)])
    save[0] = step
    save[1] = tof
    save[2] = dcrcounts
    savetxt(dataout, save, fmt='%.1f')
    """
    for i in range(len):
        for val in dcr[step]:
            dataout.write("%f "%(val))
        dataout.write("\n")
    """
    dataout.close()
    datain.close()
    return dcr


dcr = extractdcr("axlv2_et_slices_2003_018_23.52.56_2003_019_00.04.56.dat")
gp = Gnuplot()
gp("set pm3d map corners2color c1")
gp("set cbrange[0.1:%f]" % (amax(dcr)))
gp("set log cb")
gp.splot(GridData(dcr))
コード例 #4
0
ファイル: corrmtx.py プロジェクト: annefi/PUI-fun
        print "Sum for line #", i, ":", s

for i in range(1024):
    corrmtx_norm2[i] = corrmtx_norm[1023 - i]

for i in range(1024):
    for j in range(1024):
        corrmtx_end[i][j] = corrmtx_norm2[1023 - j][i]

proj_z = zeros(1024)
proj_s = zeros(1024)

for i in range(1024):
    proj_z[i] = sum(corrmtx[i])

for i in range(1024):
    for j in range(1024):
        proj_s[i] += corrmtx[j][i]

cmgd = GridData(corrmtx_norm)

gp = Gnuplot()
gp("set pm3d map")

cfile = open("ramp.corr", "w")
for i in range(1024):
    for j in range(1024):
        cfile.write("%f\t" % corrmtx_end[i][j])

    cfile.write("\n")
コード例 #5
0
ファイル: tof_distribution.py プロジェクト: annefi/PUI-fun
            continue

        zz = 0
        ll = 0
        for jj in mp:
            tt = jj.split()
            if (zz > 2):
                for ii in range(3):
                    xx[ll, ii] = float(tt[ii])
                ll += 1
            zz += 1
        mp.close()

        for i in range(ll):
            data[int(xx[i, 0]), int(xx[i, 1])] += 1
        datagrid = GridData(data)

        # Bestimmen der Startwerte der Maxima, Positionen und Breiten

        # ToF
        hd = 0.
        hp = 0.
        for i in range(l - 2):
            if (hd < tof_data[i, 3]):
                hd = tof_data[i, 3]
                hp = float(i)

        sld = hd
        slp = 0.
        for i in range(int(hp), 100, -1):
            if (sld > hd * 0.6):
コード例 #6
0
	del o7data

x_max = max(x_max)
y_max = max(y_max)

y_max_len = []
for i in range(len(hist)):
	y_max_len.append(len(hist[i]))
y_max_len = max(y_max_len)
for i in range(len(hist)):
	while (len(hist[i]) < y_max_len):
			hist[i].append(0)

x_label = []
akt = 0.
while (akt < x_max):
	x_label.append(akt)
	akt += x_binsize
y_label = []
akt = 0.
while (akt < y_max):
	y_label.append(akt)
	akt += y_binsize

gp = Gnuplot()
gpdata=GridData(hist,x_label,y_label,binary=0)
gp("set pm3d at bs map explicit corners2color c1")

gp("set palette model RGB functions gray<1.e-20 ? 1 : gray<0.5 ? gray*2 : 1 , gray<1.e-20 ? 1 : gray<0.5 ? gray*2 : 2-gray*2, gray <1.e-20 ? 1 : gray<0.5 ? 1-sqrt(gray*2) : 0")
gp.splot(gpdata)
コード例 #7
0
ファイル: plot_puipos.py プロジェクト: annefi/PUI-fun
            et_mat_plot[i][k] = float(line[k])

pointsmat = zeros([len(points1), len(points1)], float)
xval = zeros([xdim], float)
yval = zeros([ydim], float)
xvalpoints = zeros([len(points1)], float)
yvalpoints = zeros([len(points1)], float)
for i in range(xdim):
    xval[i] = float(i) + 1.
for i in range(ydim):
    yval[i] = float(i) + 1.
for i in range(len(points1)):
    pointsmat[i][i] = 1.
    xvalpoints[i] = points1[i][0]
    yvalpoints[i] = points1[i][1]
gpdata = GridData(et_mat_plot, xval, yval, binary=0)
gpdata.set_option_colonsep("with", "lines")
gppoints = GridData(pointsmat, xvalpoints, yvalpoints, binary=0)
#gppoints=Data(points1,binary=0)
gppoints.set_option_colonsep("with", "p pt 2 lt 5 ps 2.5")
#gppoints.set_option_colonsep("at", "bs")
gpxerrorp = Data(xerrorp)
gpxerrorm = Data(xerrorm)
gpyerrorp = Data(yerrorp)
gpyerrorm = Data(yerrorm)
#gpvectors.set_option_colonsep("using", "1:2:3:4")
gpxerrorp.set_option_colonsep("with", "vectors head filled lt 5 lw 2")
gpxerrorm.set_option_colonsep("with", "vectors head filled lt 5 lw 2")
gpyerrorp.set_option_colonsep("with", "vectors head filled lt 5 lw 2")
gpyerrorm.set_option_colonsep("with", "vectors head filled lt 5 lw 2")
コード例 #8
0
 def change_data(self, data):
     self.data = data
     self.gdata = GridData(self.data)
     self.G.splot(self.gdata)
     return
コード例 #9
0
    s=data.readline()
    print i
    for k in range(xdim):
        s=data.readline()

s=data.readline()
print s
for i in range(xdim):
    s=data.readline()
    line=s.split()
    for k in range(ydim):
        if (float(line[k]) > -1.):
            et_mat[i][k]=float(line[k])

gp=Gnuplot()
et_mat_gp=GridData(et_mat)
points_mat_gp=GridData(points_mat)
cfile=open("tmpetmat.dat", "w")
for i in range(ydim):
    for j in range(xdim):
        cfile.write("%f\t" % float(et_mat[j][i]))
        cfile.write("\n")
    cfile.write("\n")
cfile.close()

cfile=open("tmppointssrimmat.dat", "w")
for i in range(numpoints):
    cfile.write("%f\t" % srimxpos[i])
    cfile.write("%f\t" % srimypos[i])
    cfile.write("%f\t" % 1.)
    cfile.write("\n")
コード例 #10
0
ファイル: plot_dcr.py プロジェクト: annefi/PUI-fun
gp3 = Gnuplot()
gp3.plot(Data(wbins, whist, with_="histeps"),
         Data(wbins2, whist2, with_="histeps lt 3"))
gp2 = Gnuplot()
gp2("set style data lines")
gp2.plot(he1sum)

gp = Gnuplot()
#gp("set term postscript enhanced color 18 lw 2 eps")
#gp("set output 'fouryears.ps'")
#gp("set multiplot")
#gp.splot(pionpos[0],pionpos[1],pionpos[2],pionpos[3])
gp("set pm3d map at b corners2color c1")
gp("set log cb")
gp("set cbrange[.1:]")
#gp("set cbrange[1e2:]")
#gp("set palette model RGB functions gray<1.e-20 ? 1 : gray<0.5 ? gray*2 : 1 , gray<1.e-20 ? 1 : gray<0.5 ? gray*2 : 2-gray*2, gray <1.e-20 ? 1 : gray<0.5 ? 1-sqrt(gray*2) : 0")
gp("set xrange[0:57]")
gp("set yrange[0:500]")
#gp.splot(GridData(dcr),pionpos[0],pionpos[1],pionpos[2],pionpos[3],pionpos[4])
gp.splot(GridData(dcr), *pionpos)
gp.hardcopy("10years.ps", color="True")
#gp("set surface")
#gp("set clabel '%0.0f'")
#gp("unset contour")
#gp("unset pm3d")
#gp("unset log z")
#gp("set zrange[0.5:1.5]")
#gp.splot(pionpos[0],pionpos[1],pionpos[2],pionpos[3])
コード例 #11
0
ファイル: compareetsl.py プロジェクト: annefi/PUI-fun
    ergin = open(path3 + k[0])
    for i in range(5):
        ergin.readline()
    for step in range(58):
        s2 = ergin.readline()
        for col in range(128):
            s2 = ergin.readline()
            k2 = s2.split()
            for lin in range(512):
                etsl1d[step][col][lin] += float(k2[lin])
    ergin.close()
listin.close()

for step in range(58):
    for col in range(128):
        for lin in range(512):
            etsl1dm12m[step][col][
                lin] = etsl1d[step][col][lin] - etsl12m[step][col][lin]
            etsl1dm1h[step][col][
                lin] = etsl1d[step][col][lin] - etsl1h[step][col][lin]

diffpl12m = []
GridData(etsl1dm12m)
diffpl1h = []
for step in range(58):
    diffpl12m.append(GridData(etsl1dm12m))
    diffpl1h.append(GridData(etsl1dm1h))
gp("set pm3d map explicit")
gp = Gnuplot()
gp.splot(diffpl12m[45])
コード例 #12
0
ファイル: vi_vs_vp.py プロジェクト: annefi/PUI-fun
    #tmpsum/=deltasum
    meanhevse.append([mass[i] / charge[i]**1., tmpsum, deltasum])

for i in range(len(dvzeros)):
    if sum(vivsvparr[i]) > 0.:
        dvzeros[i][1] /= (sum(vivsvparr[i]) + dvzeros[i][1])

xvals = []
yvals = []
for i in range(nrxbins):
    #xvals.append(float(i*vxbinwidth))
    xvals.append(10**(-3 + float(i * vxbinwidth)))
for i in range(nrybins):
    yvals.append(float(i * vybinwidth) + vyoffset)

pvivsvparr = GridData(vivsvparr, xvals, yvals, binary=0)
pdvzeros = Data(dvzeros)
pdvzeros.set_option_colonsep("with", "l lt -1")
xrange = [0., 3.]
#xrange=[300.,800.]
yrange = [0., 2.]
a = [[xrange[0], yrange[0], 1.], [xrange[1], yrange[1], 1.]]
pa = Data(a)
pa.set_option_colonsep("with", "l lt -1")
gp = Gnuplot()
gp("set pm3d at bs map explicit corners2color c1")
#gp("set pm3d map")
gp("set size square")
gp("set xrange[%f:%f]" % (xrange[0], xrange[1]))
gp("set yrange[%f:%f]" % (yrange[0], yrange[1]))
#gp("set logscale x")
コード例 #13
0
    if int(s[2]) == 3:
        ssd[2] += 1

print ssd[0]
print ssd[1]
print ssd[2]

#read data from p
#for i in range(3):
#    p.readline()

#for i in p:
#    s=i.split()
#    data[int(s[1]),int(s[0])]+=1

datagrid = GridData(data)
data2grid = GridData(data)

gp = Gnuplot()
gp("set logscale z")
gp("set zrange[1:80]")
#gp("set palette rgbformula -3,-3,-3")
#gp("test palette")
gp("set xrange[350:650]")
gp("set yrange[0:50]")

gp("set pm3d map")
gp.splot(datagrid, data2grid)
#gp("set term postscript")
#gp("set outp X11")
#gp("set data style line")
コード例 #14
0
        for k in range(xdim):
            s = data.readline()
    s = data.readline()
    for i in range(xdim):
        s = data.readline()
        line = s.split()
        for k in range(ydim):
            et_mat_plot[i][k] = float(line[k])

xval = zeros([xdim], float)
yval = zeros([ydim], float)
for i in range(xdim):
    xval[i] = float(i) + 1.
for i in range(ydim):
    yval[i] = float(i) + 1.
gpdata = GridData(et_mat_plot, xval, yval, binary=0)

gppoints = Data(points1, binary=0)
gppoints.set_option_colonsep("with", "p pt 2 lt 5 ps 2.5")
#yrange=[1,50]
#xrange=[145,223]
yrange = [1, 50]
xrange = [100, 223]
for ion in range(len(ion_names)):
    labelx = ((points1[ion][0] - float(xrange[0])) /
              float(xrange[1] - xrange[0])) - 0.025
    labely = (1. - (points1[ion][1] - float(yrange[0])) /
              (yrange[1] - yrange[0])) - 0.04
    print ion_names[ion], labelx, labely
    if (points1[ion][0] > xrange[0] and points1[ion][0] < xrange[1]):
        if (points1[ion][1] > yrange[0] and points1[ion][1] < yrange[1]):
コード例 #15
0
ファイル: vi_vs_para.py プロジェクト: annefi/PUI-fun
        val/=max(val)
    

xvals=[]
xvals2=[]
yvals=[]
for i in range(nrxbins):
    #xvals.append(float(i*vxbinwidth))
    xvals.append(float(i*vxbinwidth))
for i in range(nrxbins2):
    xvals2.append(10**(-3+float(i*vxbinwidth2)))

for i in range(nrybins):
    yvals.append(float(i*vybinwidth)+vyoffset)

pvivsvparr=GridData(vivsvparr,xvals,yvals,binary=0)
pvivsvparr2=GridData(vivsvparr2,xvals2,yvals,binary=0)
#xrange=[0.,3.]
xrange=[300.,800.]
yrange=[0.,2.]
xrange2=[0.001,100.]
yrange=[0.,2.]
a=[[xrange[0],yrange[0],1.],[xrange[1],yrange[1],1.]]
pa=Data(a)
pa.set_option_colonsep("with","l lt -1")
gp=Gnuplot()
gp("set pm3d at bs map explicit corners2color c1")
#gp("set pm3d map")
gp("set size square")
gp("set xrange[%f:%f]"%(xrange[0],xrange[1])) 
gp("set yrange[%f:%f]"%(yrange[0],yrange[1]))
コード例 #16
0
for i in range(1, 100):
    freqs[i] = freqs[i - 1] / 1.03

res = cwt_f(signal, freqs)
resarr = zeros([tdim, 100])
for i in range(tdim):
    resarr[i, :] = abs(res[:, i])

gp = Gnuplot()
gp("set log y")
gp("set pm3d map corners2color c1")
#gp("set log cb")
gp("set yrange[0.01:1.]")
gp("set xrange[%f:%f]" % (0, tdim))

gp.splot(GridData(resarr, time, freqs))

gp2 = Gnuplot()
gp2("set style data lines")
gp2.plot(signal)

gp3 = Gnuplot()
gp3("set style data lines")
gp3.plot(Data(freqs, resarr[50]))

gpfft = Gnuplot()
gpfft("set log xy")
gpfft("set style data lines")
psd = fftPlot(signal)
gpfft.plot(psd)