Esempio n. 1
0
def run():
    #############
    #defaults
    ##########

    bigCdefault = 110
    smallCdefault = 30

    layoutLineColor = 'mediumblue'
    layoutCapColor = 'goldenrod'

    FWlinkAlpha = 0.7
    FWsiteAlpha = 0.6

    HWlinkAlpha = 0.8
    HWsiteAlpha = 0.6

    FWlinkColor = 'dodgerblue'
    FWsiteColor = 'lightsteelblue'
    FWsiteEdgeColor = 'mediumblue'

    HWlinkColor = 'lightsteelblue'
    HWminusLinkColor = 'b'
    HWsiteColor = 'lightgrey'
    HWsiteEdgeColor = 'midnightblue'

    stateColor1 = 'gold'
    stateEdgeColor1 = 'darkgoldenrod'
    stateEdgeWidth1 = 1.25

    stateColor2 = 'firebrick'
    stateEdgeColor2 = 'maroon'
    stateEdgeWidth2 = 1

    DefaultFig = True
    if DefaultFig:
        fig444 = pylab.figure(444)
        pylab.clf()

        testEuclidLattice = EuclideanLayout(3,
                                            3,
                                            lattice_type='kagome',
                                            modeType='FW')
        kagomeLattice = GeneralLayout(testEuclidLattice.get_all_resonators(),
                                      modeType=testEuclidLattice.modeType,
                                      name=testEuclidLattice.lattice_type)

        testEuclidLattice = EuclideanLayout(3,
                                            3,
                                            lattice_type='kagome',
                                            modeType='HW')
        kagomeLatticeHW = GeneralLayout(testEuclidLattice.get_all_resonators(),
                                        modeType=testEuclidLattice.modeType,
                                        name=testEuclidLattice.lattice_type)

        red = [3, 5, 13, 18, 20, 21, 24, 32, 33, 35]
        yellow = [4, 8, 9, 19, 22, 25, 31, 36, 34, 37]

        red2 = [9, 12, 15, 0, 18, 27, 34]
        yellow2 = [10, 13, 16, 5, 14, 23]

        ####layout graph
        ax1 = pylab.subplot(1, 5, 1, adjustable='box', aspect=1)
        pylab.cla()
        kagomeLattice.draw_resonator_lattice(ax1,
                                             color=layoutLineColor,
                                             alpha=1,
                                             linewidth=2.5)
        #testLattice.draw_resonator_end_points(ax, color = 'goldenrod', edgecolor = 'k',  marker = 'o' , size = 30)
        xs = kagomeLattice.coords[:, 0]
        ys = kagomeLattice.coords[:, 1]
        pylab.sca(ax1)
        pylab.scatter(xs,
                      ys,
                      c=layoutCapColor,
                      s=smallCdefault,
                      marker='o',
                      edgecolors='k',
                      zorder=5)
        #ax.set_aspect('equal')
        ax1.axis('off')
        pylab.title('layout')

        ax2 = pylab.subplot(1, 5, 2, adjustable='box', aspect=1)
        pylab.cla()
        kagomeLattice.draw_SDlinks(ax2,
                                   color=FWlinkColor,
                                   linewidth=3,
                                   minus_links=True,
                                   minus_color='gold',
                                   alpha=1)
        pylab.sca(ax2)
        pylab.scatter(kagomeLattice.SDx,
                      kagomeLattice.SDy,
                      c=FWsiteColor,
                      s=smallCdefault,
                      marker='o',
                      edgecolors=FWsiteEdgeColor,
                      zorder=5,
                      alpha=1)
        pylab.title('FW lattice')
        ax2.set_aspect('equal')
        ax2.axis('off')

        ax3 = pylab.subplot(1, 5, 3, adjustable='box', aspect=1)
        pylab.cla()
        kagomeLatticeHW.draw_SDlinks(ax3,
                                     color=HWlinkColor,
                                     linewidth=3,
                                     minus_links=True,
                                     minus_color=HWminusLinkColor,
                                     alpha=1)
        pylab.sca(ax3)
        pylab.scatter(kagomeLatticeHW.SDx,
                      kagomeLatticeHW.SDy,
                      c=HWsiteColor,
                      s=smallCdefault,
                      marker='o',
                      edgecolors=HWsiteEdgeColor,
                      zorder=5,
                      alpha=1)
        pylab.title('HW lattice')
        ax3.set_aspect('equal')
        ax3.axis('off')

        ax4 = pylab.subplot(1, 5, 4, adjustable='box', aspect=1)
        pylab.cla()
        kagomeLattice.draw_SDlinks(ax4,
                                   color=FWlinkColor,
                                   linewidth=3,
                                   minus_links=True,
                                   minus_color='gold',
                                   alpha=FWlinkAlpha)
        pylab.sca(ax4)
        pylab.scatter(kagomeLattice.SDx,
                      kagomeLattice.SDy,
                      c=FWsiteColor,
                      s=smallCdefault,
                      marker='o',
                      edgecolors=FWsiteEdgeColor,
                      zorder=5,
                      alpha=FWsiteAlpha)
        pylab.scatter(kagomeLattice.SDx[yellow],
                      kagomeLattice.SDy[yellow],
                      c=stateColor1,
                      s=bigCdefault,
                      marker='o',
                      edgecolors=stateEdgeColor1,
                      zorder=5,
                      linewidth=stateEdgeWidth1)
        pylab.scatter(kagomeLattice.SDx[red],
                      kagomeLattice.SDy[red],
                      c=stateColor2,
                      s=bigCdefault,
                      marker='o',
                      edgecolors=stateEdgeColor2,
                      zorder=5,
                      linewidth=stateEdgeWidth2)
        pylab.title('FW state')
        ax4.set_aspect('equal')
        ax4.axis('off')

        ax5 = pylab.subplot(1, 5, 5, adjustable='box', aspect=1)
        pylab.cla()
        kagomeLatticeHW.draw_SDlinks(ax5,
                                     color=HWlinkColor,
                                     linewidth=3,
                                     minus_links=True,
                                     minus_color=HWminusLinkColor,
                                     alpha=HWlinkAlpha)
        pylab.sca(ax5)
        pylab.scatter(kagomeLatticeHW.SDx,
                      kagomeLatticeHW.SDy,
                      c=HWsiteColor,
                      s=smallCdefault,
                      marker='o',
                      edgecolors=HWsiteEdgeColor,
                      zorder=5,
                      alpha=HWsiteAlpha)
        pylab.scatter(kagomeLatticeHW.SDx[yellow],
                      kagomeLatticeHW.SDy[yellow],
                      c=stateColor1,
                      s=bigCdefault,
                      marker='o',
                      edgecolors=stateEdgeColor1,
                      zorder=5,
                      linewidth=stateEdgeWidth1)
        pylab.scatter(kagomeLatticeHW.SDx[red],
                      kagomeLatticeHW.SDy[red],
                      c=stateColor2,
                      s=bigCdefault,
                      marker='o',
                      edgecolors=stateEdgeColor2,
                      zorder=5,
                      linewidth=stateEdgeWidth2)
        pylab.title('HW state')
        ax5.set_aspect('equal')
        ax5.axis('off')

        #    pylab.suptitle('Defaults')
        fig444.set_size_inches(14.5, 3.5)
        pylab.tight_layout()
    else:
        pass

    ###############
    #make a unit cell
    cell = UnitCell('PeterChain')

    cell.a1
    cell.a2
    cell.resonators  #(x0,y0)  (x1,y1)

    pylab.figure(1)
    pylab.clf()

    ax = pylab.subplot(1, 3, 1)
    cell.draw_resonators(ax, linewidth=2, color='mediumblue')
    cell.draw_resonator_end_points(ax,
                                   color='goldenrod',
                                   edgecolor='k',
                                   marker='o',
                                   size=80)
    #cell.draw_site_orientations(ax)
    ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('resonators')

    ax = pylab.subplot(1, 3, 2)
    cell.draw_SDlinks(ax,
                      color='firebrick',
                      linewidth=2.5,
                      minus_color='goldenrod')
    ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('links')

    ax = pylab.subplot(1, 3, 3)
    cell.draw_resonators(ax, linewidth=2, color='mediumblue')
    cell.draw_resonator_end_points(ax,
                                   color='goldenrod',
                                   edgecolor='k',
                                   marker='o',
                                   size=80)
    cell.draw_SDlinks(ax,
                      color='firebrick',
                      linewidth=2.5,
                      minus_color='goldenrod')
    #cell.draw_site_orientations(ax)
    ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('links')

    pylab.show()

    ###################
    #make a 1D lattice (not periodic boundary conditions)
    testLattice = EuclideanLayout(4,
                                  1,
                                  lattice_type='PeterChain',
                                  modeType='FW')
    #testLattice = EuclideanLayout(3,1,lattice_type = 'PeterChain', modeType = 'HW')
    genlattice = GeneralLayout(testLattice.resonators,
                               modeType=testLattice.modeType)

    pylab.figure(2)
    pylab.clf()

    ax = pylab.subplot(1, 3, 1)
    testLattice.draw_resonator_lattice(ax, linewidth=2, color='mediumblue')
    testLattice.draw_resonator_end_points(ax,
                                          color='goldenrod',
                                          edgecolor='k',
                                          marker='o',
                                          size=80)
    #testLattice.draw_site_orientations(ax)
    #ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('resonators')

    ax = pylab.subplot(1, 3, 2)
    testLattice.draw_resonator_lattice(ax, linewidth=2, color='mediumblue')
    #testLattice.draw_resonator_end_points(ax, color = 'goldenrod', edgecolor = 'k',  marker = 'o' , size = 80)
    testLattice.draw_SDlinks(ax,
                             color='firebrick',
                             linewidth=2.5,
                             minus_color='goldenrod',
                             minus_links=True)
    testLattice.plot_end_layout_state(0.35 * numpy.ones(len(testLattice.SDx)),
                                      ax,
                                      title='',
                                      colorbar=False,
                                      plot_links=False,
                                      cmap='Wistia',
                                      scaleFactor=0.5)
    ax.axis('off')
    pylab.title('links')

    ax = pylab.subplot(1, 3, 3)
    testLattice.draw_SDlinks(ax,
                             color='firebrick',
                             linewidth=0.5,
                             minus_color='goldenrod',
                             minus_links=True)
    #testLattice.plot_layout_state(0.5*numpy.ones(len(testLattice.SDx)), ax, title = '', colorbar = False, plot_links = False, cmap = 'Wistia')

    state = testLattice.Psis[:, -2]
    testLattice.plot_layout_state(state,
                                  ax,
                                  title='',
                                  colorbar=False,
                                  plot_links=False,
                                  cmap='Wistia')

    ax.axis('off')

    pylab.tight_layout()
    pylab.show()

    ##############
    #compute a simple band structure
    cellModeType = 'FW'

    cell2 = UnitCell('PeterChain_tail', side=1)

    #band structure
    numSurfPoints = 300
    kx_x, ky_y, cutx = cell.compute_band_structure(-2 * numpy.pi,
                                                   0,
                                                   2 * numpy.pi,
                                                   0,
                                                   numsteps=numSurfPoints,
                                                   modeType=cellModeType)
    #kx_y, ky_y, cuty = cell.compute_band_structure(0, -2.5*numpy.pi, 0, 2.5*numpy.pi, numsteps = numSurfPoints, modeType = cellModeType)
    kx_x, ky_y, cutx2 = cell2.compute_band_structure(-2 * numpy.pi,
                                                     0,
                                                     2 * numpy.pi,
                                                     0,
                                                     numsteps=numSurfPoints,
                                                     modeType=cellModeType)
    #kx_y, ky_y, cuty2 = cell2.compute_band_structure(0, -2.5*numpy.pi, 0, 2.5*numpy.pi, numsteps = numSurfPoints, modeType = cellModeType)

    pylab.figure(3)
    pylab.clf()

    ax = pylab.subplot(1, 4, 1)
    cell.draw_resonators(ax, linewidth=2, color='mediumblue')
    cell.draw_resonator_end_points(ax,
                                   color='goldenrod',
                                   edgecolor='k',
                                   marker='o',
                                   size=80)
    #cell.draw_site_orientations(ax)
    ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('resonators')

    ax = pylab.subplot(1, 4, 2)
    pylab.cla()
    cell.plot_band_cut(ax, cutx)
    pylab.title('')
    pylab.ylabel('Energy (|t|)')
    pylab.xlabel('$k_x$ ($\pi$/a)')
    pylab.xticks([0, cutx.shape[1] / 2, cutx.shape[1]], [-2.5, 0, 2.5],
                 rotation='horizontal')

    ax = pylab.subplot(1, 4, 3)
    cell2.draw_resonators(ax, linewidth=2, color='mediumblue')
    cell2.draw_resonator_end_points(ax,
                                    color='goldenrod',
                                    edgecolor='k',
                                    marker='o',
                                    size=80)
    #cell.draw_site_orientations(ax)
    ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('resonators')

    ax = pylab.subplot(1, 4, 4)
    pylab.cla()
    cell.plot_band_cut(ax, cutx2)
    pylab.title('')
    pylab.ylabel('Energy (|t|)')
    pylab.xlabel('$k_x$ ($\pi$/a)')
    pylab.xticks([0, cutx.shape[1] / 2, cutx.shape[1]], [-2.5, 0, 2.5],
                 rotation='horizontal')

    pylab.suptitle('Basic Band Structures')
    pylab.show()

    ###############
    #decorate and compute
    ##########

    squareLattice = EuclideanLayout(4, 4, lattice_type='square', modeType='FW')
    #squareLattice = EuclideanLayout(4,4,lattice_type = 'kagome', modeType = 'FW')

    squareResonators = squareLattice.resonators
    peterResonators = cell.resonators
    peterResonators2 = cell2.resonators

    decorated_resonators = decorate_layout(squareResonators, peterResonators2)
    resonators = decorated_resonators
    decoratedLattice2 = GeneralLayout(resonators,
                                      modeType=squareLattice.modeType,
                                      name='Peter2_square')

    decorated_resonators = decorate_layout(squareResonators, peterResonators)
    resonators = decorated_resonators
    decoratedLattice = GeneralLayout(resonators,
                                     modeType=squareLattice.modeType,
                                     name='Peter_square')

    testLattice = decoratedLattice2

    #need a new cell
    decorated_cell_resonators = decorate_layout(
        squareLattice.unitcell.resonators, peterResonators2)
    #peterSquareCell = UnitCell('peterSquare',resonators = decorated_cell_resonators, a1 = cell2.a1, a2 = cell2.a2)
    peterSquareCell = UnitCell(resonators=decorated_cell_resonators,
                               a1=squareLattice.unitcell.a1,
                               a2=squareLattice.unitcell.a2,
                               lattice_type='peterSquare')

    ##cell0 = UnitCell('kagome')
    ##cell0 = UnitCell('square')
    #cell0 = squareLattice.unitcell
    #decCell = UnitCell('PeterChain_tail', side = 1)
    #res0 = cell0.resonators
    ##res1 = decorate_layout(res0, decCell.resonators)
    ##res1 = decorate_layout(res0, peterResonators2)
    #res1 = decorate_layout(squareLattice.unitcell.resonators, peterResonators2)
    #testCell = UnitCell('Peter_graphene', resonators = res1, a1 = cell0.a1, a2 = cell0.a2)
    #peterSquareCell = testCell

    #band structure
    numSurfPoints = 300
    #kx_x, ky_y, cutx = peterSquareCell.compute_band_structure(-2*numpy.pi, 0, 2*numpy.pi, 0, numsteps = numSurfPoints, modeType = cellModeType)
    #kx_y, ky_y, cuty = peterSquareCell.compute_band_structure(0, -2.5*numpy.pi, 0, 2.5*numpy.pi, numsteps = numSurfPoints, modeType = cellModeType)

    #kx_x, ky_y, cutx = peterSquareCell.compute_band_structure(-2*numpy.pi, numpy.pi, 2*numpy.pi, numpy.pi, numsteps = numSurfPoints, modeType = cellModeType)
    #kx_y, ky_y, cuty = peterSquareCell.compute_band_structure(-numpy.pi, -2.5*numpy.pi, numpy.pi, 2.5*numpy.pi, numsteps = numSurfPoints, modeType = cellModeType)

    kx_x, ky_y, cutx = peterSquareCell.compute_band_structure(
        -2 * numpy.pi,
        -2 * numpy.pi,
        2 * numpy.pi,
        2 * numpy.pi,
        numsteps=numSurfPoints,
        modeType=cellModeType)
    kx_y, ky_y, cuty = peterSquareCell.compute_band_structure(
        -2 * numpy.pi,
        2 * numpy.pi,
        2 * numpy.pi,
        -2 * numpy.pi,
        numsteps=numSurfPoints,
        modeType=cellModeType)

    pylab.figure(4)
    pylab.clf()

    ax = pylab.subplot(1, 4, 1)
    pylab.cla()
    squareLattice.draw_resonator_lattice(ax,
                                         color=layoutLineColor,
                                         alpha=1,
                                         linewidth=2.5)
    #testLattice.draw_resonator_end_points(ax, color = 'goldenrod', edgecolor = 'k',  marker = 'o' , size = 30)
    xs = squareLattice.coords[:, 0]
    ys = squareLattice.coords[:, 1]
    pylab.sca(ax)
    pylab.scatter(xs,
                  ys,
                  c=layoutCapColor,
                  s=smallCdefault,
                  marker='o',
                  edgecolors='k',
                  zorder=5)
    #ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('square')

    ax = pylab.subplot(1, 4, 2)
    pylab.cla()
    testLattice.draw_resonator_lattice(ax,
                                       color=layoutLineColor,
                                       alpha=1,
                                       linewidth=2.5)
    #peterSquareCell.draw_resonators(ax)
    #testLattice.draw_resonator_end_points(ax, color = 'goldenrod', edgecolor = 'k',  marker = 'o' , size = 30)
    xs = testLattice.coords[:, 0]
    ys = testLattice.coords[:, 1]
    pylab.sca(ax)
    pylab.scatter(xs,
                  ys,
                  c=layoutCapColor,
                  s=smallCdefault,
                  marker='o',
                  edgecolors='k',
                  zorder=5)
    #ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('decorated square')

    ax = pylab.subplot(1, 4, 3)
    pylab.cla()
    peterSquareCell.plot_band_cut(ax, cutx)
    pylab.title('')
    pylab.ylabel('Energy (|t|)')
    pylab.xlabel('$k_x$ ($\pi$/a)')
    pylab.xticks([0, cutx.shape[1] / 2, cutx.shape[1]], [-2.5, 0, 2.5],
                 rotation='horizontal')
    #ax.set_ylim([-2.5, 4])

    ax = pylab.subplot(1, 4, 4)
    pylab.cla()
    peterSquareCell.plot_band_cut(ax, cuty)
    pylab.title('')
    pylab.ylabel('Energy (|t|)')
    pylab.xlabel('$k_y$ ($\pi$/a)')
    pylab.xticks([0, cutx.shape[1] / 2, cutx.shape[1]], [-2.5, 0, 2.5],
                 rotation='horizontal')
    #ax.set_ylim([-2.5, 4])

    pylab.show()
