docs: def zeq(path_to_file='.', file='', data="", units='U', calculation_type="DE-BFL",
          save=False, save_folder='.', fmt='svg', begin_pca="", end_pca="", angle=0):
      """
      NAME
         zeq.py
  
      DESCRIPTION
         plots demagnetization data for a single specimen:
            - The solid (open) symbols in the Zijderveld diagram are X,Y (X,Z) pairs.  The demagnetization diagram plots the
            fractional remanence remaining after each step. The green line is the fraction of the total remaence removed
            between each step.  If the principle direction is desired, specify begin_pca and end_pca steps as bounds for calculation.
  
            -The equal area projection has the X direction (usually North in geographic coordinates)
            to the top.  The red line is the X axis of the Zijderveld diagram.  Solid symbols are lower hemisphere.
  
            - red dots and blue line is the remanence remaining after each step.  The green line is the partial TRM removed in each interval
  
      INPUT FORMAT
         reads from  file_name or takes a  Pandas DataFrame data with specimen treatment intensity declination inclination   as columns
  
      Keywords:
          file= FILE   a space or tab delimited file with
              specimen  treatment  declination inclination intensity
          units= [mT,C] specify units of mT OR C, default is unscaled
          save=[True,False]  save figure and quit, default is False
          fmt [svg,jpg,png,pdf] set figure format [default is svg]
          begin_pca [step number] treatment step for beginning of PCA calculation, default
          end_pca [step number] treatment step for end of PCA calculation, last step is default
          calculation_type [DE-BFL,DE-BFP,DE-FM] Calculation Type: best-fit line,  plane or fisher mean; line is default
          angle=[0-360]: angle to subtract from declination to rotate in horizontal plane, default is 0
  
      """
      if units == "C":
          SIunits = "K"
      if units == "mT":
          SIunits = "T"
      if units == "U":
          SIunits = "U"
      if file != "":
          f = pd.read_csv(os.path.join(path_to_file, file),
                          delim_whitespace=True, header=None)
          f.columns = ['specimen', 'treatment',
                       'intensity', 'declination', 'inclination']
          # adjust for angle rotation
          f['declination'] = (f['declination']-angle) % 360
          f['quality'] = 'g'
          f['type'] = ''
  #
          s = f['specimen'].tolist()[0]
          if units == 'mT':
              f['treatment'] = f['treatment']*1e-3
          if units == 'C':
              f['treatment'] = f['treatment']+273
          data = f[['treatment', 'declination',
                    'inclination', 'intensity', 'type', 'quality']]
      print(s)
      datablock = data.values.tolist()
  # define figure numbers in a dictionary for equal area, zijderveld,
  #  and intensity vs. demagnetiztion step respectively
      ZED = {}
      ZED['eqarea'], ZED['zijd'],  ZED['demag'] = 2, 1, 3
      plt.figure(num=ZED['zijd'], figsize=(5, 5))
      plt.figure(num=ZED['eqarea'], figsize=(5, 5))
      plt.figure(num=ZED['demag'], figsize=(5, 5))
  #
  #
      pmagplotlib.plot_zed(ZED, datablock, angle, s, SIunits)  # plot the data
  #
  # print out data for this sample to screen
  #
      recnum = 0
      print('step treat  intensity  dec    inc')
      for plotrec in datablock:
          if units == 'mT':
              print('%i  %7.1f %8.3e %7.1f %7.1f ' %
                    (recnum, plotrec[0]*1e3, plotrec[3], plotrec[1], plotrec[2]))
          if units == 'C':
              print('%i  %7.1f %8.3e %7.1f %7.1f ' %
                    (recnum, plotrec[0]-273., plotrec[3], plotrec[1], plotrec[2]))
          if units == 'U':
              print('%i  %7.1f %8.3e %7.1f %7.1f ' %
                    (recnum, plotrec[0], plotrec[3], plotrec[1], plotrec[2]))
          recnum += 1
          pmagplotlib.draw_figs(ZED)
      if begin_pca != "" and end_pca != "" and calculation_type != "":
          pmagplotlib.plot_zed(ZED, datablock, angle, s,
                               SIunits)  # plot the data
          # get best-fit direction/great circle
          mpars = pmag.domean(datablock, begin_pca, end_pca, calculation_type)
          # plot the best-fit direction/great circle
          pmagplotlib.plot_dir(ZED, mpars, datablock, angle)
          print('Specimen, calc_type, N, min, max, MAD, dec, inc')
          if units == 'mT':
              print('%s %s %i  %6.2f %6.2f %6.1f %7.1f %7.1f' % (s, calculation_type,
                                                                 mpars["specimen_n"], mpars["measurement_step_min"]*1e3, mpars["measurement_step_max"]*1e3, mpars["specimen_mad"], mpars["specimen_dec"], mpars["specimen_inc"]))
          if units == 'C':
              print('%s %s %i  %6.2f %6.2f %6.1f %7.1f %7.1f' % (s, calculation_type,
                                                                 mpars["specimen_n"], mpars["measurement_step_min"]-273, mpars["measurement_step_max"]-273, mpars["specimen_mad"], mpars["specimen_dec"], mpars["specimen_inc"]))
          if units == 'U':
              print('%s %s %i  %6.2f %6.2f %6.1f %7.1f %7.1f' % (s, calculation_type,
                                                                 mpars["specimen_n"], mpars["measurement_step_min"], mpars["measurement_step_max"], mpars["specimen_mad"], mpars["specimen_dec"], mpars["specimen_inc"]))
          if save:
              files = {}
              for key in list(ZED.keys()):
                  files[key] = s+'_'+key+'.'+fmt
              pmagplotlib.save_plots(ZED, files)