Пример #1
0
    def flip_cluster_at(self, x, y):
        """ Flip the cluster to which the site at (x,y) belongs to and update the mean cluster orientation"""
        self.pvprev = o2v.plaquettevorticity_vec(self.dofs)

        clid = self.isinc[int(round(y)), int(round(x))]
        self.dofs[self.isinc == clid] = pw.flip_dofs_1d(
            self.dofs[self.isinc == clid], self.wn)
        self.clo[self.isinc == clid] = -self.clo[self.isinc == clid]
        self.pv = o2v.plaquettevorticity_vec(self.dofs)
        self.freevs = o2v.completely_free_vortex_locations(
            self.dofs, self.isinc, self.wn)
Пример #2
0
 def mc_update(self, ntimes=1):
     """performs ntimes multicluster updates and updates the mean cluster orientation"""
     pw.mc_update(self.dofs, self.beta, ntimes=ntimes)
     self.wn = pw.random_unit_vector()
     self.isinc = pw.assign_clusters(self.dofs, self.beta, self.wn)
     self.clo = self.clo_from_dofs()
     self.pv = o2v.plaquettevorticity_vec(self.dofs)
     self.freevs = o2v.completely_free_vortex_locations(
         self.dofs, self.isinc, self.wn)
Пример #3
0
    def onkey(self, event):
        if event.key in self.bgplotcmds.keys():
            self.background = event.key
            self.update_background()

        if event.key in self.layers.keys():
            self.layers[event.key].toggle(event)

        if event.key == 'alt+B':
            self.layers['alt+b'].remove_all()

        if event.key == 'alt+C':
            self.layers['alt+c'].remove_all()

        if event.key == 'u':
            self.mc_update()
            self.update_background()
            self.update_layers()
            self.set_title()

        if event.key == 'r':
            self.mc_update(ntimes=20)
            self.update_background()
            self.update_layers()
            self.set_title()

        if event.key == 'R':
            self.flip_to_refconv()
            self.update_background()
            self.update_layers()
            self.set_title()

        if event.key == 'up':
            self.beta += 0.1
            self.set_title()
        if event.key == 'down':
            self.beta -= 0.1
            self.set_title()
        if event.key == 'm':
            pw.metropolis_update(self.dofs,
                                 self.beta,
                                 nsteps=np.prod(self.isinc.shape) * 100)
            self.pv = o2v.plaquettevorticity_vec(self.dofs)
            self.update_background()
            self.update_layers()

        if event.key == 'alt+g':
            o2hvg.show_hvbdrygraph(self.dofs, self.isinc, self.wn)

        if event.key == 'alt+h':
            o2hvg.show_geometricvbdrygraph(self.dofs, self.isinc, self.wn)
Пример #4
0
    def __init__(self, beta=1., l=40, dofs=None, wn=pw.random_unit_vector()):

        if dofs is None:
            dofs = pw.random_dofs(l, l)
        self.bgplotcmds = {
            'alt+o': self.update_cloplot,
            'alt+i': self.plot_isinc,
            'alt+s': self.plot_orientation,
            'alt+l': self.plot_lic
        }

        self.background = list(self.bgplotcmds.keys())[0]

        self.dofs = dofs
        self.beta = beta
        self.wn = wn
        self.isinc = pw.assign_clusters(dofs, beta, wn)

        self.clo = self.clo_from_dofs()
        self.pv = o2v.plaquettevorticity_vec(self.dofs)
        self.freevs = o2v.completely_free_vortex_locations(
            self.dofs, self.isinc, self.wn)

        #self.show_dof_quiver = False

        plt.ion()
        fig, ax = plt.subplots()

        self.axis = ax

        self.set_title()
        self.clplot = ax.imshow(self.clo.transpose(),
                                cmap='coolwarm',
                                origin='lower')

        self.layers = {
            'alt+q': QuiverLayer(self),
            'alt+b': BoundaryLayer(self),
            'alt+1': BondOrientationsLayer(self),
            'alt+2': AllBoundariesLayer(self),
            'alt+3': HalfVortexLayer(self),
            'alt+4': OrientedCoverHLayer(self),
            'alt+5': WindingNumbersLayer(self),
            'alt+6': CrossingBondOrientaitonsLayer(self),
            'alt+7': RectCrossingBondOrientaitonsLayer(self),
            'alt+8': CoordinateCrossingLayer(self),
            'alt+c': BoundaryContourLayer(self),
            'alt+v': VortexLayer(self),
            'alt+d': VortexChangeLayer(self)
        }

        layersdocstr = "\n".join([
            '\t {} : {}'.format(key, layer.description)
            for key, layer in self.layers.items()
        ])
        print(self.manual.format(layersdocstr))

        self.clplot.set_clim(-1, 1)
        plt.subplots_adjust(right=0.7)

        cid = fig.canvas.mpl_connect('button_press_event', self.onclick)
        cid2 = fig.canvas.mpl_connect('key_press_event', self.onkey)
        plt.show()
Пример #5
0
 def flip_to_refconv(self):
     refconf = get_reference_configuration(self.dofs, self.isinc, self.wn)
     self.dofs = refconf
     self.clo = self.clo_from_dofs()
     self.pv = o2v.plaquettevorticity_vec(self.dofs)