• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pylab.step函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pylab.step函数的典型用法代码示例。如果您正苦于以下问题:Python step函数的具体用法?Python step怎么用?Python step使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了step函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: measure_flexure_y

def measure_flexure_y(fine, HDUlist, profwidth=5, plot=False, outname=None):

    dat = HDUlist[0].data
    exptime = HDUlist[0].header["EXPTIME"]

    profs = []
    xx = np.arange(profwidth * 2)

    for ix in np.arange(500, 1200, 10):
        f = fine[ix]
        profile = np.zeros(profwidth * 2)

        # bad fit
        if not f.ok:
            continue
        # noisy fit
        if f.lamnrms > 1:
            continue
        # short spectrum
        if f.xrange[1] - f.xrange[0] < 200:
            continue

        yfun = np.poly1d(f.poly)
        for xpos in np.arange(f.xrange[0], f.xrange[1]):
            try:
                ypos = int(np.round(yfun(xpos)))
            except:
                continue
            try:
                profile += dat[ypos - profwidth : ypos + profwidth, xpos]
            except:
                continue

        profs.append(profile - np.min(profile))

    if plot:
        pl.figure(1)
    ffun = FF.mpfit_residuals(FF.gaussian4)
    parinfo = [{"value": 1}, {"value": profwidth}, {"value": 2}, {"value": 0}, {"value": 0}]

    profposys = []
    for prof in profs:
        if plot:
            pl.step(xx, prof)
        parinfo[0]["value"] = np.max(prof)
        fit = FF.mpfit_do(ffun, xx, prof, parinfo)
        if plot:
            pl.plot(xx, FF.gaussian4(fit.params, xx))
        profposys.append(fit.params[1] - profwidth - 1)
    if plot:
        pl.show()
    profposys = np.array(profposys)

    mn = np.mean(profposys)
    sd = np.std(profposys)
    ok = np.abs(profposys - mn) / sd < 3
    required_shift = np.mean(profposys[ok])
    print "dY = %3.2f pixel shift" % required_shift

    return required_shift
开发者ID:nblago,项目名称:kpy,代码行数:60,代码来源:Flexure.py


示例2: test_metropolis

def test_metropolis(Nsamp=int(1e4), Nburnin=0, sampleSig=5, thetaInit=-5):
    from scipy import stats
    import pylab as plt

    def testfunc(theta):
        return (stats.cauchy(-10, 2).pdf(theta)
                + 4 * stats.cauchy(10, 4).pdf(theta))

    def lnp(theta):
        """ interface to metrop """
        return (0, np.log10(testfunc(theta)))

    x = np.linspace(-50, 50, 1e4)
    y = testfunc(x)

    # compute normalization function: used later to put on same as histogram
    Zfunc = np.sum(y * x.ptp() / len(x))

    plt.plot(x, y / Zfunc, 'k-', lw=2)
    plt.xlabel('theta')
    plt.ylabel('f')

    lnps, samples = metropolis(lnp, [thetaInit], Nburnin=Nburnin, Nsamp=Nsamp,
                               sampleCov=sampleSig ** 2)

    n, b = np.histogram(samples.ravel(), bins=np.arange(-50, 50, 1),
                        normed=False)
    Zhist = (n * np.diff(b)).sum()
    plt.step(b[1:], n.astype(float) / Zhist, color='r')
    plt.title('test metropolis')
开发者ID:JannikBounin,项目名称:mvcomp2,代码行数:30,代码来源:metropolis.py


示例3: plot_attenuation_sim

def plot_attenuation_sim(rmArray, f, days_in_season=82, n_iter=1000, label=''):
	N = days_in_season
	l2 = (0.3 / f) ** 2
	hist, bins = np.histogram(rm, bins=np.arange(min(rmArray), max(rmArray) + bin_width, bin_width))
	bin_midpoints = bins[:-1] + np.diff(bins) / 2
	cdf = np.cumsum(hist)
	cdf = cdf / cdf[-1]
	values = np.random.rand(n_iter)
	value_bins = np.searchsorted(cdf, values)
	random_from_cdf = bin_midpoints[value_bins]

	factors = []

	for i, RM in enumerate(random_from_cdf):
		atten = 0
		for j in range(i + 1, N, 1):
			atten += np.cos(2 * (random_from_cdf[j] - RM) * l2)
		factor = (float(N) + (2. * atten)) / pow(float(N), 2.)
		factors.append(factor)

	Pv, v = np.histogram(factors, bins=10, density=True)
	print('Epsilon (sim) =', np.mean(factors), '+/-', np.std(factors))
	v = 0.5 * (v[1:] + v[:-1])
	pylab.step(v, Pv, label=label)

	return [np.mean(factors), np.std(factors)]
