docs: def mini(magfile, dir_path='.', meas_file='measurements.txt',
           data_model_num=3, volume=12, noave=0,
           inst="", user="", methcode="LP-NO", input_dir_path=""):
      """
      Convert the Yale minispin format to MagIC format files
  
      Parameters
      ----------
      magfile : str
          input file name, required
      dir_path : str
          working directory, default "."
      meas_file : str
          output measurement file name, default "measurements.txt"
      data_model_num : int
          MagIC data model 2 or 3, default 3
      volume : float
          volume in ccs, default 12.
      noave : bool
         do not average duplicate measurements, default False (so by default, DO average)
      inst : str
          instrument, default ""
      user : str
          user name, default ""
      methcode : str
          colon-delimited protocols, include all that apply
          default "LP-NO"
          options include "AF" for demag and "T" for thermal
      input_dir_path : str,
          input file directory IF different from dir_path, default ""
  
      Returns
      ---------
      Tuple : (True or False indicating if conversion was sucessful, meas_file name written)
  
      """
  
      codes = methcode.split(':')
      demag = "N"
      if "AF" in codes:
          demag = 'AF'
          methcode = "LT-AF-Z"
      if "T" in codes:
          demag = "T"
          methcode = "LP-TRM-TD"
  
      # initialize
      citation = 'This study'
      MagRecs = []
      version_num = pmag.get_version()
      input_dir_path, dir_path = pmag.fix_directories(input_dir_path, dir_path)
      magfile = pmag.resolve_file_name(magfile, input_dir_path)
      input_dir_path = os.path.split(magfile)[0]
      try:
          with open(magfile, 'r') as finput:
              lines = finput.readlines()
      except OSError:
          print("bad mag file name")
          return False, "bad mag file name"
      # convert volume
      volume = 1e-6 * float(volume)
      # set col names based on MagIC 2 or 3
      if data_model_num == 2:
          spec_col = "er_specimen_name"
          loc_col = "er_location_name"
          site_col = "er_site_col"
          samp_col = "er_sample_name"
          software_col = "magic_software_packages"
          treat_temp_col = "treatment_temp"
          meas_temp_col = "measurement_temp"
          treat_ac_col = "treatment_ac_field"
          treat_dc_col = "treatment_dc_field"
          treat_dc_phi_col = "treatment_dc_field_phi"
          treat_dc_theta_col = "treatment_dc_field_theta"
          moment_col = "measurement_magn_moment"
          dec_col = "measurement_dec"
          inc_col = "measurement_inc"
          instrument_col = "magic_instrument_codes"
          analyst_col = "er_analyst_mail_names"
          citations_col = "er_citation_names"
          methods_col = "magic_method_codes"
          quality_col = "measurement_flag"
          meas_standard_col = "measurement_standard"
          meas_name_col = "measurement_number"
      else:
          spec_col = "specimen"
          loc_col = "location"
          site_col = "site"
          samp_col = "sample"
          software_col = "software_packages"
          treat_temp_col = "treat_temp"
          meas_temp_col = "meas_temp"
          treat_ac_col = "treat_ac_field"
          treat_dc_col = "treat_dc_field"
          treat_dc_phi_col = "treat_dc_field_phi"
          treat_dc_theta_col = "treat_dc_field_theta"
          moment_col = "magn_moment"
          dec_col = "dir_dec"
          inc_col = "dir_inc"
          instrument_col = "instrument_codes"
          analyst_col = "analysts"
          citations_col = "citations"
          methods_col = "method_codes"
          quality_col = "quality"
          meas_standard_col = "standard"
          meas_name_col = "experiment"
          meas_seq_col = "sequence"
  
      # go through the measurements
      seq=1
      for line in lines:
          rec = line.split(',')
          if len(rec) > 1:
              MagRec = {}
              IDs = rec[0].split('_')
              treat = IDs[1]
              MagRec[spec_col] = IDs[0]
              # print(MagRec[spec_col])
              sids = IDs[0].split('-')
              MagRec[loc_col] = sids[0]
              MagRec[site_col] = sids[0]+'-'+sids[1]
              if len(sids) == 2:
                  MagRec[samp_col] = IDs[0]
              else:
                  MagRec[samp_col] = sids[0]+'-'+sids[1]+'-'+sids[2]
              # print(MagRec)
              MagRec[software_col] = version_num
              MagRec[treat_temp_col] = '%8.3e' % (273)  # room temp in kelvin
              MagRec[meas_temp_col] = '%8.3e' % (273)  # room temp in kelvin
              MagRec[treat_ac_col] = '0'
              MagRec[treat_dc_col] = '0'
              MagRec[treat_dc_phi_col] = '0'
              MagRec[treat_dc_theta_col] = '0'
              meas_type = "LT-NO"
              if demag == "AF":
                  MagRec[treat_ac_col] = '%8.3e' % (
                      float(treat)*1e-3)  # peak field in tesla
              if demag == "T":
                  meas_type = "LT-T-Z"
                  MagRec[treat_dc_col] = '%8.3e' % (0)
                  MagRec[treat_ac_col] = '0'
                  MagRec[treat_temp_col] = '%8.3e' % (
                      float(treat)+273.)  # temp in kelvin
              if demag == "N":
                  meas_type = "LT-NO"
                  MagRec[treat_ac_col] = '0'
                  MagRec[treat_dc_col] = '0'
              MagRec[moment_col] = '%10.3e' % (
                  volume*float(rec[3])*1e-3)  # moment in Am2 (from mA/m)
              MagRec[dec_col] = rec[1]
              MagRec[inc_col] = rec[2]
              MagRec[instrument_col] = inst
              MagRec[analyst_col] = user
              MagRec[citations_col] = citation
              MagRec[methods_col] = methcode.strip(':')
              MagRec[quality_col] = 'g'
              MagRec[meas_standard_col] = 'u'
              MagRec[meas_name_col] = '1'
              MagRecs.append(MagRec)
  
      if data_model_num == 2:
          MagOuts = pmag.measurements_methods(MagRecs, noave)
          pmag.magic_write(meas_file, MagOuts, 'magic_measurements')
      else:
          MagOuts = pmag.measurements_methods3(MagRecs, noave)
          pmag.magic_write(meas_file, MagOuts, 'measurements')
          # nicely parse all the specimen/sample/site/location data
          # and write it to file as well
          dir_path = os.path.split(meas_file)[0]
          con = cb.Contribution(dir_path, read_tables=['measurements'],
                                custom_filenames={'measurements': meas_file})
          con.propagate_measurement_info()
          for table in con.tables:
              con.write_table_to_file(table)
      print("results put in ", meas_file)
      return True, meas_file