docs: def On_close_criteria_box(self, dia):
          """
          after criteria dialog window is closed.
          Take the acceptance criteria values and update
          self.acceptance_criteria
          """
          criteria_list = list(self.acceptance_criteria.keys())
          criteria_list.sort()
  
          #---------------------------------------
          # check if averaging by sample or by site
          # and intialize sample/site criteria
          #---------------------------------------
          avg_by = dia.set_average_by_sample_or_site.GetValue()
          if avg_by == 'sample':
              for crit in ['site_int_n', 'site_int_sigma', 'site_int_sigma_perc', 'site_aniso_mean', 'site_int_n_outlier_check']:
                  self.acceptance_criteria[crit]['value'] = -999
  
          if avg_by == 'site':
              for crit in ['sample_int_n', 'sample_int_sigma', 'sample_int_sigma_perc', 'sample_aniso_mean', 'sample_int_n_outlier_check']:
                  self.acceptance_criteria[crit]['value'] = -999
  
          #---------
          # get value for each criterion
          for i in range(len(criteria_list)):
              crit = criteria_list[i]
              value, accept = dia.get_value_for_crit(crit, self.acceptance_criteria)
              if accept:
                  self.acceptance_criteria.update(accept)
          #---------
          # thellier interpreter calculation type
          if dia.set_stdev_opt.GetValue() == True:
              self.acceptance_criteria['interpreter_method']['value'] = 'stdev_opt'
          elif dia.set_bs.GetValue() == True:
              self.acceptance_criteria['interpreter_method']['value'] = 'bs'
          elif dia.set_bs_par.GetValue() == True:
              self.acceptance_criteria['interpreter_method']['value'] = 'bs_par'
  
          #  message dialog
          dlg1 = wx.MessageDialog(
              self, caption="Warning:", message="changes are saved to the criteria file\n ", style=wx.OK)
          result = self.show_dlg(dlg1)
          if result == wx.ID_OK:
              try:
                  self.clear_boxes()
              except IndexError:
                  pass
              try:
                  self.write_acceptance_criteria_to_boxes()
              except IOError:
                  pass
              if self.data_model == 3:
                  crit_file = 'criteria.txt'
              else:
                  crit_file = 'pmag_criteria.txt'
              try:
                  pmag.write_criteria_to_file(os.path.join(
                      self.WD, crit_file), self.acceptance_criteria, data_model=self.data_model, prior_crits=self.crit_data)
              except AttributeError as ex:
                  print(ex)
                  print("no criteria given to save")
              dlg1.Destroy()
              dia.Destroy()
  
          self.fig4.texts[0].remove()
          txt = "{} data".format(avg_by).capitalize()
          self.fig4.text(0.02, 0.96, txt, {
                         'family': self.font_type, 'fontsize': 10, 'style': 'normal', 'va': 'center', 'ha': 'left'})
          self.recalculate_satistics()
          try:
              self.update_GUI_with_new_interpretation()
          except KeyError:
              pass