开发者ID:chiyu-chiu,项目名称:radionopy,代码行数:26,代码来源:read_season_3pt.py


示例4: test_sparse_fused_lasso

def test_sparse_fused_lasso(n=500,l1=2.,ratio=1.,control=control):

    D = (np.identity(n) - np.diag(np.ones(n-1),-1))[1:]
    D = np.vstack([D, ratio*np.identity(n)])
    M = np.linalg.eigvalsh(np.dot(D.T, D)).max() 

    Y = np.random.standard_normal(n)
    Y[int(0.1*n):int(0.3*n)] += 3.
    p1 = sapprox.signal_approximator((D, Y),L=M)
    p1.assign_penalty(l1=l1)
    
    t1 = time.time()
    opt1 = regreg.FISTA(p1)
    opt1.fit(tol=control['tol'], max_its=control['max_its'])
    beta1 = opt1.problem.coefs
    t2 = time.time()
    ts1 = t2-t1

    beta, _ = opt1.output
    X = np.arange(n)
    if control['plot']:
        pylab.clf()
        pylab.step(X, beta, linewidth=3, c='red')
        pylab.scatter(X, Y)
        pylab.show()
开发者ID:fperez,项目名称:regreg,代码行数:25,代码来源:lasso_example.py


示例5: plot

    def plot(self, ylog10scale = False, timescale = "years", year = 25):
        """
        Generate figure and axis for the population structure
        timescale choose from "2N0", "4N0", "generation" or "years"
        """
        time = self.Time
        pop  = self.pop
        for i in range(1,len(self.pop)):
            if type(pop[i]) == type(""):
                # ignore migration commands, and replace by (unchanged) pop size
                pop[i] = pop[i-1]
        
        if time[0] != 0 :
            time.insert(0, float(0))
            pop.insert(0, float(1))
        
        if timescale == "years":
            time = [ti * 4 * self.scaling_N0 * year for ti in time ]
            pl.xlabel("Time (years, "+`year`+" years per generation)",  fontsize=20)    
            #pl.xlabel("Years")    
        elif timescale == "generation":
            time = [ti * 4 * self.scaling_N0 for ti in time ]
            pl.xlabel("Generations)")    
        elif timescale == "4N0":
            time = [ti*1 for ti in time ]
            pl.xlabel("Time (4N generations)")    
        elif timescale == "2N0":
            time = [ti*2 for ti in time ]
            pl.xlabel("Time (2N generations)")       
        else:
            print "timescale must be one of \"4N0\", \"generation\", or \"years\""
            return
        
        time[0] = time[1] / float(20)
        
        time.append(time[-1] * 2)
        yaxis_scaler = 10000
        
        pop = [popi * self.scaling_N0 / float(yaxis_scaler) for popi in pop ]
        pop.insert(0, pop[0])               
        pl.xscale ('log', basex = 10)        
        #pl.xlim(min(time), max(time))
        pl.xlim(1e3, 1e7)
        
        if ylog10scale:
            pl.ylim(0.06, 10000)
            pl.yscale ('log', basey = 10)            
        else:
            pl.ylim(0, max(pop)+2)
        
        pl.ylim(0,5)            
        pl.tick_params(labelsize=20)

        #pl.step(time, pop , color = "blue", linewidth=5.0)
        pl.step(time, pop , color = "red", linewidth=5.0)
        pl.grid()
        #pl.step(time, pop , color = "black", linewidth=5.0)
        #pl.title ( self.case + " population structure" )
        #pl.ylabel("Pop size ($*$ "+`yaxis_scaler` +")")
        pl.ylabel("Effective population size",fontsize=20 )
