def update_pmag_tables(self):
        """
        Reads pmag tables from data model 2.5 and updates them with updates
        their data
        """
        pmag_specimens, pmag_samples, pmag_sites = [], [], []
        print("-I- Reading previous interpretations from specimen/sample/site tables")
        try:
            pmag_specimens, file_type = pmag.magic_read(
                os.path.join(self.WD, "pmag_specimens.txt"))
        except:
            print("-I- Can't read pmag_specimens.txt")
        try:
            pmag_samples, file_type = pmag.magic_read(
                os.path.join(self.WD, "pmag_samples.txt"))
        except:
            print("-I- Can't read pmag_samples.txt")
        try:
            pmag_sites, file_type = pmag.magic_read(
                os.path.join(self.WD, "pmag_sites.txt"))
        except:
            print("-I- Can't read pmag_sites.txt")
        # --------------------------
        # reads pmag_specimens.txt and
        # update pmag_results_data['specimens'][specimen]
        # with the new interpretation
        # --------------------------

        if self.COORDINATE_SYSTEM == 'geographic':
            current_tilt_correction = 0
        elif self.COORDINATE_SYSTEM == 'tilt-corrected':
            current_tilt_correction = 100
        else:
            current_tilt_correction = -1

        if 'specimens' not in list(self.pmag_results_data.keys()):
            self.pmag_results_data['specimens'] = {}
        for rec in pmag_specimens:
            if 'er_specimen_name' in rec:
                specimen = rec['er_specimen_name']
            else:
                continue

            # initialize list of interpretations
            if specimen not in list(self.pmag_results_data['specimens'].keys()):
                self.pmag_results_data['specimens'][specimen] = []

            if any(k not in list(rec.keys()) for k in ['measurement_step_min', 'measurement_step_max']):
                continue

            methods = rec['magic_method_codes'].strip(
                "\n").replace(" ", "").split(":")
            LPDIR = False
            calculation_type = ""

            for method in methods:
                if "LP-DIR" in method:
                    LPDIR = True
                if "DE-" in method:
                    calculation_type = method

            msu = ''
            if 'measurement_step_unit' in list(rec.keys()):
                msu = rec['measurement_step_unit']

            # if interpretation doesn't exsist create it.
            if float(rec['measurement_step_min']) == 0. or float(rec['measurement_step_min']) == 273.:
                tmin = "0"
            elif msu == 'K' or float(rec['measurement_step_min']) > 3.:  # thermal
                tmin = "%.0fC" % (float(rec['measurement_step_min'])-273.)
            else:  # AF
                tmin = "%.1fmT" % (float(rec['measurement_step_min'])*1000.)

            if float(rec['measurement_step_max']) == 0. or float(rec['measurement_step_max']) == 273.:
                tmax = "0"
            elif msu == 'K' or float(rec['measurement_step_max']) > 3.:  # thermal
                tmax = "%.0fC" % (float(rec['measurement_step_max'])-273.)
            else:  # AF
                tmax = "%.1fmT" % (float(rec['measurement_step_max'])*1000.)

            if 'specimen_comp_name' in list(rec.keys()):
                fname = rec['specimen_comp_name']
            else:
                fname = None
            if calculation_type == "":
                calculation_type = "DE-BFL"

            if (tmin, tmax) in [(f.tmin, f.tmax) for f in self.pmag_results_data['specimens'][specimen]] and calculation_type in [f.PCA_type for f in self.pmag_results_data['specimens'][specimen]]:
                fit = None
            else:
                fit = self.add_fit(specimen, fname, tmin,
                                   tmax, calculation_type)

            if 'specimen_flag' in list(rec.keys()) and rec['specimen_flag'] == 'b':
                self.bad_fits.append(fit)

        # BUG FIX-almost replaced first sample with last due to above assignment to self.s
        if self.specimens:
            self.select_specimen(self.specimens[0])
            self.specimens_box.SetSelection(0)
        if self.s in self.pmag_results_data['specimens'] and self.pmag_results_data['specimens'][self.s]:
            self.initialize_CART_rot(self.specimens[0])
            self.pmag_results_data['specimens'][self.s][-1].select()

        # --------------------------
        # reads pmag_sample.txt and
        # if finds a mean in pmag_samples.txt
        # calculate the mean for self.high_level_means['samples'][samples]
        # If the program finds a codes "DE-FM","DE-FM-LP","DE-FM-UV"in magic_method_codes
        # then the program repeat teh fisher mean
        # --------------------------

        for rec in pmag_samples:
            if "magic_method_codes" in list(rec.keys()):
                methods = rec['magic_method_codes'].strip(
                    "\n").replace(" ", "").split(":")

            else:
                methods = ""
            sample = rec['er_sample_name'].strip("\n")
            LPDIR = False
            calculation_method = ""
            for method in methods:
                if "LP-DIR" in method:
                    LPDIR = True
                if "DE-" in method:
                    calculation_method = method
            if LPDIR:  # this a mean of directions
                calculation_type = "Fisher"
                for dirtype in self.dirtypes:
                    self.calculate_high_level_mean(
                        'samples', sample, calculation_type, 'specimens', self.mean_fit)

        # --------------------------
        # reads pmag_sites.txt and
        # if finds a mean in pmag_sites.txt
        # calculate the mean for self.high_level_means['sites'][site]
        # using specimens or samples, depends on the er_specimen_names or er_samples_names
        #  The program repeat the fisher calculation and oevrwrites it
        # --------------------------

        for rec in pmag_sites:
            methods = rec['magic_method_codes'].strip(
                "\n").replace(" ", "").split(":")
            site = rec['er_site_name'].strip("\n")
            LPDIR = False
            calculation_method = ""
            elements_type = "specimens"
            for method in methods:
                if "LP-DIR" in method or "DA-DIR" in method or "DE-FM" in method:
                    LPDIR = True
                if "DE-" in method:
                    calculation_method = method
            if LPDIR:  # this a mean of directions
                if calculation_method in ["DE-BS"]:
                    calculation_type = "Bingham"
                else:
                    calculation_type = "Fisher"
                if 'er_sample_names' in list(rec.keys()) and len(rec['er_sample_names'].strip('\n').replace(" ", "").split(":")) > 0:
                    elements_type = 'samples'
                if 'er_specimen_names' in list(rec.keys()) and len(rec['er_specimen_names'].strip('\n').replace(" ", "").split(":")) > 0:
                    elements_type = 'specimens'
                self.calculate_high_level_mean(
                    'sites', site, calculation_type, elements_type, self.mean_fit)