docs: def dayplot_magic(path_to_file='.', hyst_file="specimens.txt", rem_file='',
                    save=True, save_folder='.', fmt='svg', data_model=3,
                    interactive=False, contribution=None):
      """
      Makes 'day plots' (Day et al. 1977) and squareness/coercivity plots
      (Neel, 1955; plots after Tauxe et al., 2002); plots 'linear mixing'
      curve from Dunlop and Carter-Stiglitz (2006).
  
      Optional Parameters (defaults are used if not specified)
      ----------
      path_to_file : path to directory that contains files (default is current directory, '.')
      the default input file is 'specimens.txt' (data_model=3
      if data_model = 2, then must these are the defaults:
          hyst_file : hysteresis file (default is 'rmag_hysteresis.txt')
          rem_file : remanence file (default is 'rmag_remanence.txt')
      save : boolean argument to save plots (default is True)
      save_folder : relative directory where plots will be saved (default is current directory, '.')
      fmt : format of saved figures (default is 'pdf')
      """
      args = sys.argv
      hyst_path = os.path.join(path_to_file, hyst_file)
      if data_model == 2 and rem_file != '':
          rem_path = os.path.join(path_to_file, rem_file)
      # hyst_file,rem_file="rmag_hysteresis.txt","rmag_remanence.txt"
      dir_path = path_to_file
      verbose = pmagplotlib.verbose
      # initialize some variables
      # define figure numbers for Day,S-Bc,S-Bcr
      DSC = {}
      DSC['day'], DSC['S-Bc'], DSC['S-Bcr'], DSC['bcr1-bcr2'] = 1, 2, 3, 4
      hyst_data, file_type = pmag.magic_read(hyst_path)
      rem_data = []
      if data_model == 2 and rem_file != "":
          rem_data, file_type = pmag.magic_read(rem_path)
      S, BcrBc, Bcr2, Bc, hsids, Bcr = [], [], [], [], [], []
      Ms, Bcr1, Bcr1Bc, S1 = [], [], [], []
      locations = ''
      if data_model == 2:
          for rec in hyst_data:
              if 'er_location_name' in list(rec.keys()) and rec['er_location_name'] not in locations:
                  locations = locations + rec['er_location_name'] + '_'
              if rec['hysteresis_bcr'] != "" and rec['hysteresis_mr_moment'] != "":
                  S.append(old_div(float(rec['hysteresis_mr_moment']), float(
                      rec['hysteresis_ms_moment'])))
                  Bcr.append(float(rec['hysteresis_bcr']))
                  Bc.append(float(rec['hysteresis_bc']))
                  BcrBc.append(old_div(Bcr[-1], Bc[-1]))
                  if 'er_synthetic_name' in list(rec.keys()) and rec['er_synthetic_name'] != "":
                      rec['er_specimen_name'] = rec['er_synthetic_name']
                  hsids.append(rec['er_specimen_name'])
          if len(rem_data) > 0:
              for rec in rem_data:
                  if rec['remanence_bcr'] != "" and float(rec['remanence_bcr']) > 0:
                      try:
                          ind = hsids.index(rec['er_specimen_name'])
                          Bcr1.append(float(rec['remanence_bcr']))
                          Bcr1Bc.append(old_div(Bcr1[-1], Bc[ind]))
                          S1.append(S[ind])
                          Bcr2.append(Bcr[ind])
                      except ValueError:
                          if verbose:
                              print('hysteresis data for ',
                                    rec['er_specimen_name'], ' not found')
      else:
          fnames = {'specimens': hyst_file}
          if contribution:
              con = contribution
          else:
              con = cb.Contribution(dir_path, read_tables=['specimens'],
                                    custom_filenames=fnames)
          if 'specimens' not in con.tables:
              print('-E- No specimen file found in {}'.format(os.path.realpath(dir_path)))
              return False, []
          spec_container = con.tables['specimens']
          spec_df = spec_container.df
  
          # get as much data as possible for naming plots
          #if pmagplotlib.isServer:
          con.propagate_location_to_specimens()
  
  
          loc_list = []
  
          if 'location' in spec_df.columns:
              loc_list = spec_df['location'].unique()
          do_rem = bool('rem_bcr' in spec_df.columns)
  
          for ind, row in spec_df.iterrows():
              if row['hyst_bcr'] and row['hyst_mr_moment']:
                  S.append(
                      old_div(float(row['hyst_mr_moment']), float(row['hyst_ms_moment'])))
                  Bcr.append(float(row['hyst_bcr']))
                  Bc.append(float(row['hyst_bc']))
                  BcrBc.append(old_div(Bcr[-1], Bc[-1]))
                  hsids.append(row['specimen'])
              if do_rem:
                  if row['rem_bcr'] and float(row['rem_bcr']) > 0:
                      try:
                          Bcr1.append(float(row['rem_bcr']))
                          Bcr1Bc.append(old_div(Bcr1[-1], Bc[-1]))
                          S1.append(S[-1])
                          Bcr2.append(Bcr[-1])
                      except ValueError:
                          if verbose:
                              print('hysteresis data for ',
                                    row['specimen'], end=' ')
                              print(' not found')
  
      #
      # now plot the day and S-Bc, S-Bcr plots
      #
      fnames = {'day': os.path.join(save_folder, "_".join(loc_list) + '_Day.' + fmt),
            'S-Bcr': os.path.join(save_folder, "_".join(loc_list) + '_S-Bcr.' + fmt),
            'S-Bc': os.path.join(save_folder, "_".join(loc_list) + '_S-Bc.' + fmt)}
      if len(Bcr1) > 0:
  
          plt.figure(num=DSC['day'], figsize=(5, 5))
          #plt.figure(num=DSC['S-Bc'], figsize=(5, 5))
          plt.figure(num=DSC['S-Bcr'], figsize=(5, 5))
          plt.figure(num=DSC['bcr1-bcr2'], figsize=(5, 5))
  
          pmagplotlib.plot_day(DSC['day'], Bcr1Bc, S1, 'ro')
          pmagplotlib.plot_s_bcr(DSC['S-Bcr'], Bcr1, S1, 'ro')
          #pmagplotlib.plot_init(DSC['bcr1-bcr2'], 5, 5)
          pmagplotlib.plot_bcr(DSC['bcr1-bcr2'], Bcr1, Bcr2)
          fnames.pop('S-Bc')
          fnames['bcr1-bcr2'] = os.path.join(save_folder, 'bcr1-bcr2.png')
          DSC.pop('S-Bc')
          if pmagplotlib.isServer:
              for key in list(DSC.keys()):
                  fnames[key] = 'LO:_' + ":".join(set(loc_list)) + '_' + 'SI:__SA:__SP:__TY:_' + key + '_.' + fmt
          if save:
              pmagplotlib.save_plots(DSC, fnames, incl_directory=True)
              return True, fnames.values()
          if interactive:
              pmagplotlib.draw_figs(DSC)
              ans = pmagplotlib.save_or_quit()
              if ans == 'a':
                  pmagplotlib.save_plots(DSC, fnames, incl_directory=True)
                  return True, fnames.values()
  
      else:
          plt.figure(num=DSC['day'], figsize=(5, 5))
          plt.figure(num=DSC['S-Bc'], figsize=(5, 5))
          plt.figure(num=DSC['S-Bcr'], figsize=(5, 5))
          #plt.figure(num=DSC['bcr1-bcr2'], figsize=(5, 5))
          del DSC['bcr1-bcr2']
          # do other plots instead
          pmagplotlib.plot_day(DSC['day'], BcrBc, S, 'bs')
          pmagplotlib.plot_s_bcr(DSC['S-Bcr'], Bcr, S, 'bs')
          pmagplotlib.plot_s_bc(DSC['S-Bc'], Bc, S, 'bs')
      if pmagplotlib.isServer:
          for key in list(DSC.keys()):
              fnames[key] = 'LO:_' + ":".join(set(loc_list)) + '_' + 'SI:__SA:__SP:__TY:_' + key + '_.' + fmt
      if save:
          pmagplotlib.save_plots(DSC, fnames, incl_directory=True)
          return True, fnames.values()
      elif interactive:
          pmagplotlib.draw_figs(DSC)
          ans = pmagplotlib.save_or_quit()
          if ans == 'a':
              pmagplotlib.save_plots(DSC, fnames, incl_directory=True)
              return True, fnames.values()
      return True, []