parameters: (w, e, s0, camera_r=None, Lambda=None,
             weights=None, scale_prior=-0.0014, interval=0.01, depth_reg=0.0325)
return_statement: return score, a, r
docstring: Brute force over charts from the manifold to find the best one.
          Returns best chart index and its a and r coefficients
          Returns assignment, and a and r coefficents
docstring_summary: Brute force over charts from the manifold to find the best one.
          Returns best chart index and its a and r coefficients
          Returns assignment, and a and r coefficents
docstring_tokens: Brute force over charts from the manifold to find the best one . Returns best chart index and its a and r coefficients Returns assignment and a and r coefficents
function: def pick_e(w, e, s0, camera_r=None, Lambda=None,
             weights=None, scale_prior=-0.0014, interval=0.01, depth_reg=0.0325):
      """Brute force over charts from the manifold to find the best one.
          Returns best chart index and its a and r coefficients
          Returns assignment, and a and r coefficents"""
  
      camera_r = np.asarray([[1, 0, 0], [0, 0, -1], [0, 1, 0]]
                            ) if camera_r is None else camera_r
      Lambda = np.ones((0, 0)) if Lambda is None else Lambda
      weights = np.ones((0, 0, 0)) if weights is None else weights
  
      charts = e.shape[0]
      frames = w.shape[0]
      basis = e.shape[1]
      points = e.shape[3]
      assert (s0.shape[0] == charts)
      r = np.empty((charts, 2, frames))
      a = np.empty((charts, frames, e.shape[1]))
      score = np.empty((charts, frames))
      check = np.arange(0, 1, interval) * 2 * np.pi
      cache_a = np.empty((check.size, basis, frames))
      residue = np.empty((check.size, frames))
  
      if Lambda.size != 0:
          res = np.zeros((frames, points * 2 + basis + points))
          proj_e = np.zeros((basis, 2 * points + basis + points))
      else:
          res = np.empty((frames, points * 2))
          proj_e = np.empty((basis, 2 * points))
      Ps = np.empty((2, points))
  
      if weights.size == 0:
          for i in range(charts):
              if Lambda.size != 0:
                  a[i], r[i], score[i] = estimate_a_and_r_with_res(
                      w, e[i], s0[i], camera_r,
                      Lambda[i], check, cache_a, weights,
                      res, proj_e, residue, Ps,
                      depth_reg, scale_prior)
              else:
                  a[i], r[i], score[i] = estimate_a_and_r_with_res(
                      w, e[i], s0[i], camera_r, Lambda,
                      check, cache_a, weights,
                      res, proj_e, residue, Ps,
                      depth_reg, scale_prior)
      else:
          w2 = weights.reshape(weights.shape[0], -1)
          for i in range(charts):
              if Lambda.size != 0:
                  a[i], r[i], score[i] = estimate_a_and_r_with_res_weights(
                      w, e[i], s0[i], camera_r,
                      Lambda[i], check, cache_a, w2,
                      res, proj_e, residue, Ps,
                      depth_reg, scale_prior)
              else:
                  a[i], r[i], score[i] = estimate_a_and_r_with_res_weights(
                      w, e[i], s0[i], camera_r, Lambda,
                      check, cache_a, w2,
                      res, proj_e, residue, Ps,
                      depth_reg, scale_prior)
  
      remaining_dims = 3 * w.shape[2] - e.shape[1]
      assert (np.all(score > 0))
      assert (remaining_dims >= 0)
      # Zero problems in log space due to un-regularised first co-efficient
      l = Lambda.copy()
      l[Lambda == 0] = 1
      llambda = -np.log(l)
      score /= 2
      return score, a, r
function_tokens: def pick_e ( w , e , s0 , camera_r = None , Lambda = None , weights = None , scale_prior = - 0.0014 , interval = 0.01 , depth_reg = 0.0325 ) : camera_r = np . asarray ( [ [ 1 , 0 , 0 ] , [ 0 , 0 , - 1 ] , [ 0 , 1 , 0 ] ] ) if camera_r is None else camera_r Lambda = np . ones ( ( 0 , 0 ) ) if Lambda is None else Lambda weights = np . ones ( ( 0 , 0 , 0 ) ) if weights is None else weights charts = e . shape [ 0 ] frames = w . shape [ 0 ] basis = e . shape [ 1 ] points = e . shape [ 3 ] assert ( s0 . shape [ 0 ] == charts ) r = np . empty ( ( charts , 2 , frames ) ) a = np . empty ( ( charts , frames , e . shape [ 1 ] ) ) score = np . empty ( ( charts , frames ) ) check = np . arange ( 0 , 1 , interval ) * 2 * np . pi cache_a = np . empty ( ( check . size , basis , frames ) ) residue = np . empty ( ( check . size , frames ) ) if Lambda . size != 0 : res = np . zeros ( ( frames , points * 2 + basis + points ) ) proj_e = np . zeros ( ( basis , 2 * points + basis + points ) ) else : res = np . empty ( ( frames , points * 2 ) ) proj_e = np . empty ( ( basis , 2 * points ) ) Ps = np . empty ( ( 2 , points ) ) if weights . size == 0 : for i in range ( charts ) : if Lambda . size != 0 : a [ i ] , r [ i ] , score [ i ] = estimate_a_and_r_with_res ( w , e [ i ] , s0 [ i ] , camera_r , Lambda [ i ] , check , cache_a , weights , res , proj_e , residue , Ps , depth_reg , scale_prior ) else : a [ i ] , r [ i ] , score [ i ] = estimate_a_and_r_with_res ( w , e [ i ] , s0 [ i ] , camera_r , Lambda , check , cache_a , weights , res , proj_e , residue , Ps , depth_reg , scale_prior ) else : w2 = weights . reshape ( weights . shape [ 0 ] , - 1 ) for i in range ( charts ) : if Lambda . size != 0 : a [ i ] , r [ i ] , score [ i ] = estimate_a_and_r_with_res_weights ( w , e [ i ] , s0 [ i ] , camera_r , Lambda [ i ] , check , cache_a , w2 , res , proj_e , residue , Ps , depth_reg , scale_prior ) else : a [ i ] , r [ i ] , score [ i ] = estimate_a_and_r_with_res_weights ( w , e [ i ] , s0 [ i ] , camera_r , Lambda , check , cache_a , w2 , res , proj_e , residue , Ps , depth_reg , scale_prior ) remaining_dims = 3 * w . shape [ 2 ] - e . shape [ 1 ] assert ( np . all ( score > 0 ) ) assert ( remaining_dims >= 0 ) # Zero problems in log space due to un-regularised first co-efficient l = Lambda . copy ( ) l [ Lambda == 0 ] = 1 llambda = - np . log ( l ) score /= 2 return score , a , r