Esempio n. 1
0
def test_plot_beta_l0():
    print """Test plot for beta angle"""

    import algos.graph.GlobalGraphics as gg

    xarr = np.linspace(-2, 2, 50)
    phi = 0
    cmt = 'l0'

    y_000 = [funcy_l0(x, phi, 0) for x in xarr]
    y_p10 = [funcy_l0(x, phi, 10) for x in xarr]
    y_p20 = [funcy_l0(x, phi, 20) for x in xarr]
    y_p30 = [funcy_l0(x, phi, 30) for x in xarr]
    y_p40 = [funcy_l0(x, phi, 40) for x in xarr]
    y_p50 = [funcy_l0(x, phi, 50) for x in xarr]  # 48
    y_m10 = [funcy_l0(x, phi, -10) for x in xarr]
    y_m20 = [funcy_l0(x, phi, -20) for x in xarr]
    y_m30 = [funcy_l0(x, phi, -30) for x in xarr]
    y_m40 = [funcy_l0(x, phi, -40) for x in xarr]
    y_m50 = [funcy_l0(x, phi, -50) for x in xarr]  # -48

    #fig2, ax2 = gg.plotGraph(xarr, y_m01, pfmt='k.', figsize=(10,5), window=(0.15, 0.10, 0.78, 0.80))
    fig2, ax2 = gg.plotGraph(xarr,
                             y_000,
                             pfmt='k-',
                             figsize=(10, 5),
                             window=(0.15, 0.10, 0.78, 0.80),
                             lw=2)

    #b: blue
    #g: green
    #r: red
    #c: cyan
    #m: magenta
    #y: yellow
    #k: black
    #w: white

    ax2.plot(xarr, y_p50, 'g-x', label=' 50')
    ax2.plot(xarr, y_p40, 'm-', label=' 40')
    ax2.plot(xarr, y_p30, 'b-', label=' 30')
    ax2.plot(xarr, y_p20, 'y-', label=' 20')
    ax2.plot(xarr, y_p10, 'r-', label=' 10')
    ax2.plot(xarr, y_000, 'k-', label='  0')
    ax2.plot(xarr, y_m10, 'r.', label='-10')
    ax2.plot(xarr, y_m20, 'y.', label='-20')
    ax2.plot(xarr, y_m30, 'b.', label='-30')
    ax2.plot(xarr, y_m40, 'm.', label='-40')
    ax2.plot(xarr, y_m50, 'g+', label='-50')

    ax2.legend(loc='upper right')

    ax2.set_xlabel('x', fontsize=14)
    ax2.set_ylabel('y', fontsize=14)
    ax2.set_title('%s: phi=%.1f, beta=[-50,50]' % (cmt, phi),
                  color='k',
                  fontsize=20)

    gg.savefig('test-plot-beta-l0.png')
    gg.show()
