當前位置: 首頁>>代碼示例>>Python>>正文


Python numpy.RankWarning方法代碼示例

本文整理匯總了Python中numpy.RankWarning方法的典型用法代碼示例。如果您正苦於以下問題:Python numpy.RankWarning方法的具體用法?Python numpy.RankWarning怎麽用?Python numpy.RankWarning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在numpy的用法示例。


在下文中一共展示了numpy.RankWarning方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import RankWarning [as 別名]
def __init__(self, session, display="loss", loss_keys=["loss"], selections=["raw"],
                 avg_samples=500, smooth_amount=0.90, flatten_outliers=False, is_totals=False):
        logger.debug("Initializing %s: (session: %s, display: %s, loss_keys: %s, selections: %s, "
                     "avg_samples: %s, smooth_amount: %s, flatten_outliers: %s, is_totals: %s",
                     self.__class__.__name__, session, display, loss_keys, selections, avg_samples,
                     smooth_amount, flatten_outliers, is_totals)

        warnings.simplefilter("ignore", np.RankWarning)

        self.session = session
        self.display = display
        self.loss_keys = loss_keys
        self.selections = selections
        self.is_totals = is_totals
        self.args = {"avg_samples": avg_samples,
                     "smooth_amount": smooth_amount,
                     "flatten_outliers": flatten_outliers}
        self.iterations = 0
        self.stats = None
        self.refresh()
        logger.debug("Initialized %s", self.__class__.__name__) 
開發者ID:deepfakes,項目名稱:faceswap,代碼行數:23,代碼來源:stats.py

示例2: calcTimeResults

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import RankWarning [as 別名]
def calcTimeResults(self):
        res = []
        if self.aw.qmc.transMappingMode == 0:
            # discrete mapping
            # adding CHARGE
            fits = self.calcDiscretefits([0] + self.profileTimes,[0] + self.targetTimes)
            for i in range(4):
                if self.profileTimes[i] is not None and fits[i+1] is not None:
                    res.append(numpy.poly1d(fits[i+1])(self.profileTimes[i]))
                else:
                    res.append(None)
        else:
            with warnings.catch_warnings():
                warnings.filterwarnings('error')
                try:
                    fit = self.calcTimePolyfit() # that that this fit is already applied to numpy.polyfit !!
                    for i in range(4):
                        if fit is not None and self.profileTimes[i] is not None:
                            res.append(fit(self.profileTimes[i]))
                        else:
                            res.append(None)
                except numpy.RankWarning:
                    pass
                except:
                    pass
        return res

    # returns the list of results temperatures and the polyfit or None as second result 
開發者ID:artisan-roaster-scope,項目名稱:artisan,代碼行數:30,代碼來源:transposer.py

示例3: calcTempResults

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import RankWarning [as 別名]
def calcTempResults(self):
        res = []
        fit = None
        if self.aw.qmc.transMappingMode == 0:
            # discrete mapping
            fits = self.calcDiscretefits(self.profileTemps,self.targetTemps)
            for i in range(5):
                if self.profileTemps[i] is not None and fits[i] is not None:
                    res.append(numpy.poly1d(fits[i])(self.profileTemps[i]))
                else:
                    res.append(None)
            active_fits = list(filter(lambda x: x[1][1] is not None,zip(fits,zip(self.profileTemps,self.targetTemps))))
            if len(active_fits) > 0 and len(active_fits) < 3:
                fit = self.aw.fit2str(fits[0])
            else:
                formula = ""
                last_target = None
                for f,tpl in reversed(active_fits[:-1]):
                    if last_target is None:
                        formula = self.aw.fit2str(f)
                    else:
                        formula = "({} if x<{} else {})".format(self.aw.fit2str(f), last_target, formula)
                    last_target = tpl[1]
                fit = formula
        else:
            with warnings.catch_warnings():
                warnings.filterwarnings('error')
                try:
                    fit = self.calcTempPolyfit() # numpy.poly1d not yet applied to this fit
                    p = numpy.poly1d(fit)
                    for i in range(5):
                        if fit is not None and self.profileTemps[i] is not None:
                            res.append(p(self.profileTemps[i]))
                        else:
                            res.append(None)
                except numpy.RankWarning:
                    pass
                except:
                    pass
        return res,fit
    
    # returns target times based on the phases target 
開發者ID:artisan-roaster-scope,項目名稱:artisan,代碼行數:44,代碼來源:transposer.py