开发者ID:luntergroup,项目名称:utilities,代码行数:60,代码来源:pop_struct.py


示例6: createPlot

def createPlot(dataY, dataX, ticksX, annotations, axisY, axisX, dostep, doannotate):
    if not ticksX:
        ticksX = dataX
    
    if dostep:
        py.step(dataX, dataY, where='post', linestyle='-', label=axisY) # where=post steps after point
    else:
        py.plot(dataX, dataY, marker='o', ms=5.0, linestyle='-', label=axisY)
    
    if annotations and doannotate:
        for note, x, y in zip(annotations, dataX, dataY):
            py.annotate(note, (x, y), xytext=(2,2), xycoords='data', textcoords='offset points')

    py.xticks(np.arange(1, len(dataX)+1), ticksX, horizontalalignment='left', rotation=30)
    leg = py.legend()
    leg.draggable()
    py.xlabel(axisX)
    py.ylabel('time (s)')

    # Set X axis tick labels as rungs
    #print zip(dataX, dataY)
  
    py.draw()
    py.show()
    
    return
开发者ID:ianmsmith,项目名称:oldtimer,代码行数:26,代码来源:oldtimer.py


示例7: interpret_msmc

def interpret_msmc(top_param = program_parameters(), scaling_method = "2N0", year = 1, ylog10scale = False ):
    if scaling_method == "generation":
        scaling_method = "years"
        year = 1

    #msmc_para = program_parameters()
    #top_param  = msmc_para
    ####### This two lines should be outside, after called
    
    replicates = top_param.replicates
    nsample    = top_param.nsample
    case       = top_param.case
      
    dir_name = "msmc-experiment/" + case + "Samples" +`nsample`
    ms_param = param.ms_param_of_case(case)
    
    ms_param.plot(ylog10scale = ylog10scale, timescale = scaling_method, year = year)
    
    mu = ms_param.t / ms_param.seqlen / float(4) / ms_param.scaling_N0 

    for ith_run in range(replicates):
        ms_out_file_prefix = ms_param.case + \
                             "Samples" +`nsample` + \
                             "msdata"

        outputFile_name = dir_name + "/" + ms_out_file_prefix + ".final.txt"
        if os.path.isfile( outputFile_name ):
            #print outputFile_name
            outputFile = open ( outputFile_name, "r")
            tmp_time , tmp_lambda = [] , []        
            skipline = outputFile.readline()
           
            for line in outputFile:
                tmp_time.append( float(line.split()[1]) )
                tmp_lambda.append( float(line.split()[3]) )
            
            #print tmp_time, tmp_lambda
            if scaling_method == "years":
                time = [ ti / mu * year for ti in tmp_time]
            elif scaling_method == "2N0":
                time = [ ti / mu / ( 2* float(ms_param.scaling_N0) ) for ti in tmp_time]
            elif scaling_method == "4N0":
                time = [ ti / mu / ( 4* float(ms_param.scaling_N0)) for ti in tmp_time]
                
            time[0] = time[1]/float(100)
            time.append(time[-1]*float(100))
            yaxis_scaler = float(10000)
            pop = [ 1 / lambda_i / (2*mu) / yaxis_scaler for lambda_i in tmp_lambda]
            pop.insert(0, pop[0])              
            pylab.step(time, pop, color = "purple", linewidth=2.0)
            #print pop

            outputFile.close()
    pylab.savefig( dir_name + ".pdf" )            
    pylab.close()            
开发者ID:shajoezhu,项目名称:utilities,代码行数:55,代码来源:top_level_code.py


示例8: graphical_output

