original_docstring: Performs fitting many times to get an estimate of the uncertainty
  
      
docstring: Performs fitting many times to get an estimate of the uncertainty
docstring_tokens: Performs fitting many times to get an estimate of the uncertainty
code: def fit_uncertainty(points, lower_wave, upper_wave, log_center_wave, filter_size):
      """Performs fitting many times to get an estimate of the uncertainty
  
      """
      mock_points = []
      for i in range(1, 100):
          # First, fit the points
          coeff = np.polyfit(np.log10(points['rest_wavelength']),
                             np.random.normal(points['f_lambda'], points['err_f_lambda']), deg=2)  # , w=(1/points['err_f_lambda'])
          # Get the polynomial
          fit_func = np.poly1d(coeff)
          # x-range over which we fit
          fit_wavelengths = np.arange(
              np.log10(lower_wave), np.log10(upper_wave), 0.001)
          # Values of the points we fit
          fit_points = fit_func(fit_wavelengths)
          # Indexes of the values that lie in the mock filter
          fit_idx = np.logical_and(fit_wavelengths > (log_center_wave -
                                                      filter_size), fit_wavelengths < (log_center_wave + filter_size))
          # Average the values in the mock filter to get the mock point
          mock_sed_point = np.mean(fit_points[fit_idx])
          mock_points.append(mock_sed_point)
      # PERCENTILE ERROR HERE?
      mock_sed_point, l_err, u_err = np.percentile(mock_points, [50, 15.7, 84.3])
      return mock_sed_point, u_err - mock_sed_point, mock_sed_point - l_err
code_tokens: def fit_uncertainty ( points , lower_wave , upper_wave , log_center_wave , filter_size ) : mock_points = [ ] for i in range ( 1 , 100 ) : coeff = np . polyfit ( np . log10 ( points [ 'rest_wavelength' ] ) , np . random . normal ( points [ 'f_lambda' ] , points [ 'err_f_lambda' ] ) , deg = 2 ) fit_func = np . poly1d ( coeff ) fit_wavelengths = np . arange ( np . log10 ( lower_wave ) , np . log10 ( upper_wave ) , 0.001 ) fit_points = fit_func ( fit_wavelengths ) fit_idx = np . logical_and ( fit_wavelengths > ( log_center_wave - filter_size ) , fit_wavelengths < ( log_center_wave + filter_size ) ) mock_sed_point = np . mean ( fit_points [ fit_idx ] ) mock_points . append ( mock_sed_point ) mock_sed_point , l_err , u_err = np . percentile ( mock_points , [ 50 , 15.7 , 84.3 ] ) return mock_sed_point , u_err - mock_sed_point , mock_sed_point - l_err
short_docstring: Performs fitting many times to get an estimate of the uncertainty
short_docstring_tokens: Performs fitting many times to get an estimate of the uncertainty
comment: """Performs fitting many times to get an estimate of the uncertainty
  
      """$SEP$# First, fit the points$SEP$# , w=(1/points['err_f_lambda'])$SEP$# Get the polynomial$SEP$# x-range over which we fit$SEP$# Values of the points we fit$SEP$# Indexes of the values that lie in the mock filter$SEP$# Average the values in the mock filter to get the mock point$SEP$# PERCENTILE ERROR HERE?