original_docstring: [DEPRECATE]. This has been supersed by level_number_variance_stable
  
      Computes the level number variance (sigma squared, [1]_) for a
      particular set of eigenvalues and their unfolding.
  
      Parameters
      ----------
      unfolded: ndarray
          The unfolded eigenvalues.
  
      L_grid_size: int
          The number of values of L to generate betwen min_L and max_L.
  
      min_L: int
          The lowest possible L value for which to compute the spectral rigidit
  
      max_L: int
          The largest possible L value for which to compute the spectral rigidit
  
      c_iters: int
          How many times the location of the center, c, of the interval
          [c - L/2, c + L/2] should be chosen uniformly at random for
          each L in order to compute the estimate of the number level
          varianc
  
      show_progress: bool
          Show a pretty progress bar while computin
  
      Returns
      -------
      L : ndarray
          The L values generated based on the values of L_grid_size,
          min_L, and max_
  
      sigma_sq : ndarray
          The computed number level variance values for each of
  
      References
      ----------
      .. [1] Mehta, M. L. (2004). Random matrices (Vol. 142). Elsevier.
  
      Notes
      -----
      The level number variance Sigma^2(L) converges *much* more slowly to the
      expected limiting curves than either the NNSD, next NNSD, or spectral
      rigidity. Even for a (50 000 x 50 000) GOE matrix, unfolded via smooth /
      Wigner's unfolding, there are significant deviations (about 0.1 in absolute
      value) from the expected values for
  
      For smaller matrices (e.g. 5000 x 5000) there will generally be considerable
      deviance by L == 20. In general, one should probably refrain from computing
      the number level variance beyond L == 20.
      
docstring: [DEPRECATE]. This has been supersed by level_number_variance_stable
  Computes the level number variance (sigma squared, [1]_) for a
  particular set of eigenvalues and their unfolding.
  
  Parameters
  
  ndarray
  The unfolded eigenvalues.
  
  int
  The number of values of L to generate betwen min_L and max_L.
  
  int
  The lowest possible L value for which to compute the spectral rigidit
  
  int
  The largest possible L value for which to compute the spectral rigidit
  
  int
  How many times the location of the center, c, of the interval
  [c - L/2, c + L/2] should be chosen uniformly at random for
  each L in order to compute the estimate of the number level
  varianc
  
  bool
  Show a pretty progress bar while computin
  
  Returns
  
  L : ndarray
  The L values generated based on the values of L_grid_size,
  min_L, and max_
  
  sigma_sq : ndarray
  The computed number level variance values for each of
  
  References
  
  
  
  Notes
  
  The level number variance Sigma^2(L) converges *much* more slowly to the
  expected limiting curves than either the NNSD, next NNSD, or spectral
  rigidity. Even for a (50 000 x 50 000) GOE matrix, unfolded via smooth
  Wigner's unfolding, there are significant deviations (about 0.1 in absolute
  value) from the expected values for
  
  For smaller matrices  there will generally be considerable
  deviance by L == 20. In general, one should probably refrain from computing
  the number level variance beyond L == 20.