def graphical_output(account_balance_giro, account_balance_extra, depot_balance_extra, giro_data,
                     daily_account_balance):
    years = mdates.YearLocator()  # every year
    months = mdates.MonthLocator()
    weeks = mdates.WeekdayLocator()
    days = mdates.DayLocator()

    dateFormat = mdates.DateFormatter('%Y-%m-%d')
    yearFormat = mdates.DateFormatter('%Y-%m')

    fig = pl.figure()

    pl.xlabel("date")
    pl.ylabel("balance")
    ax1 = pl.subplot(121)
    pl.xlabel("date")
    pl.ylabel("account balance")
    pl.title("account balances")

    ax1.step(daily_account_balance[:, 0], daily_account_balance[:, 1])
    ax1.step(daily_account_balance[:, 0], daily_account_balance[:, 2])
    ax1.step(daily_account_balance[:, 0], daily_account_balance[:, 3])
    ax1.step(daily_account_balance[:, 0], daily_account_balance[:, 4])
    ax1.xaxis.set_major_locator(months)
    ax1.xaxis.set_major_formatter(yearFormat)
    # ax1.xaxis.set_minor_locator(weeks)
    ax1.format_xdata = mdates.DateFormatter('%Y-%m-%d')
    ax1.xaxis_date()
    pl.legend(["Giro Account", "Extra Account", "Depot", "Total"], loc="best")

    ax2 = pl.subplot(122)
    pl.xlabel("date")
    pl.ylabel("bookings")
    pl.title("giro account bookings")
    ax2.bar(giro_data[:, 0], giro_data[:, 4])
    # ax2.bar(extra_data[:,0], extra_data[:,4]) too much stuff going on
    ax2.xaxis.set_major_locator(months)
    ax2.xaxis.set_major_formatter(yearFormat)
    ax2.xaxis.set_minor_locator(weeks)
    ax2.format_xdata = mdates.DateFormatter('%Y-%m-%d')
    ax2.xaxis_date()
    fig.autofmt_xdate()

    fig = pl.figure()

    daily_account_balance_diff = daily_account_balance[30:, :] - daily_account_balance[:-30, :]
    daily_account_balance_diff[:, 0] = daily_account_balance[30:, 0]
    # print daily_account_balance_diff
    pl.xlabel("date")
    pl.ylabel("balance")
    pl.step(daily_account_balance_diff[:, 0], daily_account_balance_diff[:, -1])
    pl.axhline(y=0, xmin=0, xmax=1)
    pl.legend(["Total 30 day difference"], loc="best")

    pl.show()
开发者ID:rattlesnailrick,项目名称:account_analysis,代码行数:55,代码来源:account_main.py


示例9: my_cdf

def my_cdf(data):
    data.sort()
    n = len(data)
    y = []
    for i in range(n):
	y.append((float(i)+1)/n)

    p.step(data, y)
    p.title('CDF')
    p.show()        
    pass
开发者ID:gigiwu,项目名称:statistic-methods,代码行数:11,代码来源:hw2.py


示例10: my_ccdf

def my_ccdf(data):
    # in-place sort
    data.sort()
    n = len(data)
    y = []
    for i in range(n):
	y.append(1-(float(i)+1)/n)
    p.step(data, y)
    p.ylabel('ccdf(x)')
    p.xlabel('x')
    p.title('CCDF')
    p.show()        
    pass
开发者ID:gigiwu,项目名称:statistic-methods,代码行数:13,代码来源:hw2.py


示例11: plotFluxE

def plotFluxE(fluxVec, energyVec=None, fnameOut='fluxE', figNum=0, label='fluxE'):
    if not energyVec:
        # assume 10 energy grp structure by default
        energyVec = np.array([1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7])
    fluxVec = np.append(np.array([0]), fluxVec)
    plt.figure(figNum)
    plt.step(energyVec, fluxVec / np.sum(fluxVec), linewidth='4', label=label)
    plt.ylim([5e-3, 1])
    plt.xscale('log')
    plt.yscale('log')
    plt.xlabel("Energy (eV)")
    plt.ylabel("Log Flux (Arbitrary Scaling)")
    plt.legend()
    plt.savefig(fnameOut)
开发者ID:wgurecky,项目名称:spyTran,代码行数:14,代码来源:fluxEplot.py


示例12: measure_flexure

def measure_flexure(sky):
    ''' Measure expected (589.3 nm) - measured emission line in nm'''
    ll, ss = sky['nm'], sky['ph_10m_nm']

    pl.figure()
    pl.step(ll, ss)

    pix = SG.argrelmax(ss, order=20)[0]
    skynms = chebval(pix, sky['coefficients'])
    for s in skynms: pl.axvline(s)

    ixmin = np.argmin(np.abs(skynms - 589.3))
    dnm = 589.3 - skynms[ixmin]

    return dnm
