Exemplo n.º 1
0
 def load_embedding(self, fname, chimera_adj):
     ''' '''
     
     # create embedding
     embedding = Embedding()
     try:
         embedding.from_file(fname, self.chimera_file, chimera_adj)
         # set qca parameters
         self.qca_widget.updateCircuit(embedding.qca_file, embedding.full_adj)
         J, cells = self.qca_widget.prepareCircuit()
         embedding.set_qca(J, cells, embedding.full_adj)
     except:
         print('Failed to load embedding')
         return
     
     self.addEmbedding(embedding)
Exemplo n.º 2
0
    def embed_circuit(self):
        '''Run embedding on displayed circuit into selected chimera
        sub-graph'''

        print('Running embedding...')

        try:
            # get chimera sub-graph
            M, N, chimera_adj, active_range = self.chimera_widget.getActiveGraph(
            )

            # apply tile style
            chimera_adj, L = self.apply_tile_style(chimera_adj)

            # get qca parameters
            J, cells = self.qca_widget.prepareCircuit()

            # embedding object
            embedding = Embedding(self.qca_widget.filename)
            embedding.set_embedder(self.embed_method)
            embedding.set_chimera(chimera_adj, active_range, M, N)
            embedding.set_qca(J, cells, self.full_adj, self.qca_widget.spacing)

            # run embedding
            try:
                embedding.run_embedding()
            except Exception as e:
                if type(e).__name__ == 'KeyboardInterrupt':
                    print('Embedding interrupted...')
                else:
                    print('Something went wrong...')
                    print(traceback.print_exc())
                return
        except:
            print('\nUnexpected crash in embedding... possible disjoint graph')
            return

        if embedding.good:
            self.addEmbedding(embedding)
        else:
            print('Embedding failed...')
Exemplo n.º 3
0
    def embed_circuit(self):
        '''Run embedding on displayed circuit into selected chimera
        sub-graph'''

        print('Running embedding...')

        try:
            # get chimera sub-graph
            M, N, chimera_adj, active_range = self.chimera_widget.getActiveGraph()

            # apply tile style
            chimera_adj, L = self.apply_tile_style(chimera_adj)

            # get qca parameters
            J, cells = self.qca_widget.prepareCircuit()

            # embedding object
            embedding = Embedding(self.qca_widget.filename)
            embedding.set_embedder(self.use_dense)
            embedding.set_chimera(chimera_adj, active_range, M, N)
            embedding.set_qca(J, cells, self.full_adj)

            # run embedding
            try:
                embedding.run_embedding()
            except Exception as e:
                if type(e).__name__ == 'KeyboardInterrupt':
                    print('Embedding interrupted...')
                else:
                    print('Something went wrong...')
                return
        except:
            print('\nUnexpected crash in embedding... possible disjoint graph')
            return

        if embedding.good:
            self.addEmbedding(embedding)
        else:
            print('Embedding failed...')
Exemplo n.º 4
0
    def load_embedding(self, fname, chimera_adj):
        ''' '''

        # create embedding
        embedding = Embedding()
        try:
            embedding.from_file(fname, self.chimera_file, chimera_adj)
            # set qca parameters
            self.qca_widget.updateCircuit(embedding.qca_file,
                                          embedding.full_adj)
            J, cells = self.qca_widget.prepareCircuit()
            embedding.set_qca(J, cells, embedding.full_adj)
        except:
            print('Failed to load embedding')
            return

        self.addEmbedding(embedding)