Пример #1
0
    def _sync(self, obj):

        for dbiso in obj.isotopes:
            r = dbiso.results[-1]
            uv = r.Iso
            ee = r.IsoEr

            bv = r.Bkgd
            be = r.BkgdEr

            key = dbiso.Label
            n = dbiso.NumCnts
            iso = Isotope(name=key, value=uv, error=ee, n=n)
            det =dbiso.detector
            iso.ic_factor=ufloat(det.ICFactor, det.ICFactorEr)
            iso.fit = r.fit.Label.lower()

            iso.baseline = Baseline(name=key,
                                    reverse_unpack=True,
                                    dbrecord=dbiso.baseline,
                                    unpack=True,
                                    unpacker=lambda x: x.PeakTimeBlob,
                                    error_type='SEM',
                                    fit='average')
            iso.baseline.set_filter_outliers_dict()

            iso.blank = Blank(name=key, value=bv, error=be)
            self.isotopes[key] = iso
Пример #2
0
    def _sync(self, obj):
        for dbiso in obj.isotopes:
            r = dbiso.results[-1]
            uv = r.Iso
            ee = r.IsoEr

            bv = r.Bkgd
            be = r.BkgdEr

            key = dbiso.Label
            iso = Isotope(name=key, value=uv, error=ee)

            iso.baseline = Baseline(name=key,
                                    reverse_unpack=True,
                                    dbrecord=dbiso.baseline,
                                    unpacker=lambda x: x.PeakTimeBlob,
                                    fit='average_SEM')

            iso.blank = Blank(name=key, value=bv, error=be)
            self.isotopes[key] = iso
Пример #3
0
    def _sync(self, obj):

        arar = obj.araranalyses[-1]
        if arar:
            self.j = ufloat(arar.JVal, arar.JEr)
            self.age = arar.Age
            self.age_err = arar.ErrAge
            self.age_err_wo_j = arar.ErrAgeWOErInJ
            self.rad40_percent = ufloat(arar.PctRad, arar.PctRadEr)

        for dbiso in obj.isotopes:
            r = dbiso.results[-1]
            uv = r.Iso
            ee = r.IsoEr

            bv = r.Bkgd
            be = r.BkgdEr

            key = dbiso.Label
            n = dbiso.NumCnts
            iso = Isotope(name=key, value=uv, error=ee, n=n)
            det =dbiso.detector
            iso.ic_factor=ufloat(det.ICFactor, det.ICFactorEr)
            iso.fit = r.fit.Label.lower()

            iso.baseline = Baseline(name=key,
                                    reverse_unpack=True,
                                    dbrecord=dbiso.baseline,
                                    unpack=True,
                                    unpacker=lambda x: x.PeakTimeBlob,
                                    error_type='SEM',
                                    fit='average')
            iso.baseline.set_filter_outliers_dict()

            iso.blank = Blank(name=key, value=bv, error=be)
            self.isotopes[key] = iso