def run():
    #######hyperbolic
    #test1 = PlanarLayout(gon = 7, vertex = 3, side =1, radius_method = 'lin', modeType = 'FW')
    #test1.populate(2, resonatorsOnly=False)
    #resonators = test1.get_all_resonators()
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  '7gon_3vertex_2')
    
    #######single ring
    #test1 = PlanarLayout(gon = 7, vertex = 3, side =1, radius_method = 'lin', modeType = 'FW')
    #test1.populate(2, resonatorsOnly=False)
    #resonators = test1.get_all_resonators()
    #resonators = resonators[0:test1.gon, :]
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'ring')
    
    #######split hyperbolic
    #test1 = PlanarLayout(gon = 7, vertex = 3, side =1, radius_method = 'lin')
    #test1.populate(2, resonatorsOnly=False)
    #resonators = test1.get_all_resonators()
    #splitGraph = split_resonators(resonators)
    #resonators = splitGraph
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'split7gon_3vertex_2')
    #
    #######Euclidean
    #test1 = EuclideanLayout(3,3,lattice_type = 'kagome', modeType = 'FW')
    #resonators = test1.resonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'kagome')
    
    #######Euclidean
    #test1 = EuclideanLayout(4,4,lattice_type = 'square', modeType = 'FW')
    #resonators = test1.resonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'square')
    
    #######Euclidean
    ##test1 = EuclideanLayout(4,3,lattice_type = 'Huse', modeType = 'FW')
    #test1 = EuclideanLayout(3,2,lattice_type = 'Huse', modeType = 'FW')
    #resonators = test1.resonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'Huse')
    
    
    #######tree
    #test1 = TreeResonators(degree = 3, iterations = 5, side = 1, file_path = '', modeType = 'FW')
    #resonators = test1.get_all_resonators()
    ###Tree2 = TreeResonators(file_path = '3regularTree_ 3_.pkl')
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'TREEEEE')
    
    
    #######split tree
    #test1 = TreeResonators(degree = 3, iterations = 4, side = 1, file_path = '', modeType = 'FW')
    #resonators = test1.get_all_resonators()
    #splitGraph = split_resonators(resonators)
    #resonators = splitGraph
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'McLaughlinTree')
    
    #######line graph of split tree
    #test1 = TreeResonators(degree = 3, iterations = 4, side = 1, file_path = '', modeType = 'FW')
    #resonators = test1.get_all_resonators()
    #splitGraph = split_resonators(resonators)
    #resonators = splitGraph
    #LGresonators = generate_line_graph(resonators)
    #resonators = LGresonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'LG_McLaughlinTree')
    
        
    ########split Euclidean
    #test1 = EuclideanLayout(3,2,lattice_type = 'kagome', modeType = 'FW')
    #resonators = test1.resonators
    #splitGraph = split_resonators(resonators)
    #resonators = splitGraph
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'Splitkagome')
    
    ########split Euclidean
    #test1 = EuclideanLayout(3,3,lattice_type = 'square', modeType = 'FW')
    #resonators = test1.resonators
    #splitGraph = split_resonators(resonators)
    #resonators = splitGraph
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'SplitSquare')
    
    #########split Euclidean, hoffman attemps
    #test1 = EuclideanLayout(3,3,lattice_type = 'kagome', modeType = 'FW')
    #resonators0 = test1.resonators #graphene layout
    #splitGraph = split_resonators(resonators0) #split graphene layout
    #resonators1 = generate_line_graph(splitGraph) #McLaughlin-esque kagome
    #resonators2 = split_resonators(resonators1) #split further
    #resonators = resonators2
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'hofmannAttempt')
    
    #########split Euclidean, hoffman attemps
    #test1 = EuclideanLayout(3,3,lattice_type = 'kagome', modeType = 'FW')
    #resonators0 = test1.resonators #graphene layout
    #splitGraph = split_resonators(resonators0) #split graphene layout
    #resonators1 = generate_line_graph(splitGraph) #McLaughlin-esque kagome
    #resonators2 = split_resonators(resonators1) #split further
    #resonators3 = generate_line_graph(resonators2)
    #resonators = resonators3
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'L(hofmannAttempt)')
    
    
    
    ########split Euclidean 1.5 (n-way split)
    #splitIn = 3
    #test1 = EuclideanLayout(3,2,lattice_type = 'kagome', modeType = 'FW')
    #resonators = test1.resonators
    #splitGraph = split_resonators(resonators, splitIn = splitIn)
    #resonators = splitGraph
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  str(splitIn) + 'SplitGraphene')
    
    ########split Euclidean2
    #test1 = EuclideanLayout(3,2,lattice_type = 'Huse', modeType = 'FW')
    #resonators = test1.resonators
    #splitGraph = split_resonators(resonators)
    #resonators = splitGraph
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'split_HPG')
    
    
    ########line graph of Euyclidean
    #test1 = EuclideanLayout(4,4,lattice_type = 'kagome', modeType = 'FW')
    #resonators = test1.resonators
    #LGresonators = generate_line_graph(resonators)
    #resonators = LGresonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'LG_kagome')
    
    ########line graph of Euyclidean2
    #test1 = EuclideanLayout(3,2,lattice_type = 'Huse', modeType = 'FW')
    #resonators = test1.resonators
    #LGresonators = generate_line_graph(resonators)
    #resonators = LGresonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'LG_Huse')
    
    ########line graph of line graph of Euyclidean
    #test1 = EuclideanLayout(2,2,lattice_type = 'kagome', modeType = 'FW')
    #resonators = test1.resonators
    #LGresonators = generate_line_graph(resonators)
    #resonators = LGresonators
    #LGresonators = generate_line_graph(resonators)
    #resonators = LGresonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'LG_LG_kagome')
    
    
    ######non-trivial tree
    #test1 = TreeResonators(cell ='Peter', degree = 3, iterations = 3, side = 1, file_path = '', modeType = 'FW')
    #resonators = test1.get_all_resonators()
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'PeterTREEEEE')
    #
    #######non-trivial tree, 2
    #test1 = TreeResonators(cell ='', degree = 3, iterations = 3, side = 1, file_path = '', modeType = 'FW')
    #ucell = UnitCell('PeterChain_tail', side = 1)
    #resonators = test1.get_all_resonators()
    #decorated_resonators = decorate_layout(resonators, ucell.resonators)
    #resonators = decorated_resonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'PeterTREEEEE2')
    #
    #########decorated Euyclidean
    #test1 = EuclideanLayout(3,3,lattice_type = 'kagome', modeType = 'FW')
    #ucell = UnitCell('PeterChain_tail', side = 1)
    #resonators = test1.resonators
    #decorated_resonators = decorate_layout(resonators, ucell.resonators)
    #resonators = decorated_resonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'Peter-graphene')
    #
    #########decorated Euyclidean
    #test1 = EuclideanLayout(3,3,lattice_type = 'kagome', modeType = 'FW')
    #ucell = UnitCell('PeterChain_tail', side = 1)
    #resonators = test1.resonators
    #LGresonators = generate_line_graph(resonators)
    #resonators = LGresonators
    #decorated_resonators = decorate_layout(resonators, ucell.resonators)
    #resonators = decorated_resonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'Peter-kagome')
    #
    #########decorated Euyclidean
    #test1 = EuclideanLayout(3,2,lattice_type = 'Huse', modeType = 'FW')
    #ucell = UnitCell('PeterChain_tail', side = 1)
    #resonators = test1.resonators
    #decorated_resonators = decorate_layout(resonators, ucell.resonators)
    #resonators = decorated_resonators
    #testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'Peter-HPG')
    #
    #
    ######decorated hyperbolic
    test1 = PlanarLayout(gon = 7, vertex = 3, side =1, radius_method = 'lin')
    test1.populate(2, resonatorsOnly=False)
    #resonators = test1.get_all_resonators()
    #splitGraph = split_resonators(resonators)
    #resonators = splitGraph
    ucell = UnitCell('PeterChain_tail', side = 1)
    resonators = test1.get_all_resonators()
    decorated_resonators = decorate_layout(resonators, ucell.resonators)
    resonators = decorated_resonators
    testLattice = GeneralLayout(resonators , modeType = test1.modeType, name =  'decorated_hyperbolic')
    
    
        
    
    
    ######
    #plot results
    ######
    
    
    
    
    
    fig1 = pylab.figure(1)
    pylab.clf()
    ax = pylab.subplot(1,1,1)
    testLattice.draw_resonator_lattice(ax, color = 'mediumblue', alpha = 1 , linewidth = 2.5)
    testLattice.draw_SDlinks(ax, color = 'deepskyblue', linewidth = 1.5, minus_links = True, minus_color = 'firebrick')
    xs = testLattice.coords[:,0]
    ys = testLattice.coords[:,1]
    pylab.sca(ax)
    #pylab.scatter(xs, ys ,c =  'goldenrod', s = 20, marker = 'o', edgecolors = 'k', zorder = 5)
    pylab.scatter(xs, ys ,c =  'goldenrod', s = 30, marker = 'o', edgecolors = 'k', zorder = 5)
    #pylab.scatter(xs, ys ,c =  'goldenrod', s = 40, marker = 'o', edgecolors = 'k', zorder = 5)
    ax.set_aspect('equal')
    ax.axis('off')
    pylab.title(testLattice.name)
    fig1.set_size_inches(5, 5)
    pylab.tight_layout()
    pylab.show()
    
    
    eigNum = 168
    eigNum = 167
    eigNum = 0
    
    pylab.figure(2)
    pylab.clf()
    ax = pylab.subplot(1,2,1)
    pylab.imshow(testLattice.H,cmap = 'winter')
    pylab.title('Hamiltonian')
    ax = pylab.subplot(1,2,2)
    pylab.imshow(testLattice.H - numpy.transpose(testLattice.H),cmap = 'winter')
    pylab.title('H - Htranspose')
    pylab.suptitle(testLattice.name)
    pylab.show()
    
    
    
    xs = numpy.arange(0,len(testLattice.Es),1)
    eigAmps = testLattice.Psis[:,testLattice.Eorder[eigNum]]
    
    pylab.figure(3)
    pylab.clf()
    ax1 = pylab.subplot(1,2,1)
    pylab.plot(testLattice.Es, 'b.')
    pylab.plot(xs[eigNum],testLattice.Es[testLattice.Eorder[eigNum]], color = 'firebrick' , marker = '.', markersize = '10' )
    pylab.title('eigen spectrum')
    pylab.ylabel('Energy (t)')
    pylab.xlabel('eigenvalue number')
    
    ax2 = pylab.subplot(1,2,2)
    titleStr = 'eigenvector weight : ' + str(eigNum)
    testLattice.plot_layout_state(eigAmps, ax2, title = titleStr, colorbar = True, plot_links = True, cmap = 'Wistia')
    
    pylab.suptitle(testLattice.name)
    pylab.show()
    
    
    
    
    ########teting vertex finding codes
    ##vertexInd = 11
    #vertexInd = int(numpy.floor(testLattice.coords.shape[0]/2.))
    #
    #fig4 = pylab.figure(4)
    #pylab.clf()
    #ax = pylab.subplot(1,1,1)
    #testLattice.draw_resonator_lattice(ax, color = 'mediumblue', alpha = 1 , linewidth = 2.5)
    #testLattice.draw_SDlinks(ax, color = 'deepskyblue', linewidth = 1.5, minus_links = True, minus_color = 'goldenrod')
    #
    ##newCoords = get_coords(testLattice.resonators)
    #vertexx = testLattice.coords[vertexInd,0]
    #vertexy = testLattice.coords[vertexInd,1]
    #pylab.scatter(vertexx, vertexy ,c =  'firebrick', s = 200, marker = 'o', edgecolors = 'k', zorder = 0, alpha = 1)
    #
    ##testLattice.generate_vertex_dict()
    #connectedResonators = testLattice.vertexDict[vertexInd]
    #for rind in connectedResonators:
    #    [x0,y0,x1,y1] = testLattice.resonators[rind]
    #    pylab.plot([x0, x1],[y0, y1] , color = 'gold', linewidth = 4, alpha = 1, zorder = 10)
    #
    #xs = testLattice.coords[:,0]
    #ys = testLattice.coords[:,1]
    #pylab.sca(ax)
    #pylab.scatter(xs, ys ,c =  'goldenrod', s = 34, marker = 'o', edgecolors = 'k', zorder = 5)
    #
    #
    #ax.set_aspect('equal')
    #ax.axis('off')
    #pylab.title('checking vertex dictionary : ' + testLattice.name)
    #fig1.set_size_inches(5, 5)
    #pylab.tight_layout()
    #pylab.show()
    
    
    
    
    
    
    fig5 = pylab.figure(5)
    pylab.clf()
    ax = pylab.subplot(1,2,1)
    pylab.cla()
    testLattice.draw_resonator_lattice(ax, color = 'mediumblue', alpha = 1 , linewidth = 2.5)
    xs = testLattice.coords[:,0]
    ys = testLattice.coords[:,1]
    pylab.sca(ax)
    pylab.scatter(xs, ys ,c =  'goldenrod', s = 30, marker = 'o', edgecolors = 'k', zorder = 5)
    ax.set_aspect('equal')
    ax.axis('off')
    pylab.title('layout graph')
    
    
    ax2 = pylab.subplot(1,2,2)
    testLattice.draw_SDlinks(ax2, color = 'dodgerblue', linewidth = 2.5, minus_links = True, minus_color = 'gold')
    #testLattice.draw_SD_points(ax, color = 'mediumblue', edgecolor = 'goldenrod',  marker = 'o' , size = 30,  extra = False)
    pylab.sca(ax2)
    pylab.scatter(testLattice.SDx, testLattice.SDy ,c =  'lightsteelblue', s = 30, marker = 'o', edgecolors = 'mediumblue', zorder = 5)
    ax2.set_aspect('equal')
    ax2.axis('off')
    pylab.title('effective (line) graph')
    
    pylab.suptitle(testLattice.name)
    fig5.set_size_inches(10, 5)
    pylab.tight_layout()
    pylab.show()
    
    
    
    
    
    fig6 = pylab.figure(6)
    pylab.clf()
    ax = pylab.subplot(1,1,1)
    #testLattice.draw_resonator_lattice(ax, color = 'mediumblue', alpha = 1 , linewidth = 0.5)
    testLattice.draw_SDlinks(ax, color = 'firebrick', linewidth = 1., minus_links = True, minus_color = 'goldenrod')
    xs = testLattice.coords[:,0]
    ys = testLattice.coords[:,1]
    pylab.sca(ax)
    ##pylab.scatter(xs, ys ,c =  'goldenrod', s = 20, marker = 'o', edgecolors = 'k', zorder = 5)
    #pylab.scatter(xs, ys ,c =  'goldenrod', s = 30, marker = 'o', edgecolors = 'k', zorder = 5)
    ##pylab.scatter(xs, ys ,c =  'goldenrod', s = 40, marker = 'o', edgecolors = 'k', zorder = 5)
    ax.set_aspect('equal')
    ax.axis('off')
    #pylab.title(testLattice.name)
    pylab.tight_layout()
    pylab.show()