Esempio n. 2
0
def test_plot_beta_l0() :
    print """Test plot for beta angle"""

    import algos.graph.GlobalGraphics as gg

    xarr = np.linspace(-2,2,50)
    phi = 0
    cmt = 'l0'


    
    y_000 = [funcy_l0(x, phi,   0) for x in xarr]
    y_p10 = [funcy_l0(x, phi,  10) for x in xarr]
    y_p20 = [funcy_l0(x, phi,  20) for x in xarr]
    y_p30 = [funcy_l0(x, phi,  30) for x in xarr]
    y_p40 = [funcy_l0(x, phi,  40) for x in xarr]
    y_p50 = [funcy_l0(x, phi,  50) for x in xarr] # 48
    y_m10 = [funcy_l0(x, phi, -10) for x in xarr]
    y_m20 = [funcy_l0(x, phi, -20) for x in xarr]
    y_m30 = [funcy_l0(x, phi, -30) for x in xarr]    
    y_m40 = [funcy_l0(x, phi, -40) for x in xarr]    
    y_m50 = [funcy_l0(x, phi, -50) for x in xarr] # -48

    #fig2, ax2 = gg.plotGraph(xarr, y_m01, pfmt='k.', figsize=(10,5), window=(0.15, 0.10, 0.78, 0.80)) 
    fig2, ax2 = gg.plotGraph(xarr, y_000, pfmt='k-', figsize=(10,5), window=(0.15, 0.10, 0.78, 0.80), lw=2) 

    #b: blue
    #g: green
    #r: red
    #c: cyan
    #m: magenta
    #y: yellow
    #k: black
    #w: white


    ax2.plot(xarr, y_p50,'g-x', label=' 50')
    ax2.plot(xarr, y_p40,'m-',  label=' 40')
    ax2.plot(xarr, y_p30,'b-',  label=' 30')
    ax2.plot(xarr, y_p20,'y-',  label=' 20')
    ax2.plot(xarr, y_p10,'r-',  label=' 10')
    ax2.plot(xarr, y_000,'k-',  label='  0')
    ax2.plot(xarr, y_m10,'r.',  label='-10')
    ax2.plot(xarr, y_m20,'y.',  label='-20')
    ax2.plot(xarr, y_m30,'b.',  label='-30')
    ax2.plot(xarr, y_m40,'m.',  label='-40')
    ax2.plot(xarr, y_m50,'g+',  label='-50')
                                        
    ax2.legend(loc='upper right')

    ax2.set_xlabel('x', fontsize=14)
    ax2.set_ylabel('y', fontsize=14)
    ax2.set_title('%s: phi=%.1f, beta=[-50,50]' % (cmt,phi), color='k', fontsize=20)

    gg.savefig('test-plot-beta-l0.png')
    gg.show()
Esempio n. 3
0
def test_plot_beta_l1(DoR=0.4292, sgnrt=1.) :
    print """Test plot for beta angle"""

    import algos.graph.GlobalGraphics as gg

    xarr = np.linspace(-2,2,50)
    phi = 0

    fancy_plt = funcy_l1_v1
    #fancy_plt = funcy_l1_v0

    cmt = 'POS' if sgnrt > 0 else 'NEG' #'-B -/+ sqrt(B*B-C)'
    cmt = '%s-DoR-%.3f' % (cmt, DoR)
    
    y_p10 = [fancy_plt(x, phi,  10,   DoR, sgnrt) for x in xarr]
    y_000 = [fancy_plt(x, phi,   0,   DoR, sgnrt) for x in xarr]
    y_m10 = [fancy_plt(x, phi, -10,   DoR, sgnrt) for x in xarr]
    y_m13 = [fancy_plt(x, phi, -13,   DoR, sgnrt) for x in xarr]    
    y_m15 = [fancy_plt(x, phi, -15,   DoR, sgnrt) for x in xarr]    
    y_m20 = [fancy_plt(x, phi, -20,   DoR, sgnrt) for x in xarr]
    y_m30 = [fancy_plt(x, phi, -30,   DoR, sgnrt) for x in xarr]
    y_m35 = [fancy_plt(x, phi, -35,   DoR, sgnrt) for x in xarr]    
    y_m40 = [fancy_plt(x, phi, -40,   DoR, sgnrt) for x in xarr]
    
    fig2, ax2 = gg.plotGraph(xarr, y_000, pfmt='k-', figsize=(10,5), window=(0.15, 0.10, 0.78, 0.80), lw=2) 
    ax2.plot(xarr, y_p10,'g-',  label=' 10')
    ax2.plot(xarr, y_000,'k-',  label='  0')
    ax2.plot(xarr, y_m10,'g.',  label='-10')
    ax2.plot(xarr, y_m13,'r-.', label='-13')
    ax2.plot(xarr, y_m15,'y.',  label='-14')
    ax2.plot(xarr, y_m20,'r.',  label='-20')
    ax2.plot(xarr, y_m30,'c.',  label='-30')
    ax2.plot(xarr, y_m35,'m.',  label='-35')
    ax2.plot(xarr, y_m40,'b+',  label='-40')

    ax2.legend(loc='upper right')
    
    ax2.set_title('%s: phi=%.1f, beta=[-40,10]' % (cmt,phi), color='k', fontsize=20)

    ax2.set_xlabel('x', fontsize=14)
    ax2.set_ylabel('y', fontsize=14)

    gg.savefig('test-plot-beta-l1-%s.png' % cmt)
    gg.show()