Пример #4
0
    def _sync(self, obj):

        self.j = ufloat(0, 0)
        self.age = 0
        self.age_err = 0
        self.age_err_wo_j = 0
        self.radiogenic_yield = ufloat(0, 0)
        self.rad4039 = ufloat(0, 0)

        arar = None
        if obj.araranalyses:
            arar = obj.araranalyses[-1]
            if arar:
                self.j = ufloat(arar.JVal, arar.JEr)
                self.age = arar.Age
                self.age_err = arar.ErrAge
                self.age_err_wo_j = arar.ErrAgeWOErInJ
                self.radiogenic_yield = ufloat(arar.PctRad, arar.PctRadEr)
                self.rad4039 = ufloat(arar.Rad4039, arar.Rad4039Er)
                self.r3739 = ufloat(arar.R3739Cor, arar.ErR3739Cor)
                self.Cl3839 = ufloat(arar.Cl3839, 0)
                try:
                    self.kca = ufloat(arar.CaOverK, arar.CaOverKEr)**-1
                except ZeroDivisionError:
                    self.kca = 0

                try:
                    self.kcl = ufloat(arar.ClOverK, arar.ClOverKEr)**-1
                except ZeroDivisionError:
                    self.kcl = 0

        changeable = obj.changeable
        fo, fi, fs = 0, 0, 0
        if changeable:
            self.comment = changeable.Comment
            self.tag = STATUS_MAP.get(changeable.StatusLevel)
            prefs = changeable.preferences_set
            if prefs:
                fo = prefs.DelOutliersAfterFit == 'true'
                fi = int(prefs.NFilterIter)
                fs = int(prefs.OutlierSigmaFactor)
                self.lambda_k = prefs.Lambda40Kepsilon + prefs.Lambda40KBeta
                self.lambda_Ar37 = prefs.LambdaAr37
                self.lambda_Ar39 = prefs.LambdaAr39
                self.lambda_Cl36 = prefs.LambdaCl36

        for dbiso in obj.isotopes:
            r = dbiso.results[-1]
            uv, ee = self._intercept_value(r)
            key = dbiso.Label
            n = dbiso.NumCnts
            det = dbiso.detector
            iso = Isotope(key, det.detector_type.Label)
            iso.baseline_corrected = ufloat(uv, ee)
            tv, te = 0, 0
            if arar:
                try:
                    k = key[2:]
                    tv, te = getattr(arar, 'Tot{}'.format(k)), getattr(
                        arar, 'Tot{}Er'.format(k))
                except AttributeError:
                    pass

            iso.set_filter_outliers_dict(filter_outliers=fo,
                                         iterations=fi,
                                         std_devs=fs)
            iso.total_value = ufloat(tv, te)
            # iso.set_uvalue((uv, ee))
            iso.n = n

            iso.ic_factor = ufloat(det.ICFactor, det.ICFactorEr)

            iso.fit = r.fit.Label.lower() if r.fit else ''

            iso.baseline = Baseline(key, det.detector_type.Label)

            iso.baseline.fit = 'average'
            iso.baseline.set_filter_outliers_dict(filter_outliers=fo,
                                                  iterations=fi,
                                                  std_devs=fs)

            iso.baseline.n = dbiso.baseline.NumCnts

            # uv = iso.baseline_corrected + iso.baseline.uvalue
            # print('asdf',key, uv, iso.baseline_corrected, iso.baseline.uvalue)
            # iso.value = nominal_value(uv)
            # iso.error = std_dev(uv)
            # iso.set_uvalue()
            blank = self._blank(r)
            if blank:
                iso.blank.set_uvalue(blank)

            self.isotopes[key] = iso
Пример #5
0
    def _sync(self, obj):

        self.j = ufloat(0, 0)
        self.age = 0
        self.age_err = 0
        self.age_err_wo_j = 0
        self.rad40_percent = ufloat(0, 0)
        self.rad4039 = ufloat(0, 0)

        arar = None
        if obj.araranalyses:
            arar = obj.araranalyses[-1]
            if arar:
                self.j = ufloat(arar.JVal, arar.JEr)
                self.age = arar.Age
                self.age_err = arar.ErrAge
                self.age_err_wo_j = arar.ErrAgeWOErInJ
                self.rad40_percent = ufloat(arar.PctRad, arar.PctRadEr)
                self.rad4039 = ufloat(arar.Rad4039, arar.Rad4039Er)
                self.r3739 = ufloat(arar.R3739Cor, arar.ErR3739Cor)
                self.Cl3839 = ufloat(arar.Cl3839, 0)
                self.kca = ufloat(arar.CaOverK, arar.CaOverKEr) ** -1
                self.kcl = ufloat(arar.ClOverK, arar.ClOverKEr) ** -1

        prefs = obj.changeable.preferences_set
        fo, fi, fs = 0, 0, 0
        if prefs:
            fo = prefs.DelOutliersAfterFit == 'true'
            fi = int(prefs.NFilterIter)
            fs = int(prefs.OutlierSigmaFactor)
            self.lambda_k = prefs.Lambda40Kepsilon + prefs.Lambda40KBeta
            self.lambda_Ar37 = prefs.LambdaAr37
            self.lambda_Ar39 = prefs.LambdaAr39
            self.lambda_Cl36 = prefs.LambdaCl36

        for dbiso in obj.isotopes:
            r = dbiso.results[-1]
            uv, ee = self._intercept_value(r)

            key = dbiso.Label
            n = dbiso.NumCnts
            det = dbiso.detector
            iso = Isotope(key, det.detector_type.Label)
            iso.baseline_corrected = ufloat(uv, ee)
            tv, te = 0, 0
            if arar:
                try:
                    k = key[2:]
                    tv, te = getattr(arar, 'Tot{}'.format(k)), getattr(arar, 'Tot{}Er'.format(k))
                except AttributeError:
                    pass

            iso.total_value = ufloat(tv, te)
            # iso.set_uvalue((uv, ee))
            iso.n = n

            iso.ic_factor = ufloat(det.ICFactor, det.ICFactorEr)

            iso.fit = r.fit.Label.lower() if r.fit else ''

            iso.baseline = Baseline(key, det.detector_type.Label)
            iso.baseline.fit = 'average'
            iso.baseline.set_filter_outliers_dict(filter_outliers=fo, iterations=fi, std_devs=fs)

            iso.baseline.n = dbiso.baseline.NumCnts

            blank = self._blank(r)
            if blank:
                iso.blank.set_uvalue(blank)

            self.isotopes[key] = iso