original_docstring: 
      Create a CDF for unpolarized scattering for uniform CDF.
  
      The CDF covers scattered (exit) angles ranging from 180 to 0 degrees.
      (The cosines are uniformly distributed over -1 to 1.) These angles mu
      correspond to uniform spacing of the cumulative distribution function
      for unpolarized Mie scattering where cdf[i] = i/(num-1).
  
      This is a brute force implementation that solves the problem by
      calculating the CDF at many points and then scanning to find the
      specific angles that correspond to uniform interval of the CDF.
  
      Since this is a cumulative distribution function, the maximum value
      should be 1.
  
      Args:
          m: the complex index of refraction of the sphere
          x: the size parameter of the sphere
          num: length of desired CDF array
  
      Returns:
          mu: array of cosines of angles (irregularly spaced)
          cdf: array of cumulative distribution function values
      
docstring: Create a CDF for unpolarized scattering for uniform CDF.
  The CDF covers scattered (exit) angles ranging from 180 to 0 degrees.
  (The cosines are uniformly distributed over -1 to 1.) These angles mu
  correspond to uniform spacing of the cumulative distribution function
  for unpolarized Mie scattering where cdf[i] = i/(num-1).
  
  This is a brute force implementation that solves the problem by
  calculating the CDF at many points and then scanning to find the
  specific angles that correspond to uniform interval of the CDF.
  
  Since this is a cumulative distribution function, the maximum value
  should be 1.
docstring_tokens: Create a CDF for unpolarized scattering for uniform CDF . The CDF covers scattered ( exit ) angles ranging from 180 to 0 degrees . ( The cosines are uniformly distributed over - 1 to 1 . ) These angles mu correspond to uniform spacing of the cumulative distribution function for unpolarized Mie scattering where cdf [ i ] = i / ( num - 1 ) . This is a brute force implementation that solves the problem by calculating the CDF at many points and then scanning to find the specific angles that correspond to uniform interval of the CDF . Since this is a cumulative distribution function the maximum value should be 1 .
code: def mie_mu_with_uniform_cdf(m, x, num):
      """
      Create a CDF for unpolarized scattering for uniform CDF.
  
      The CDF covers scattered (exit) angles ranging from 180 to 0 degrees.
      (The cosines are uniformly distributed over -1 to 1.) These angles mu
      correspond to uniform spacing of the cumulative distribution function
      for unpolarized Mie scattering where cdf[i] = i/(num-1).
  
      This is a brute force implementation that solves the problem by
      calculating the CDF at many points and then scanning to find the
      specific angles that correspond to uniform interval of the CDF.
  
      Since this is a cumulative distribution function, the maximum value
      should be 1.
  
      Args:
          m: the complex index of refraction of the sphere
          x: the size parameter of the sphere
          num: length of desired CDF array
  
      Returns:
          mu: array of cosines of angles (irregularly spaced)
          cdf: array of cumulative distribution function values
      """
      big_num = 2000                  # large to work with x up to 10
      big_mu, big_cdf = mie_cdf(m, x, big_num)
      mu = np.empty(num)
      cdf = np.empty(num)
  
      mu[0] = -1                       # cos[180 degrees] is -1
      cdf[0] = 0                       # initial cdf is zero
  
      big_k = 0                        # index into big_cdf
      for k in range(1, num - 1):
  
          target = k / (num - 1)
          while big_cdf[big_k] < target:
              big_k += 1
  
          delta = big_cdf[big_k] - target
          delta_cdf = big_cdf[big_k] - big_cdf[big_k - 1]
          delta_mu = big_mu[big_k] - big_mu[big_k - 1]
  
          mu[k] = big_mu[big_k] - delta / delta_cdf * delta_mu   # interpolate
          cdf[k] = target
  
  #       print(' mu[',k,']=% .5f'%mu[k],' cdf[',k,']=% .5f'%cdf[k],
  #       'cdf=',big_cdf[big_k], fraction)
  
      mu[num - 1] = 1                    # cos[0 degrees] is 1
      cdf[num - 1] = 1                   # last cdf is one
  
      return [mu, cdf]
code_tokens: def mie_mu_with_uniform_cdf ( m , x , num ) : big_num = 2000 big_mu , big_cdf = mie_cdf ( m , x , big_num ) mu = np . empty ( num ) cdf = np . empty ( num ) mu [ 0 ] = - 1 cdf [ 0 ] = 0 big_k = 0 for k in range ( 1 , num - 1 ) : target = k / ( num - 1 ) while big_cdf [ big_k ] < target : big_k += 1 delta = big_cdf [ big_k ] - target delta_cdf = big_cdf [ big_k ] - big_cdf [ big_k - 1 ] delta_mu = big_mu [ big_k ] - big_mu [ big_k - 1 ] mu [ k ] = big_mu [ big_k ] - delta / delta_cdf * delta_mu cdf [ k ] = target mu [ num - 1 ] = 1 cdf [ num - 1 ] = 1 return [ mu , cdf ]
short_docstring: Create a CDF for unpolarized scattering for uniform CDF.
short_docstring_tokens: Create a CDF for unpolarized scattering for uniform CDF .
comment: """
      Create a CDF for unpolarized scattering for uniform CDF.
  
      The CDF covers scattered (exit) angles ranging from 180 to 0 degrees.
      (The cosines are uniformly distributed over -1 to 1.) These angles mu
      correspond to uniform spacing of the cumulative distribution function
      for unpolarized Mie scattering where cdf[i] = i/(num-1).
  
      This is a brute force implementation that solves the problem by
      calculating the CDF at many points and then scanning to find the
      specific angles that correspond to uniform interval of the CDF.
  
      Since this is a cumulative distribution function, the maximum value
      should be 1.
  
      Args:
          m: the complex index of refraction of the sphere
          x: the size parameter of the sphere
          num: length of desired CDF array
  
      Returns:
          mu: array of cosines of angles (irregularly spaced)
          cdf: array of cumulative distribution function values
      """$SEP$# large to work with x up to 10$SEP$# cos[180 degrees] is -1$SEP$# initial cdf is zero$SEP$# index into big_cdf$SEP$# interpolate$SEP$#       print(' mu[',k,']=% .5f'%mu[k],' cdf[',k,']=% .5f'%cdf[k],$SEP$#       'cdf=',big_cdf[big_k], fraction)$SEP$# cos[0 degrees] is 1$SEP$# last cdf is one