当前位置: 首页>>代码示例>>Python>>正文


Python AdmitLogging.critical方法代码示例

本文整理汇总了Python中admit.util.AdmitLogging.AdmitLogging.critical方法的典型用法代码示例。如果您正苦于以下问题:Python AdmitLogging.critical方法的具体用法?Python AdmitLogging.critical怎么用?Python AdmitLogging.critical使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在admit.util.AdmitLogging.AdmitLogging的用法示例。


在下文中一共展示了AdmitLogging.critical方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_critical

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import critical [as 别名]
    def test_critical(self):
        msg = "unit_test_critical_message"
        Alogging.critical(msg)

        found = False
        r = open(self.logfile, 'r')
        for line in r.readlines():
            if msg in line:
                if(self.verbose):
                    print "\nFound message > ", line
                found = True
                r.close()
                break

        self.assertTrue(found)
开发者ID:teuben,项目名称:admit,代码行数:17,代码来源:unittest_AdmitLogging.py

示例2: fitgauss1Dm

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import critical [as 别名]
def fitgauss1Dm(xdat, ydat, usePeak = False, dx = -1.0):
    """ gaussfit helper function
        this will get a reasonable gauss even if you only have 2 points
        assumes evenly spaced data in xdat, so it can extract a width.
        It can be used like fitgauss1D(), but uses the first three moments
        of the distribution to "match" that of a gauss. area preserving
        if you wish.
        If you set usePeak, it will pick the highest value in your data.
        Warning:   if you must fit negative profiles, be sure to rescale
        before you come into this routine.
    """
    if len(xdat) == 1:
        # special case, it will need dx
        if dx < 0.0:
            logging.critical("Cannot determine gaussian of delta function if width not given")
            raise
        return (ydat[0], xdat[0], dx)
    
    sum0 = sum1 = sum2 = peak = 0.0
    # the mean is given as the weighted mean of x
    for x,y in zip(xdat,ydat):
        if y>peak: peak = y
        sum0 = sum0 + y
        sum1 = sum1 + y*x
    xmean = sum1/sum0
    # re-center the data for a moment-2 calculation
    # @todo pos/neg
    xdat0 = xdat - xmean
    for x,y in zip(xdat0,ydat):
        sum2 = sum2 + y*x*x
    sigma = math.sqrt(abs(sum2/sum0))
    # equate the area under the histogram with the area under a gauss
    # to get the peak of the "matched" gauss
    dx = abs(xdat[1]-xdat[0])     # @todo   use optional "dx=None" ?
    if not usePeak:
        # pick the area preserving one, vs. the "real" peak
        # The area preserving one seems to be about 18% higher
        # but with a tight correllation
        peak = (sum0 * dx) / math.sqrt(2*sigma*math.pi)
    fwhm = 2.35482 * sigma

    return (peak, xmean, fwhm)
开发者ID:teuben,项目名称:admit,代码行数:44,代码来源:utils.py

示例3: run

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import critical [as 别名]

#.........这里部分代码省略.........

        first_point = taskinit.ia.getchunk(blc=[0,0,0,0],trc=[0,0,0,0],dropdeg=True)
        logging.debug("DATA0*: %s" % str(first_point))

        taskinit.ia.close()
        logging.info('BASICS: [shape] npts min max: %s %d %f %f' % (s['shape'],s0['npts'][0],s0['min'][0],s0['max'][0]))
        logging.info('S/N (all data): %f' % (s0['max'][0]/s0['rms'][0]))
        npix = 1
        nx = s['shape'][0]
        ny = s['shape'][1]
        nz = s['shape'][2]
        for n in s['shape']:
            npix = npix * n
        ngood = int(s0['npts'][0])
        fgood = (1.0*ngood)/npix
        logging.info('GOOD PIXELS: %d/%d (%f%% good or %f%% bad)' % (ngood,npix,100.0*fgood,100.0*(1 - fgood)))
        if s['hasmask']:
            logging.warning('MASKS: %s' % (str(s['masks'])))

        if not file_is_casa:
            b1.setkey("image", Image(images={bt.CASA:bdpfile}))
            if do_pb:
                b2.setkey("image", Image(images={bt.CASA:bdpfile2}))            

        # cube sanity: needs to be either 4D or 2D. But p-p-v cube
        # alternative: ia.subimage(dropdeg = True)
        # see also: https://bugs.nrao.edu/browse/CAS-5406
        shape = s['shape']
        if len(shape)>3:
            if shape[3]>1:
                # @todo this happens when you ingest a fits or casa image which is ra-dec-pol-freq
                if nz > 1:
                    msg = 'Ingest_AT: cannot deal with real 4D cubes yet'
                    logging.critical(msg)
                    raise Exception,msg
                else:
                    # @todo this is not working yet when the input was a casa image, but ok when fits. go figure.
                    fnot = fno + ".trans"
                    if True:
                        # this works
            #@todo use safer ia.rename() here.
            # https://casa.nrao.edu/docs/CasaRef/image.rename.html
                        utils.rename(fno,fnot)
                        imtrans(fnot,fno,"0132")
                        utils.remove(fnot)
                    else:
                        # this does not work, what the heck
                        imtrans(fno,fnot,"0132")
            #@todo use safer ia.rename() here.
            # https://casa.nrao.edu/docs/CasaRef/image.rename.html
                        utils.rename(fnot,fno)
                    nz = s['shape'][3]
                    # get a new summary 's'
                    taskinit.ia.open(fno)
                    s = taskinit.ia.summary()
                    taskinit.ia.close()
                    logging.warning("Using imtrans, with nz=%d, to fix axis ordering" % nz)
                    dt.tag("imtrans4")
            # @todo  ensure first two axes are position, followed by frequency
        elif len(shape)==3:
            # the current importfits() can do defaultaxes=True,defaultaxesvalues=['', '', '', 'I']
            # but then appears to return a ra-dec-pol-freq cube
            # this branch probably never happens, since ia.fromfits() will 
            # properly convert a 3D cube to 4D now !!
            # NO: when NAXIS=3 but various AXIS4's are present, that works. But not if it's pure 3D
            # @todo  box=
开发者ID:teuben,项目名称:admit,代码行数:70,代码来源:Ingest_AT.py


注:本文中的admit.util.AdmitLogging.AdmitLogging.critical方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。