original_docstring: From the points of upper and lower surface find the y coordinate of
      the hinge at x_hinge
      
      :param x_hinge: float x-coordinate of the hinge
      :param upper: dictionary with keys x and y, coordiantes of upper surface
      :param lower: dictionary with keys x and y, coordiantes of lower surface    
      
docstring: From the points of upper and lower surface find the y coordinate of
  the hinge at x_hinge
docstring_tokens: From the points of upper and lower surface find the y coordinate of the hinge at x_hinge
code: def find_hinge(x_hinge, upper, lower):
      """From the points of upper and lower surface find the y coordinate of
      the hinge at x_hinge
      
      :param x_hinge: float x-coordinate of the hinge
      :param upper: dictionary with keys x and y, coordiantes of upper surface
      :param lower: dictionary with keys x and y, coordiantes of lower surface    
      """
      def find_closest(data, x_hinge, fwd, aft):
          """ Find the points afterwards(aft) and forwards(fwd) that are closest
          to x_hinge. Retuns dictionaries aft and fwd, each with keys x and y."""
          for i in range(len(data['x'])):
              xi = data['x'][i]
              yi = data['y'][i]
              error = abs(xi - x_hinge)
      
              #If equal just save and break it
              if x_hinge == xi:
                  aft['x'] = xi
                  aft['y'] = yi
                  aft['error'] = error
                  fwd['x'] = xi
                  fwd['y'] = yi
                  fwd['error'] = error
                  break
              
              if xi > x_hinge and error < aft['error']:
                  aft['x'] = xi
                  aft['y'] = yi
                  aft['error'] = error
      
              if xi < x_hinge and error < fwd['error']:
                  fwd['x'] = xi
                  fwd['y'] = yi
                  fwd['error'] = error
          return fwd, aft
          
      #Find y hinge
      upper_fwd = {'x': 9e9, 'y': 9e9, 'error': 9e9}
      upper_aft = {'x': 9e9, 'y': 9e9, 'error': 9e9}
      lower_fwd = {'x': 9e9, 'y': 9e9, 'error': 9e9}
      lower_aft = {'x': 9e9, 'y': 9e9, 'error': 9e9}
      hinge = {'x': x_hinge, 'y': 9e9}
      
      upper_fwd, upper_aft = find_closest(upper, x_hinge, upper_fwd, upper_aft)
      lower_fwd, lower_aft = find_closest(lower, x_hinge, lower_fwd, lower_aft) 
      
      #Interpolate
      hinge['y_upper'] =  upper_fwd['y'] + (
                          hinge['x'] - upper_fwd['x'])*(
                          upper_aft['y'] - upper_fwd['y'])/(
                          upper_aft['x'] - upper_fwd['x'])
      
      hinge['y_lower'] =  lower_fwd['y'] + (
                          hinge['x'] - lower_fwd['x'])*(
                          lower_aft['y'] - lower_fwd['y'])/(
                          lower_aft['x'] - lower_fwd['x'])
      hinge['y']  = (hinge['y_upper'] + hinge['y_lower'])/2.
  
      return hinge
code_tokens: def find_hinge ( x_hinge , upper , lower ) : def find_closest ( data , x_hinge , fwd , aft ) : """ Find the points afterwards(aft) and forwards(fwd) that are closest
          to x_hinge. Retuns dictionaries aft and fwd, each with keys x and y.""" for i in range ( len ( data [ 'x' ] ) ) : xi = data [ 'x' ] [ i ] yi = data [ 'y' ] [ i ] error = abs ( xi - x_hinge ) if x_hinge == xi : aft [ 'x' ] = xi aft [ 'y' ] = yi aft [ 'error' ] = error fwd [ 'x' ] = xi fwd [ 'y' ] = yi fwd [ 'error' ] = error break if xi > x_hinge and error < aft [ 'error' ] : aft [ 'x' ] = xi aft [ 'y' ] = yi aft [ 'error' ] = error if xi < x_hinge and error < fwd [ 'error' ] : fwd [ 'x' ] = xi fwd [ 'y' ] = yi fwd [ 'error' ] = error return fwd , aft upper_fwd = { 'x' : 9e9 , 'y' : 9e9 , 'error' : 9e9 } upper_aft = { 'x' : 9e9 , 'y' : 9e9 , 'error' : 9e9 } lower_fwd = { 'x' : 9e9 , 'y' : 9e9 , 'error' : 9e9 } lower_aft = { 'x' : 9e9 , 'y' : 9e9 , 'error' : 9e9 } hinge = { 'x' : x_hinge , 'y' : 9e9 } upper_fwd , upper_aft = find_closest ( upper , x_hinge , upper_fwd , upper_aft ) lower_fwd , lower_aft = find_closest ( lower , x_hinge , lower_fwd , lower_aft ) hinge [ 'y_upper' ] = upper_fwd [ 'y' ] + ( hinge [ 'x' ] - upper_fwd [ 'x' ] ) * ( upper_aft [ 'y' ] - upper_fwd [ 'y' ] ) / ( upper_aft [ 'x' ] - upper_fwd [ 'x' ] ) hinge [ 'y_lower' ] = lower_fwd [ 'y' ] + ( hinge [ 'x' ] - lower_fwd [ 'x' ] ) * ( lower_aft [ 'y' ] - lower_fwd [ 'y' ] ) / ( lower_aft [ 'x' ] - lower_fwd [ 'x' ] ) hinge [ 'y' ] = ( hinge [ 'y_upper' ] + hinge [ 'y_lower' ] ) / 2. return hinge
short_docstring: From the points of upper and lower surface find the y coordinate of
  the hinge at x_hinge
short_docstring_tokens: From the points of upper and lower surface find the y coordinate of the hinge at x_hinge
comment: """From the points of upper and lower surface find the y coordinate of
      the hinge at x_hinge
      
      :param x_hinge: float x-coordinate of the hinge
      :param upper: dictionary with keys x and y, coordiantes of upper surface
      :param lower: dictionary with keys x and y, coordiantes of lower surface    
      """$SEP$""" Find the points afterwards(aft) and forwards(fwd) that are closest
          to x_hinge. Retuns dictionaries aft and fwd, each with keys x and y."""$SEP$#If equal just save and break it$SEP$#Find y hinge$SEP$#Interpolate