Return a fermionic or bosonic number operator.

Used in the notebooks

Used in the tutorials

n_modes (int): The number of modes in the system. mode (int, optional): The mode on which to return the number operator. If None, return total number operator on all sites. coefficient (float): The coefficient of the term. parity (int): Returns the fermionic number operator if parity=-1 (default), and returns the bosonic number operator if parity=1.

operator (BosonOperator or FermionOperator)