qiskit/providers/basicaer/unitary_simulator.py
def _validate(self, qobj):
        """Semantic validations of the qobj which cannot be done via schemas.
        Some of these may later move to backend schemas.
        1. No shots
        2. No measurements in the middle
        """
        n_qubits = qobj.config.n_qubits
        max_qubits = self.configuration().n_qubits
        if n_qubits > max_qubits:
            raise BasicAerError('Number of qubits {} '.format(n_qubits) +
                                'is greater than maximum ({}) '.format(max_qubits) +
                                'for "{}".'.format(self.name()))
        if hasattr(qobj.config, 'shots') and qobj.config.shots != 1:
            logger.info('"%s" only supports 1 shot. Setting shots=1.',
                        self.name())
            qobj.config.shots = 1
        for experiment in qobj.experiments:
            name = experiment.header.name
            if getattr(experiment.config, 'shots', 1) != 1:
                logger.info('"%s" only supports 1 shot. '
                            'Setting shots=1 for circuit "%s".',
                            self.name(), name)
                experiment.config.shots = 1
            for operation in experiment.instructions:
                if operation.name in ['measure', 'reset']:
                    raise BasicAerError('Unsupported "%s" instruction "%s" ' +
                                        'in circuit "%s" ', self.name(),
                                        operation.name, name)
def _validate(self, qobj):
        n_qubits = qobj.config.n_qubits
        max_qubits = self.configuration().n_qubits
        if n_qubits > max_qubits:
            raise BasicAerError('Number of qubits {} '.format(n_qubits) +
                                'is greater than maximum ({}) '.format(max_qubits) +
                                'for "{}".'.format(self.name()))
        if hasattr(qobj.config, 'shots') and qobj.config.shots != 1:
            logger.info('"%s" only supports 1 shot. Setting shots=1.',
                        self.name())
            qobj.config.shots = 1
        for experiment in qobj.experiments:
            name = experiment.header.name
            if getattr(experiment.config, 'shots', 1) != 1:
                logger.info('"%s" only supports 1 shot. '
                            'Setting shots=1 for circuit "%s".',
                            self.name(), name)
                experiment.config.shots = 1
            for operation in experiment.instructions:
                if operation.name in ['measure', 'reset']:
                    raise BasicAerError('Unsupported "%s" instruction "%s" ' +
                                        'in circuit "%s" ', self.name(),
                                        operation.name, name)
def _validate ( self , qobj ) : n_qubits = qobj . config . n_qubits max_qubits = self . configuration ( ) . n_qubits if n_qubits > max_qubits : raise BasicAerError ( 'Number of qubits {} ' . format ( n_qubits ) + 'is greater than maximum ({}) ' . format ( max_qubits ) + 'for "{}".' . format ( self . name ( ) ) ) if hasattr ( qobj . config , 'shots' ) and qobj . config . shots != 1 : logger . info ( '"%s" only supports 1 shot. Setting shots=1.' , self . name ( ) ) qobj . config . shots = 1 for experiment in qobj . experiments : name = experiment . header . name if getattr ( experiment . config , 'shots' , 1 ) != 1 : logger . info ( '"%s" only supports 1 shot. ' 'Setting shots=1 for circuit "%s".' , self . name ( ) , name ) experiment . config . shots = 1 for operation in experiment . instructions : if operation . name in [ 'measure' , 'reset' ] : raise BasicAerError ( 'Unsupported "%s" instruction "%s" ' + 'in circuit "%s" ' , self . name ( ) , operation . name , name )
Semantic validations of the qobj which cannot be done via schemas.
        Some of these may later move to backend schemas.
        1. No shots
        2. No measurements in the middle
Semantic validations of the qobj which cannot be done via schemas . Some of these may later move to backend schemas . 1 . No shots 2 . No measurements in the middle