开发者ID:nblago,项目名称:kpy,代码行数:15,代码来源:Extracter.py


示例13: diCal_figure

def diCal_figure (cum_change, tmrca, position, prefix):
    tmrca = [x*2 for x in tmrca] # convert tmrca from unit of 4Ne to 2Ne
    site, absorptionTime = extract_diCal_time ( prefix )
    maxtime = max( max(absorptionTime), max(tmrca) )
    
    fig = pl.figure(figsize=(24,7)) 
    pl.plot(site, absorptionTime, color = "green", linewidth=3.0)
    pl.step(cum_change, tmrca, color = "red", linewidth=5.0)
    pl.plot(position, [maxtime*1.05]*len(position), "bo")    
    pl.axis([min(site), max(site) , 0, maxtime*1.1])
    pl.title("Dical Absorption time (Green)")
    pl.xlabel("Sequence base")
    pl.ylabel("TMRCA (2N0)")
    pl.savefig( prefix + "diCal_absorption_time" + ".png")
    pl.close()
开发者ID:shajoezhu,项目名称:utilities,代码行数:15,代码来源:generate_heatmap.py


示例14: xsPlot

def xsPlot(xs, energyVec=None, micro=True, label='xs1', style='-', fnameOut='xsPlt', figNum=4):
    if not energyVec:
        # assume 10 energy grp structure by default
        energyVec = np.array([1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7])
    xsVec = np.append(np.array([0]), xs)
    plt.figure(figNum)
    plt.step(energyVec, xsVec, linewidth='4', label=label, linestyle=style)
    plt.yscale('log')
    plt.xscale('log')
    plt.xlabel("Energy (eV)")
    if micro:
        plt.ylabel("Micro Xsection [barns]")
    else:
        plt.ylabel("Macro Xsection [1/cm]")
    plt.legend()
    plt.savefig(fnameOut)
开发者ID:wgurecky,项目名称:spyTran,代码行数:16,代码来源:xsPlot.py


示例15: plot_attenuation

def plot_attenuation(rmArray, f, label):
	N = rmArray.shape[0]
	l2 = (0.3 / f) ** 2
	factors = []
	for i, RM in enumerate(rmArray):
		atten = 0
		for j in range(i + 1, N, 1):
			atten += np.cos(2 * (rmArray[j] - RM) * l2)

		factor = (float(N) + (2. * atten)) / pow(float(N), 2.)
		factors.append(factor)

	Pv, v = np.histogram(factors, bins=10, density=True)
	print('Epsilon=', np.mean(factors), '+/-', np.std(factors))
	v = 0.5 * (v[1:] + v[:-1])
	pylab.step(v, Pv, label=label)

	return [np.mean(factors), np.std(factors)]
开发者ID:chiyu-chiu,项目名称:radionopy,代码行数:18,代码来源:read_season_3pt.py


示例16: plotpdf

def plotpdf(name, data, weights, label, xmin, xmax, bestfit, bdelta=0.1):
	"""  make pdf plots for age, av, and z
	inputs:  cluster name; array of parameters (age, av, or z) from matchoutput file; fit values from matchoutput file; 
        string name of parameter; minimum value of parameter to plot; maximum value of parameter to plot; best fit value of parameter; bin size
        output:  apXXX/apXXX_XXXptiles.txt"""

   	hdelta=bdelta/2.
  	nbins=np.around((data.max()-data.min())/bdelta)+1
  	xbins=np.linspace(np.around(data.min()-hdelta,3),np.around(data.max()+bdelta+hdelta,3),nbins+2)	#calculate bins
  	h = np.histogram(data, bins=xbins, weights=weights)						#create histogram of data
  	hist = h[0]/np.sum(h[0])									#normalize histogram
  	ptiles = output.weighted_percentile(data, weights, [0.16, 0.5, 0.84])				#compute percentiles
	np.savetxt(name+'/'+name+'_'+label+'ptiles.txt', ptiles)					#save these weighted percentiles
	plt.axvspan(ptiles[0], ptiles[2], color='0.8', alpha=0.5)
	plt.step(np.linspace(data.min(), data.max(), len(h[0])), hist, color='black', lw=3)
	plt.axvline(ptiles[1], color='r', lw=2)
	plt.axvline(bestfit, color='b', lw=2)
	plt.ylim(np.min(hist.min(), 0), hist.max()*1.05)
	plt.xlim(xmin, xmax)
	plt.xlabel(label)
