本文整理匯總了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)
示例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)
示例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=