docs: def criteria_extract(crit_file='criteria.txt', output_file='criteria.xls',
                       output_dir_path='.', input_dir_path='', latex=False):
      """
      Extracts criteria  from a MagIC 3.0 format criteria.txt file.
      Default output format is an Excel file.
      typeset with latex on your own computer.
  
      Parameters
      ___________
      crit_file : str, default "criteria.txt"
           input file name
      output_file : str, default "criteria.xls"
           output file name
      output_dir_path : str, default "."
          output file directory
      input_dir_path : str, default ""
            path for intput file if different from output_dir_path (default is same)
      latex : boolean, default False
             if True, output file should be latex formatted table with a .tex ending
  
      Return :
          [True,False],  data table error type : True if successful
  
      Effects :
          writes xls or latex formatted tables for use in publications
      """
      input_dir_path, output_dir_path = pmag.fix_directories(input_dir_path, output_dir_path)
      try:
          fname = pmag.resolve_file_name(crit_file, input_dir_path)
      except IOError:
          print("bad criteria file name")
          return False, "bad criteria file name"
      crit_df = pd.read_csv(fname, sep='\t', header=1)
      if len(crit_df) > 0:
          out_file = pmag.resolve_file_name(output_file, output_dir_path)
  
          s = crit_df['table_column'].str.split(pat='.', expand=True)
          crit_df['table'] = s[0]
          crit_df['column'] = s[1]
          crit_df = crit_df[['table', 'column',
                             'criterion_value', 'criterion_operation']]
  
          crit_df.columns = ['Table', 'Statistic', 'Threshold', 'Operation']
  
          if latex:
              if out_file.endswith('.xls'):
                  out_file = out_file.rsplit('.')[0] + ".tex"
              crit_df.loc[crit_df['Operation'].str.contains(
                  '<'), 'operation'] = 'maximum'
              crit_df.loc[crit_df['Operation'].str.contains(
                  '>'), 'operation'] = 'minimum'
              crit_df.loc[crit_df['Operation'] == '=', 'operation'] = 'equal to'
              info_out = open(out_file, 'w+', errors="backslashreplace")
              info_out.write('\documentclass{article}\n')
              info_out.write('\\usepackage{booktabs}\n')
              # info_out.write('\\usepackage{longtable}\n')
              # T1 will ensure that symbols like '<' are formatted correctly
              info_out.write("\\usepackage[T1]{fontenc}\n")
              info_out.write('\\begin{document}')
              info_out.write(crit_df.to_latex(index=False, longtable=False,
                                              escape=True, multicolumn=False))
              info_out.write('\end{document}\n')
              info_out.close()
          else:
              crit_df.to_excel(out_file, index=False)
  
      else:
          print("No criteria   for ouput.")
      return True, [out_file]