开发者ID:loribeerman,项目名称:PHAT-Clusters,代码行数:20,代码来源:run_match.py


示例17: fused_lasso

def fused_lasso(n=100,l1=2.,**control):

    D = (np.identity(n) - np.diag(np.ones(n-1),-1))[1:]
    Dsp = scipy.sparse.lil_matrix(D)
    M = np.linalg.eigvalsh(np.dot(D.T, D)).max() 

    Y = np.random.standard_normal(n)
    Y[int(0.1*n):int(0.3*n)] += 6.

    p1 = sapprox.gengrad_sparse((Dsp, Y),L=M)
    p1.assign_penalty(l1=l1)

    p2 = sapprox.gengrad((D, Y),L=M)
    p2.assign_penalty(l1=l1)
    
    t1 = time.time()
    opt1 = regreg.FISTA(p1)
    opt1.debug=True
    opt1.fit(tol=control['tol'], max_its=control['max_its'])
    beta1 = opt1.problem.coefs
    t2 = time.time()
    ts1 = t2-t1

    t1 = time.time()
    opt2 = regreg.FISTA(p2)
    opt2.fit(tol=control['tol'], max_its=control['max_its'])
    beta2 = opt2.problem.coefs
    t2 = time.time()
    ts2 = t2-t1

    beta1, _ = opt1.output
    beta2, _ = opt2.output
    np.testing.assert_almost_equal(beta1, beta2)

    X = np.arange(n)
    if control['plot']:
        pylab.clf()
        pylab.step(X, beta1, linewidth=3, c='red')
        pylab.step(X, beta2, linewidth=3, c='green')
        pylab.scatter(X, Y)
        pylab.show()
开发者ID:fperez,项目名称:regreg,代码行数:41,代码来源:sparse_lasso.py


示例18: run

def run(trueID, predID):
    # Connect to DB
    conn = psycopg2.connect(database='taos-ii', user='kim')
    cur = conn.cursor()
    cur.execute('''select id, flux_a, flux_b, flux_c, b, t, a, d from synthetic2
            where id = %s or id = %s order by id''', (trueID, predID))
    rows = cur.fetchall()

    pl.figure(figsize=(16, 6))
    gs = gridspec.GridSpec(1, 3)

    title = ''
    figure_name = ''
    for row in rows:
        figure_name += '%d_' % row[0]

        title += '[ %d: Distance = %d, Size = %.1f ] ' \
                 % (row[0], row[6], row[7])
        #title += 'b: %.2f, t: %.3f, a: %d, d:%.1f ' \
        #         % (row[4], row[5], row[6], row[7])
        for i in range(3):
            time = np.arange(len(row[i + 1])) / 20.
            time -= np.median(time)

            pl.subplot(gs[i])
            pl.step(time, row[i + 1], marker='x', label=row[0], where='mid')
            pl.legend(loc='lower right', numpoints=1)
            print len(time)
            if i % 3 == 0:
                pl.ylabel('Flux scale to one')

            #pl.subplot(gs[i + 3])
            #pl.plot(time, np.array(rows[0][i + 1]) - np.array(rows[1][i + 1]))
            pl.grid()
            if i % 3 == 0:
                pl.ylabel('Scaled flux')
            pl.xlabel('Time/sec')

    pl.suptitle(title, fontsize=15)
    #pl.savefig('%s' % figure_name[:-1])
    pl.show()
开发者ID:dwkim78,项目名称:tipsy,代码行数:41,代码来源:plot_database.py


示例19: plot_pixel_spectrum

