code: def to_n_ref(self, fill=0, dtype='i1'):
          
  
          # count number of alternate alleles
          out = np.empty(self.shape[:-1], dtype=dtype)
          np.sum(self.values == 0, axis=-1, out=out)
  
          # fill missing calls
          if fill != 0:
              m = self.is_missing()
              out[m] = fill
  
          # handle mask
          if self.mask is not None:
              out[self.mask] = fill
  
          return out
docs: Transform each genotype call into the number of
          reference alleles.
  
          Parameters
          ----------
          fill : int, optional
              Use this value to represent missing calls.
          dtype : dtype, optional
              Output dtype.
  
          Returns
          -------
          out : ndarray, int8, shape (n_variants, n_samples)
              Array of ref alleles per genotype call.
  
          Notes
          -----
          By default this function returns 0 for missing genotype calls
          **and** for homozygous non-reference genotype calls. Use the
          `fill` argument to change how missing calls are represented.
  
          Examples
          --------
  
          >>> import allel
          >>> g = allel.GenotypeArray([[[0, 0], [0, 1]],
          ...                          [[0, 2], [1, 1]],
          ...                          [[2, 2], [-1, -1]]])
          >>> g.to_n_ref()
          array([[2, 1],
                 [1, 0],
                 [0, 0]], dtype=int8)
          >>> g.to_n_ref(fill=-1)
          array([[ 2,  1],
                 [ 1,  0],
                 [ 0, -1]], dtype=int8)
          >>> v = g[:, 0]
          >>> v
          <GenotypeVector shape=(3, 2) dtype=int64>
          0/0 0/2 2/2
          >>> v.to_n_ref()
          array([2, 1, 0], dtype=int8)