docstring_tokens: [ DEPRECATE ] . This has been supersed by level_number_variance_stable Computes the level number variance ( sigma squared [ 1 ] _ ) for a particular set of eigenvalues and their unfolding . Parameters ndarray The unfolded eigenvalues . int The number of values of L to generate betwen min_L and max_L . int The lowest possible L value for which to compute the spectral rigidit int The largest possible L value for which to compute the spectral rigidit int How many times the location of the center c of the interval [ c - L / 2 c + L / 2 ] should be chosen uniformly at random for each L in order to compute the estimate of the number level varianc bool Show a pretty progress bar while computin Returns L : ndarray The L values generated based on the values of L_grid_size min_L and max_ sigma_sq : ndarray The computed number level variance values for each of References Notes The level number variance Sigma^2 ( L ) converges * much * more slowly to the expected limiting curves than either the NNSD next NNSD or spectral rigidity . Even for a ( 50 000 x 50 000 ) GOE matrix unfolded via smooth Wigner ' s unfolding there are significant deviations ( about 0 . 1 in absolute value ) from the expected values for For smaller matrices there will generally be considerable deviance by L == 20 . In general one should probably refrain from computing the number level variance beyond L == 20 .
code: def level_number_variance(
      unfolded: ndarray,
      min_L: float = 0.5,
      max_L: float = 20,
      c_iters: int = 50,
      L_grid_size: int = None,
      show_progress: bool = True,
  ) -> Tuple[ndarray, ndarray]:
      """[DEPRECATE]. This has been supersed by level_number_variance_stable
  
      Computes the level number variance (sigma squared, [1]_) for a
      particular set of eigenvalues and their unfolding.
  
      Parameters
      ----------
      unfolded: ndarray
          The unfolded eigenvalues.
  
      L_grid_size: int
          The number of values of L to generate betwen min_L and max_L.
  
      min_L: int
          The lowest possible L value for which to compute the spectral rigidit
  
      max_L: int
          The largest possible L value for which to compute the spectral rigidit
  
      c_iters: int
          How many times the location of the center, c, of the interval
          [c - L/2, c + L/2] should be chosen uniformly at random for
          each L in order to compute the estimate of the number level
          varianc
  
      show_progress: bool
          Show a pretty progress bar while computin
  
      Returns
      -------
      L : ndarray
          The L values generated based on the values of L_grid_size,
          min_L, and max_
  
      sigma_sq : ndarray
          The computed number level variance values for each of
  
      References
      ----------
      .. [1] Mehta, M. L. (2004). Random matrices (Vol. 142). Elsevier.
  
      Notes
      -----
      The level number variance Sigma^2(L) converges *much* more slowly to the
      expected limiting curves than either the NNSD, next NNSD, or spectral
      rigidity. Even for a (50 000 x 50 000) GOE matrix, unfolded via smooth /
      Wigner's unfolding, there are significant deviations (about 0.1 in absolute
      value) from the expected values for
  
      For smaller matrices (e.g. 5000 x 5000) there will generally be considerable
      deviance by L == 20. In general, one should probably refrain from computing
      the number level variance beyond L == 20.
      """
      if L_grid_size is None:
          L_grid_size = int(2 * np.abs((np.floor(max_L) - np.floor(min_L))))
      L_grid = np.linspace(min_L, max_L, L_grid_size)
      sigma_sq = np.empty([L_grid_size])
      if show_progress:
          pbar_widgets = [
              f"{Fore.GREEN}Computing level variance: {Fore.RESET}",
              f"{Fore.BLUE}",
              Percentage(),
              f" {Fore.RESET}",
              " ",
              Timer(),
              f" | {Fore.YELLOW}",
              AdaptiveETA(),
              f"{Fore.RESET}",
          ]
          pbar = ProgressBar(widgets=pbar_widgets, maxval=L_grid.shape[0]).start()
      for i, L in enumerate(L_grid):
          sigma_sq[i] = _sigma_iter(unfolded, L, c_iters)
          if show_progress:
              pbar.update(i)
      if show_progress:
          pbar.finish()
  
      return L_grid, sigma_sq
code_tokens: def level_number_variance ( unfolded : ndarray , min_L : float = 0.5 , max_L : float = 20 , c_iters : int = 50 , L_grid_size : int = None , show_progress : bool = True , ) -> Tuple [ ndarray , ndarray ] : if L_grid_size is None : L_grid_size = int ( 2 * np . abs ( ( np . floor ( max_L ) - np . floor ( min_L ) ) ) ) L_grid = np . linspace ( min_L , max_L , L_grid_size ) sigma_sq = np . empty ( [ L_grid_size ] ) if show_progress : pbar_widgets = [ f"{Fore.GREEN}Computing level variance: {Fore.RESET}" , f"{Fore.BLUE}" , Percentage ( ) , f" {Fore.RESET}" , " " , Timer ( ) , f" | {Fore.YELLOW}" , AdaptiveETA ( ) , f"{Fore.RESET}" , ] pbar = ProgressBar ( widgets = pbar_widgets , maxval = L_grid . shape [ 0 ] ) . start ( ) for i , L in enumerate ( L_grid ) : sigma_sq [ i ] = _sigma_iter ( unfolded , L , c_iters ) if show_progress : pbar . update ( i ) if show_progress : pbar . finish ( ) return L_grid , sigma_sq
short_docstring: [DEPRECATE].
short_docstring_tokens: [ DEPRECATE ] .
comment: """[DEPRECATE]. This has been supersed by level_number_variance_stable
  
      Computes the level number variance (sigma squared, [1]_) for a
      particular set of eigenvalues and their unfolding.
  
      Parameters
      ----------
      unfolded: ndarray
          The unfolded eigenvalues.
  
      L_grid_size: int
          The number of values of L to generate betwen min_L and max_L.
  
      min_L: int
          The lowest possible L value for which to compute the spectral rigidit
  
      max_L: int
          The largest possible L value for which to compute the spectral rigidit
  
      c_iters: int
          How many times the location of the center, c, of the interval
          [c - L/2, c + L/2] should be chosen uniformly at random for
          each L in order to compute the estimate of the number level
          varianc
  
      show_progress: bool
          Show a pretty progress bar while computin
  
      Returns
      -------
      L : ndarray
          The L values generated based on the values of L_grid_size,
          min_L, and max_
  
      sigma_sq : ndarray
          The computed number level variance values for each of
  
      References
      ----------
      .. [1] Mehta, M. L. (2004). Random matrices (Vol. 142). Elsevier.
  
      Notes
      -----
      The level number variance Sigma^2(L) converges *much* more slowly to the
      expected limiting curves than either the NNSD, next NNSD, or spectral
      rigidity. Even for a (50 000 x 50 000) GOE matrix, unfolded via smooth /
      Wigner's unfolding, there are significant deviations (about 0.1 in absolute
      value) from the expected values for
  
      For smaller matrices (e.g. 5000 x 5000) there will generally be considerable
      deviance by L == 20. In general, one should probably refrain from computing
      the number level variance beyond L == 20.
      """