docs: def plot_dmag(data="", title="", fignum=1, norm=1,dmag_key='treat_ac_field',intensity='',
               quality=False):
      """
      plots demagenetization data versus step for all specimens in pandas dataframe datablock
  
      Parameters
      ______________
      data : Pandas dataframe with MagIC data model 3 columns:
          fignum : figure number
          specimen : specimen name
          dmag_key : one of these: ['treat_temp','treat_ac_field','treat_mw_energy']
              selected using method_codes : ['LT_T-Z','LT-AF-Z','LT-M-Z'] respectively
          intensity  : if blank will choose one of these: ['magn_moment', 'magn_volume', 'magn_mass']
          quality : if True use the quality column of the DataFrame
       title : title for plot
       norm : if True, normalize data to first step
      Output :
        matptlotlib plot
     """
      plt.figure(num=fignum, figsize=(5, 5))
      if intensity:
          int_key=intensity
      else:
          intlist = ['magn_moment', 'magn_volume', 'magn_mass']
      # get which key we have
          IntMeths = [col_name for col_name in data.columns if col_name in intlist]
          int_key = IntMeths[0]
      data = data[data[int_key].notnull()]  # fish out all data with this key
      units = "U"  # this  sets the units for plotting to undefined
      if not dmag_key:
          if 'treat_temp' in data.columns: units = "K"  # kelvin
          elif 'treat_ac_field' in data.columns: units = "T"  # tesla
          elif 'treat_mw_energy' in data.columns: units = "J"  # joules
      if dmag_key=='treat_temp': units='K'
      if dmag_key=='treat_ac_field': units='T'
      if dmag_key=='treat_mw_energy': units='J'
      spcs = data.specimen.unique()  # get a list of all specimens in DataFrame data
      if len(spcs)==0:
          print('no data for plotting')
          return
      # step through specimens to put on plot
      for spc in spcs:
          spec_data = data[data.specimen.str.contains(spc)]
          INTblock = []
          for ind, rec in spec_data.iterrows():
              INTblock.append([float(rec[dmag_key]), 0, 0,
                               float(rec[int_key]), 1, rec['quality']])
          if len(INTblock) > 2:
              pmagplotlib.plot_mag(fignum, INTblock, title, 0, units, norm)