def plot_pixel_spectrum(i, j, data_cube, hist, params, zoom=None):
    '''
    '''
    
    if zoom == None:
        zoom = 1.0
        
    #----------------------------------
    #plotting the spectrum for a trial pixel of the map
    inds_in_pixel = hist.get_indicies([i, j])
    n = inds_in_pixel.size
    print 'number of sph particles in pixel = %d' % n  
    #ax_map.plot(x[inds_in_pixel], y[inds_in_pixel], 'y.', markersize=1, color='k')
    
    #constructing the spectrum corresponding to that pixel
    v_min, v_max = params['cube']['spec_rng']
    v_res = params['cube']['spec_res']
    
    #the velocity bins 
    v = numpy.linspace(v_min, v_max, v_res)
    
    #the spectrum of all the particles in the pixel 
    spect_pixel = data_cube[i,j,:]
    
    fig_spec = pylab.figure()
    ax_spec = fig_spec.add_axes([0.2, 0.2, 0.6, 0.6])
        
    #plotting the spectrum
    ax_spec.plot(v, spect_pixel, 'r')
    
    #rebinnign the spectrum to a lower resolution
    v_new           = scipy.ndimage.zoom(v          , zoom)
    spect_pixel_new = scipy.ndimage.zoom(spect_pixel, zoom)
    pylab.step(v_new, spect_pixel_new, 'b')
    pylab.plot(params['cube']['spec_rng'], [0.0,0.0], 'b--')
    
    pylab.xlabel(r'$v ({\rm km s}^{-1})$')
    pylab.ylabel(r'T$_{\rm antenna}$')
        
    pylab.draw()
    pylab.show()    
开发者ID:mherkazandjian,项目名称:ismcpak,代码行数:41,代码来源:data_cube_from_processed_fi_snapshot.py


示例20: OnZPlotProfile

    def OnZPlotProfile(self, event):
        x,p,d, pi = self.vp.GetProfile(50, background=[7,7])

        pylab.figure(1)
        pylab.clf()
        pylab.step(x,p)
        pylab.step(x, 10*d - 30)
        pylab.ylim(-35,pylab.ylim()[1])

        pylab.xlim(x.min(), x.max())

        pylab.xlabel('Time [%3.2f ms frames]' % (1e3*self.mdh.getEntry('Camera.CycleTime')))
        pylab.ylabel('Intensity [counts]')

        fr = self.fitResults[pi]

        if not len(fr) == 0:
            pylab.figure(2)
            pylab.clf()

            pylab.subplot(211)
            pylab.errorbar(fr['tIndex'], fr['fitResults']['x0'] - self.vp.do.xp*1e3*self.mdh.getEntry('voxelsize.x'), fr['fitError']['x0'], fmt='xb')
            pylab.xlim(x.min(), x.max())
            pylab.xlabel('Time [%3.2f ms frames]' % (1e3*self.mdh.getEntry('Camera.CycleTime')))
            pylab.ylabel('x offset [nm]')

            pylab.subplot(212)
            pylab.errorbar(fr['tIndex'], fr['fitResults']['y0'] - self.vp.do.yp*1e3*self.mdh.getEntry('voxelsize.y'), fr['fitError']['y0'], fmt='xg')
            pylab.xlim(x.min(), x.max())
            pylab.xlabel('Time [%3.2f ms frames]' % (1e3*self.mdh.getEntry('Camera.CycleTime')))
            pylab.ylabel('y offset [nm]')

            pylab.figure(3)
            pylab.clf()

            pylab.errorbar(fr['fitResults']['x0'] - self.vp.do.xp*1e3*self.mdh.getEntry('voxelsize.x'),fr['fitResults']['y0'] - self.vp.do.yp*1e3*self.mdh.getEntry('voxelsize.y'), fr['fitError']['x0'], fr['fitError']['y0'], fmt='xb')
            #pylab.xlim(x.min(), x.max())
            pylab.xlabel('x offset [nm]')
            pylab.ylabel('y offset [nm]')
开发者ID:RuralCat,项目名称:CLipPYME,代码行数:39,代码来源:squiggleTools.py



注:本文中的pylab.step函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pylab.subplot函数代码示例发布时间:2022-05-25
下一篇:
Python pylab.stem函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap