docs: def chi_magic(infile="measurements.txt", dir_path=".", experiments="",
                fmt="svg", save_plots=True, interactive=False, contribution=None):
      """
      Parameters
      ----------
      infile : str, default "measurements.txt"
          measurement infile
      dir_path : str, default "."
          input directory
      experiments : str, default ""
          experiment name to plot
      fmt : str, default "svg"
          format for figures, ["svg", "jpg", "pdf", "png"]
      save_plots : bool, default True
          save figures
      interactive : bool, default False
          if True, interactively plot and display
          (this is best used on the command line only)
      contribution : cb.Contribution, default None
          if provided, use Contribution object instead of reading in
          data from files
  
      Returns
      ---------
      (status, output_files) - Tuple : (True or False indicating if conversion was sucessful, file name(s) written)
      """
      saved = []
      if contribution:
          chi_data_all = contribution.tables['measurements'].df
      else:
          infile = pmag.resolve_file_name(infile, dir_path)
          chi_data_all = pd.read_csv(infile, sep='\t', header=1)
      if not experiments:
          try:
              experiments = chi_data_all.experiment.unique()
          except Exception as ex:
              print(ex)
              experiments = ["all"]
      else:
           experiments = [experiments]
  
      plotnum = 0
      figs = {}
      fnames = {}
      for exp in experiments:
          if exp == "all":
              chi_data = chi_data_all
          chi_data = chi_data_all[chi_data_all.experiment == exp]
          if len(chi_data) <= 1:
              print('Not enough data to plot {}'.format(exp))
              continue
  
          plotnum += 1
          if not save_plots:
              pmagplotlib.plot_init(plotnum, 5, 5)  # set up plot
          else:
              plt.figure(plotnum)
          figs[str(plotnum)] = plotnum
          fnames[str(plotnum)] = exp + '_temperature.{}'.format(fmt)
  
          # get arrays of available temps, frequencies and fields
          Ts = np.sort(chi_data.meas_temp.unique())
          Fs = np.sort(chi_data.meas_freq.unique())
          Bs = np.sort(chi_data.meas_field_ac.unique())
  
          # plot chi versus temperature at constant field
          b = Bs.max()
          for num, f in enumerate(Fs):
              this_f = chi_data[chi_data.meas_freq == f]
              this_f = this_f[this_f.meas_field_ac == b]
              plt.plot(this_f.meas_temp, 1e6*this_f.susc_chi_volume,
                       label='%i' % (f)+' Hz')
          plt.legend()
          plt.xlabel('Temperature (K)')
          plt.ylabel('$\chi$ ($\mu$SI)')
          plt.title('B = '+'%7.2e' % (b) + ' T')
  
          plotnum += 1
          figs[str(plotnum)] = plotnum
          fnames[str(plotnum)] = exp + '_frequency.{}'.format(fmt)
  
          if not save_plots:
              pmagplotlib.plot_init(plotnum, 5, 5)  # set up plot
          else:
              plt.figure(plotnum)
          ## plot chi versus frequency at constant B
          b = Bs.max()
          t = Ts.min()
          this_t = chi_data[chi_data.meas_temp == t]
          this_t = this_t[this_t.meas_field_ac == b]
          plt.semilogx(this_t.meas_freq, 1e6 *
                       this_t.susc_chi_volume, label='%i' % (t)+' K')
          plt.legend()
          plt.xlabel('Frequency (Hz)')
          plt.ylabel('$\chi$ ($\mu$SI)')
          plt.title('B = '+'%7.2e' % (b) + ' T')
  
      if interactive:
          pmagplotlib.draw_figs(figs)
          ans = input(
              "enter s[a]ve to save files,  [return] to quit ")
          if ans == 'a':
              saved.extend(pmagplotlib.save_plots(figs, fnames))
          else:
              return True, []
      elif save_plots:
          saved.extend(pmagplotlib.save_plots(figs, fnames))
  
      return True, saved