original_docstring: Compute the level number variance of the current unfolded eigenvalues.
  
      Parameters
      ----------
      L: ndarray
          The grid of L values for which to compute the level variance.
  
      tol: float
          Stop iterating when the last `min_L_iters` computed values of the
          level variance have a range (i.e. max - min) < tol.
  
      max_L_iters: int
          Stop computing values for the level variance once max_L_iters values
          have been computed for each L value.
  
      min_L_iters: int
          Minimum number of iterations for each L value.
  
      show_progress: bool
          Whether or not to display computation progress in stdout.
  
      Returns
      -------
      L_vals: ndarray
          The L_values for which the number level variance was computed.
  
      sigma: ndarray
          The computed number level variance values.
      
docstring: Compute the level number variance of the current unfolded eigenvalues.
  Parameters
  
  ndarray
  The grid of L values for which to compute the level variance.
  
  float
  Stop iterating when the last `min_L_iters` computed values of the
  level variance have a range  < tol.
  
  int
  Stop computing values for the level variance once max_L_iters values
  have been computed for each L value.
  
  int
  Minimum number of iterations for each L value.
  
  bool
  Whether or not to display computation progress in stdout.
  
  Returns
  
  ndarray
  The L_values for which the number level variance was computed.
  
  ndarray
  The computed number level variance values.
docstring_tokens: Compute the level number variance of the current unfolded eigenvalues . Parameters ndarray The grid of L values for which to compute the level variance . float Stop iterating when the last ` min_L_iters ` computed values of the level variance have a range < tol . int Stop computing values for the level variance once max_L_iters values have been computed for each L value . int Minimum number of iterations for each L value . bool Whether or not to display computation progress in stdout . Returns ndarray The L_values for which the number level variance was computed . ndarray The computed number level variance values .
code: def level_number_variance_stable(
      unfolded: ndarray,
      L: ndarray,
      tol: float,
      max_L_iters: int,
      min_L_iters: int,
      show_progress: bool,
  ) -> Tuple[ndarray, ndarray]:
      """Compute the level number variance of the current unfolded eigenvalues.
  
      Parameters
      ----------
      L: ndarray
          The grid of L values for which to compute the level variance.
  
      tol: float
          Stop iterating when the last `min_L_iters` computed values of the
          level variance have a range (i.e. max - min) < tol.
  
      max_L_iters: int
          Stop computing values for the level variance once max_L_iters values
          have been computed for each L value.
  
      min_L_iters: int
          Minimum number of iterations for each L value.
  
      show_progress: bool
          Whether or not to display computation progress in stdout.
  
      Returns
      -------
      L_vals: ndarray
          The L_values for which the number level variance was computed.
  
      sigma: ndarray
          The computed number level variance values.
      """
      if show_progress:
          # see https://stackoverflow.com/a/9754423, https://stackoverflow.com/a/7908612
          # here we make the numpy arrays share the same memory
          shared = Array(ctypes.c_uint64, 1)
          progress = np.frombuffer(shared.get_obj())
          update = Process(target=_update_progress, args=(shared, len(L)))
          update.start()
  
      L_vals, sigma = _sigma_iter_converge(
          unfolded=unfolded,
          L=L,
          tol=tol,
          max_L_iters=max_L_iters,
          min_L_iters=min_L_iters,
          progress=progress if show_progress else None,
      )
      if show_progress:
          progress[0] = len(L)  # ensure finish in case increments are non-atomic
          update.join()
  
      return L_vals, sigma
code_tokens: def level_number_variance_stable ( unfolded : ndarray , L : ndarray , tol : float , max_L_iters : int , min_L_iters : int , show_progress : bool , ) -> Tuple [ ndarray , ndarray ] : if show_progress : shared = Array ( ctypes . c_uint64 , 1 ) progress = np . frombuffer ( shared . get_obj ( ) ) update = Process ( target = _update_progress , args = ( shared , len ( L ) ) ) update . start ( ) L_vals , sigma = _sigma_iter_converge ( unfolded = unfolded , L = L , tol = tol , max_L_iters = max_L_iters , min_L_iters = min_L_iters , progress = progress if show_progress else None , ) if show_progress : progress [ 0 ] = len ( L ) update . join ( ) return L_vals , sigma
short_docstring: Compute the level number variance of the current unfolded eigenvalues.
short_docstring_tokens: Compute the level number variance of the current unfolded eigenvalues .
comment: """Compute the level number variance of the current unfolded eigenvalues.
  
      Parameters
      ----------
      L: ndarray
          The grid of L values for which to compute the level variance.
  
      tol: float
          Stop iterating when the last `min_L_iters` computed values of the
          level variance have a range (i.e. max - min) < tol.
  
      max_L_iters: int
          Stop computing values for the level variance once max_L_iters values
          have been computed for each L value.
  
      min_L_iters: int
          Minimum number of iterations for each L value.
  
      show_progress: bool
          Whether or not to display computation progress in stdout.
  
      Returns
      -------
      L_vals: ndarray
          The L_values for which the number level variance was computed.
  
      sigma: ndarray
          The computed number level variance values.
      """$SEP$# see https://stackoverflow.com/a/9754423, https://stackoverflow.com/a/7908612$SEP$# here we make the numpy arrays share the same memory$SEP$# ensure finish in case increments are non-atomic