本文整理汇总了Python中admit.util.AdmitLogging.AdmitLogging.error方法的典型用法代码示例。如果您正苦于以下问题:Python AdmitLogging.error方法的具体用法?Python AdmitLogging.error怎么用?Python AdmitLogging.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admit.util.AdmitLogging.AdmitLogging
的用法示例。
在下文中一共展示了AdmitLogging.error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_error
# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import error [as 别名]
def test_error(self):
msg = "unit_test_error_message"
Alogging.error(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: run
# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import error [as 别名]
def run(self):
""" The run method creates the BDP
Parameters
----------
None
Returns
-------
None
"""
self._summary = {}
dt = utils.Dtime("Smooth")
dt.tag("start")
# get the input keys
bmaj = self.getkey("bmaj")
bmin = self.getkey("bmin")
bpa = self.getkey("bpa")
velres = self.getkey("velres")
# take care of potential issues in the unit strings
# @todo if not provided?
bmaj['unit'] = bmaj['unit'].lower()
bmin['unit'] = bmin['unit'].lower()
velres['unit'] = velres['unit'].lower()
taskargs = "bmaj=%s bmin=%s bpa=%s velres=%s" % (bmaj,bmin,bpa,velres)
bdpnames=[]
for ibdp in self._bdp_in:
istem = ibdp.getimagefile(bt.CASA)
image_in = ibdp.baseDir() + istem
bdp_name = self.mkext(istem,'sim')
image_out = self.dir(bdp_name)
taskinit.ia.open(image_in)
h = casa.imhead(image_in, mode='list')
pix_scale = np.abs(h['cdelt1'] * 206265.0) # pix scale in asec @todo QA ?
CC = 299792458.0 # speed of light @todo somewhere else [utils.c , but in km/s]
rest_freq = h['crval3']
# frequency pixel scale in km/s
vel_scale = np.abs(CC*h['cdelt3']/rest_freq/1000.0)
# unit conversion to arcsec (spatial) or km/s
# (velocity) or some flavor of Hz.
if(bmaj['unit'] == 'pixel'):
bmaj = bmaj['value']*pix_scale
else:
bmaj = bmaj['value']
if(bmin['unit'] == 'pixel'):
bmin = bmin['value']*pix_scale
else:
bmin = bmin['value']
hertz_input = False
if velres['unit'] == 'pixel':
velres['value'] = velres['value']*vel_scale
velres['unit'] = 'km/s'
elif velres['unit'] == 'm/s':
velres['value'] = velres['value']/1000.0
velres['unit'] = 'km/s'
elif velres['unit'][-2:] == 'hz':
hertz_input = True
elif velres['unit'] == 'km/s':
pass
else:
logging.error("Unknown units in velres=%s" % velres['unit'])
rdata = bmaj
# we smooth in velocity first. if smoothing in velocity
# the cube apparently must be closed afterwards and
# then reopened if spatial smoothing is to be done.
if velres['value'] > 0:
# handle the different units allowed. CASA doesn't
# like lowercase for hz units...
if not hertz_input:
freq_res = str(velres['value']*1000.0/CC *rest_freq )+'Hz'
else:
freq_res = str(velres['value'])
# try to convert velres to km/s for debug purposes
velres['value'] = velres['value']/rest_freq*CC / 1000.0
if(velres['unit'] == 'khz'):
velres['value'] = velres['value']*1000.0
velres['unit'] = 'kHz'
elif(velres['unit']=='mhz'):
velres['value'] = velres['value']*1E6
velres['unit'] = 'MHz'
elif(velres['unit']=='ghz'):
velres['value'] = velres['value']*1E9
velres['unit'] = 'GHz'
freq_res = freq_res + velres['unit']
# NB: there is apparently a bug in CASA. only smoothing along the frequency
# axis does not work. sepconvolve gives a unit error (says axis unit is radian rather
# than Hz). MUST smooth in 2+ dimensions if you want this to work.
#.........这里部分代码省略.........