示例4: applyTimeTransformation

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import RankWarning [as 別名]
def applyTimeTransformation(self):
        # first update the targets
        self.targetTimes = self.getTargetTimes()
        if all(v is None for v in self.targetTimes):
            target_times, target_phases = self.getTargetPhases()
            if all(v is None for v in target_times + target_phases):
                self.aw.qmc.timex = self.org_timex[:]
                self.aw.qmc.extratimex = copy.deepcopy(self.org_extratimex)
                return False
            else:
                self.targetTimes = self.getTargetPhasesTimes()
        # calculate the offset of 00:00
        offset = self.forgroundOffset()
        # apply either the discrete or the polyfit mappings
        if self.aw.qmc.transMappingMode == 0:
            # discrete mapping
            fits = self.calcDiscretefits([0] + self.profileTimes,[0] + self.targetTimes)
            self.aw.qmc.timex = self.applyDiscreteTimeMapping(self.org_timex,fits)
            # apply to the extra timex
            self.aw.qmc.extratimex = []
            for timex in self.org_extratimex:
                try:
                    timex_trans = self.applyDiscreteTimeMapping(timex,fits)
                except:
                    timex_trans = timex
                self.aw.qmc.extratimex.append(timex_trans)
        else:
            # polyfit mappings
            with warnings.catch_warnings():
                warnings.filterwarnings('error')
                try:
                    fit = self.calcTimePolyfit() # the fit returned here is already applied to numpy.poly1d
                    if fit is not None:
                        self.aw.qmc.timex = [fit(tx-offset) for tx in self.org_timex]
                        if len(self.aw.qmc.timex) > 0 and self.aw.qmc.timeindex[0] != -1:
                            foffset = self.aw.qmc.timex[0]
                            self.aw.qmc.timex = [tx+foffset for tx in self.aw.qmc.timex]
                        extratimex = []
                        for timex in self.org_extratimex:
                            offset = 0
                            if self.aw.qmc.timeindex[0] != -1:
                                offset = timex[self.aw.qmc.timeindex[0]]
                            new_timex = [fit(tx-offset) for tx in timex]
                            if len(new_timex) > 0 and self.aw.qmc.timeindex[0] != -1:
                                foffset = new_timex[0]
                                new_timex = [tx+foffset for tx in new_timex]
                            extratimex.append(new_timex)
                        self.aw.qmc.extratimex = extratimex
                except numpy.RankWarning:
                    pass
        return True
    
    # returns False if no transformation was applied 
開發者ID:artisan-roaster-scope,項目名稱:artisan,代碼行數:55,代碼來源:transposer.py

示例5: applyTempTransformation

# 需要導入模塊: import numpy [as 別名]
# 或者: from numpy import RankWarning [as 別名]
def applyTempTransformation(self):
        # first update the targets
        self.targetTemps = self.getTargetTemps()
        if all(v is None for v in self.targetTemps):
            self.aw.qmc.temp2 = self.org_temp2[:]
            return False
        # apply either the discrete or the polyfit mappings
        if self.aw.qmc.transMappingMode == 0:
            # discrete mappings, length 5
            fits = self.calcDiscretefits(self.profileTemps,self.targetTemps)
            self.aw.qmc.temp2 = []
            for i in range(len(self.org_temp2)):
                # first fit is to be applied for all readings before DRY
                j = 0
                if self.aw.qmc.timeindex[6] > 0 and i >= self.aw.qmc.timeindex[6]:
                    # last fit counts after DROP
                    j = 4
                elif self.aw.qmc.timeindex[4] > 0 and i >= self.aw.qmc.timeindex[4]:
                    j = 3 # after SCs
                elif self.aw.qmc.timeindex[2] > 0 and i >= self.aw.qmc.timeindex[2]:
                    j = 2 # after FCs
                elif self.aw.qmc.timeindex[1] > 0 and i >= self.aw.qmc.timeindex[1]:
                    j = 1 # after DRY
                fit = numpy.poly1d(fits[j]) # fit to be applied
                
                tp = self.org_temp2[i]
                if tp is None or tp == -1:
                    self.aw.qmc.temp2.append(tp)
                else:
                    self.aw.qmc.temp2.append(fit(tp))
            return True
        else:
            # polyfit mappings
            with warnings.catch_warnings():
                warnings.filterwarnings('error')
                try:
                    fit = numpy.poly1d(self.calcTempPolyfit())
                    if fit is not None:
                        self.aw.qmc.temp2 = [(-1 if (temp is None) or (temp == -1) else fit(temp)) for temp in self.org_temp2]
                except numpy.RankWarning:
                    pass
        return True
    
    # tables 
開發者ID:artisan-roaster-scope,項目名稱:artisan,代碼行數:46,代碼來源:transposer.py


注:本文中的numpy.RankWarning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。