Example #1
0
    def _make(self, ep):
        project = 'Minna Bluff'
        db = self.db
        with db.session_ctx():
            prj = db.get_project(project)
            Ar40, Ar39, Ar38, Ar37, Ar36 = [], [], [], [], []
            for dev in (('Eurotherm', 'Furnace'), ('CO2')):
                for si in prj.samples:
                    for li in si.labnumbers:
                        self.debug('blanks for {},{}'.format(
                            si.name, li.identifier))
                        for ai in li.analyses:
                            if ai.extraction.extraction_device.name in dev:
                                bs = self._extract_blanks(ai)
                                if bs is not None:
                                    r = make_runid(li.identifier, ai.aliquot,
                                                   ai.step)
                                    # self.debug('blanks for {} {}'.format(r,bs))
                                    Ar40.append(bs[0])
                                    Ar39.append(bs[1])
                                    Ar38.append(bs[2])
                                    Ar37.append(bs[3])
                                    Ar36.append(bs[4])

                reg = WeightedMeanRegressor()
                print 'blanks for {}'.format(dev)
                for iso in (Ar40, Ar39, Ar38, Ar37, Ar36):
                    ys, es = zip(*iso)

                    reg.trait_set(ys=ys, yserr=es)
                    print reg.predict()
Example #2
0
    def _make(self, ep):
        project = "Minna Bluff"
        db = self.db
        with db.session_ctx():
            prj = db.get_project(project)
            Ar40, Ar39, Ar38, Ar37, Ar36 = [], [], [], [], []
            for dev in (("Eurotherm", "Furnace"), ("CO2")):
                for si in prj.samples:
                    for li in si.labnumbers:
                        self.debug("blanks for {},{}".format(si.name, li.identifier))
                        for ai in li.analyses:
                            if ai.extraction.extraction_device.name in dev:
                                bs = self._extract_blanks(ai)
                                if bs is not None:
                                    r = make_runid(li.identifier, ai.aliquot, ai.step)
                                    # self.debug('blanks for {} {}'.format(r,bs))
                                    Ar40.append(bs[0])
                                    Ar39.append(bs[1])
                                    Ar38.append(bs[2])
                                    Ar37.append(bs[3])
                                    Ar36.append(bs[4])

                reg = WeightedMeanRegressor()
                print "blanks for {}".format(dev)
                for iso in (Ar40, Ar39, Ar38, Ar37, Ar36):
                    ys, es = zip(*iso)

                    reg.trait_set(ys=ys, yserr=es)
                    print reg.predict()
Example #3
0
    def _mean_regress(self, scatter, r, fit):
        if hasattr(scatter, 'yerror'):
            if r is None or not isinstance(r, WeightedMeanRegressor):
                r = WeightedMeanRegressor()
        else:
            if r is None or not isinstance(r, MeanRegressor):
                r = MeanRegressor()

        self._set_regressor(scatter, r)
        r.trait_set(fit=fit, trait_change_notify=False)
        r.calculate()

        self._set_excluded(scatter, r)
        return r
Example #4
0
    def _mean_regress(self, scatter, r, fit):
        if hasattr(scatter, 'yerror'):
            if r is None or not isinstance(r, WeightedMeanRegressor):
                r = WeightedMeanRegressor()
        else:
            if r is None or not isinstance(r, MeanRegressor):
                r = MeanRegressor()

        self._set_regressor(scatter, r)
        r.trait_set(fit=fit, trait_change_notify=False)
        r.calculate()

        self._set_excluded(scatter, r)
        return r