qiskit_nature/properties/second_quantization/electronic/particle_number.py
def interpret(self, result: EigenstateResult) -> None:
        """Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.

        Args:
            result: the result to add meaning to.
        """
        expected = self.num_alpha + self.num_beta
        result.num_particles = []

        if not isinstance(result.aux_operator_eigenvalues, list):
            aux_operator_eigenvalues = [result.aux_operator_eigenvalues]
        else:
            aux_operator_eigenvalues = result.aux_operator_eigenvalues  # type: ignore
        for aux_op_eigenvalues in aux_operator_eigenvalues:
            if aux_op_eigenvalues is None:
                continue

            if aux_op_eigenvalues[0] is not None:
                n_particles = aux_op_eigenvalues[0][0].real  # type: ignore
                result.num_particles.append(n_particles)

                if not np.isclose(n_particles, expected):
                    LOGGER.warning(
                        "The measured number of particles %s does NOT match the expected number of "
                        "particles %s!",
                        n_particles,
                        expected,
                    )
            else:
                result.num_particles.append(None)
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.

        Args:
            result: the result to add meaning to.
        
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
Interprets an : class : ~qiskit_nature . result . EigenstateResult in this property ' s context .
def interpret(self, result: EigenstateResult) -> None:
        expected = self.num_alpha + self.num_beta
        result.num_particles = []
        if not isinstance(result.aux_operator_eigenvalues, list):
            aux_operator_eigenvalues = [result.aux_operator_eigenvalues]
        else:
            aux_operator_eigenvalues = result.aux_operator_eigenvalues  
        for aux_op_eigenvalues in aux_operator_eigenvalues:
            if aux_op_eigenvalues is None:
                continue
            if aux_op_eigenvalues[0] is not None:
                n_particles = aux_op_eigenvalues[0][0].real  
                result.num_particles.append(n_particles)
                if not np.isclose(n_particles, expected):
                    LOGGER.warning(
                        "The measured number of particles %s does NOT match the expected number of "
                        "particles %s!",
                        n_particles,
                        expected,
                    )
            else:
                result.num_particles.append(None)
def interpret ( self , result : EigenstateResult ) -> None : expected = self . num_alpha + self . num_beta result . num_particles = [ ] if not isinstance ( result . aux_operator_eigenvalues , list ) : aux_operator_eigenvalues = [ result . aux_operator_eigenvalues ] else : aux_operator_eigenvalues = result . aux_operator_eigenvalues for aux_op_eigenvalues in aux_operator_eigenvalues : if aux_op_eigenvalues is None : continue if aux_op_eigenvalues [ 0 ] is not None : n_particles = aux_op_eigenvalues [ 0 ] [ 0 ] . real result . num_particles . append ( n_particles ) if not np . isclose ( n_particles , expected ) : LOGGER . warning ( "The measured number of particles %s does NOT match the expected number of " "particles %s!" , n_particles , expected , ) else : result . num_particles . append ( None )
Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.
Interprets an : class : ~qiskit_nature . result . EigenstateResult in this property ' s context .
"""Interprets an :class:~qiskit_nature.result.EigenstateResult in this property's context.

        Args:
            result: the result to add meaning to.
        """ # type: ignore # type: ignore
self
result
EigenstateResult
the result to add meaning to.
the result to add meaning to .