当前位置: 首页>>代码示例>>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;未经允许,请勿转载。