nodes: 0, module; 1, function_definition; 2, function_name:qzordered; 3, parameters; 4, block; 5, identifier:A; 6, identifier:B; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, function_definition; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:crit; 15, float:1.0; 16, string:"Eigenvalues bigger than crit are sorted in the top-left."; 17, assignment; 18, function_name:select; 19, parameters; 20, block; 21, assignment; 22, assignment; 23, list; 24, identifier:TOL; 25, float:1e-10; 26, identifier:alpha; 27, identifier:beta; 28, return_statement; 29, list_pattern; 30, call; 31, identifier:eigval; 32, call; 33, identifier:S; 34, identifier:T; 35, identifier:U; 36, identifier:V; 37, identifier:eigval; 38, comparison_operator:alpha**2>crit*beta**2; 39, identifier:S; 40, identifier:T; 41, identifier:alpha; 42, identifier:beta; 43, identifier:U; 44, identifier:V; 45, identifier:ordqz; 46, argument_list; 47, identifier:abs; 48, argument_list; 49, binary_operator:alpha**2; 50, binary_operator:crit*beta**2; 51, identifier:A; 52, identifier:B; 53, keyword_argument; 54, keyword_argument; 55, binary_operator:numpy.diag(S)/numpy.diag(T); 56, identifier:alpha; 57, integer:2; 58, identifier:crit; 59, binary_operator:beta**2; 60, identifier:output; 61, string; 62, identifier:sort; 63, identifier:select; 64, call; 65, call; 66, identifier:beta; 67, integer:2; 68, string_content:real; 69, attribute; 70, argument_list; 71, attribute; 72, argument_list; 73, identifier:numpy; 74, identifier:diag; 75, identifier:S; 76, identifier:numpy; 77, identifier:diag; 78, identifier:T
code: def qzordered(A,B,crit=1.0):
      "Eigenvalues bigger than crit are sorted in the top-left."
  
      TOL = 1e-10
  
      def select(alpha, beta):
          return alpha**2>crit*beta**2
  
      [S,T,alpha,beta,U,V] = ordqz(A,B,output='real',sort=select)
  
      eigval = abs(numpy.diag(S)/numpy.diag(T))
  
      return [S,T,U,V,eigval]