Esempio n. 4
0
def test_plot_beta_l1_zoom(DoR=0.4292, sgnrt=1.) :
    print """Test plot for beta angle"""

    import algos.graph.GlobalGraphics as gg

    phi = 0

    fancy_plt = funcy_l1_v1
    #fancy_plt = funcy_l1_v0

    if sgnrt > 0 : 

        cmt = 'POS' #'-B -/+ sqrt(B*B-C)'
        cmt = '%s-DoR-%.3f' % (cmt, DoR)
        
        xarr = np.linspace(-0.29,0.29,60)

        y_000 = [fancy_plt(x, phi,   0,   DoR, sgnrt) for x in xarr]
        y_m05 = [fancy_plt(x, phi,  -5,   DoR, sgnrt) for x in xarr]
        y_m09 = [fancy_plt(x, phi,  -9,   DoR, sgnrt) for x in xarr]
        y_m13 = [fancy_plt(x, phi, -13.3, DoR, sgnrt) for x in xarr]    
        y_m18 = [fancy_plt(x, phi, -18,   DoR, sgnrt) for x in xarr]
        y_m20 = [fancy_plt(x, phi, -20,   DoR, sgnrt) for x in xarr]
        
        fig2, ax2 = gg.plotGraph(xarr, y_000, pfmt='k-', figsize=(10,5), window=(0.15, 0.10, 0.78, 0.80), lw=2) 
        ax2.plot(xarr, y_000,'k-',  label='  0')
        ax2.plot(xarr, y_m05,'g.',  label=' -5')
        ax2.plot(xarr, y_m09,'y.',  label=' -9')
        ax2.plot(xarr, y_m13,'r-.', label='-13')
        ax2.plot(xarr, y_m18,'c.',  label='-18')
        ax2.plot(xarr, y_m20,'b.',  label='-20')
        
        ax2.set_title('%s: phi=%.1f, beta=[-20,0]' % (cmt,phi), color='k', fontsize=20)
        ax2.legend(loc='upper center')

    if sgnrt < 0 : 

        cmt = 'NEG' #'-B -/+ sqrt(B*B-C)'
        cmt = '%s-DoR-%.3f' % (cmt, DoR)
        
        xarr = np.linspace(-1,1,50)

        y_m20 = [fancy_plt(x, phi, -20,   DoR, sgnrt) for x in xarr]
        y_m23 = [fancy_plt(x, phi, -23,   DoR, sgnrt) for x in xarr]
        y_m25 = [fancy_plt(x, phi, -25,   DoR, sgnrt) for x in xarr]
        y_m27 = [fancy_plt(x, phi, -27,   DoR, sgnrt) for x in xarr]
        y_m30 = [fancy_plt(x, phi, -30,   DoR, sgnrt) for x in xarr]
        y_m35 = [fancy_plt(x, phi, -35,   DoR, sgnrt) for x in xarr]
        y_m40 = [fancy_plt(x, phi, -40,   DoR, sgnrt) for x in xarr]
        y_m60 = [fancy_plt(x, phi, -60,   DoR, sgnrt) for x in xarr]
        
        fig2, ax2 = gg.plotGraph(xarr, y_m25, pfmt='k-', figsize=(10,5), window=(0.15, 0.10, 0.78, 0.80), lw=2) 
        ax2.plot(xarr, y_m20,'g+-', label='-20')
        ax2.plot(xarr, y_m23,'m-',  label='-23')
        ax2.plot(xarr, y_m25,'k-',  label='-25')
        ax2.plot(xarr, y_m27,'b.',  label='-27')
        ax2.plot(xarr, y_m30,'y.',  label='-30')
        ax2.plot(xarr, y_m35,'r.',  label='-35')
        ax2.plot(xarr, y_m40,'c.',  label='-40')
        ax2.plot(xarr, y_m60,'+',   label='-60')
        
        ax2.set_title('%s: phi=%.1f, beta=[-60,-20]' % (cmt,phi), color='k', fontsize=20)
        ax2.legend(loc='lower right')

    ax2.set_xlabel('x', fontsize=14)
    ax2.set_ylabel('y', fontsize=14)

    gg.savefig('test-plot-beta-l1-%s-zoomed.png' % cmt)
    gg.show()