本文整理汇总了Python中admit.util.AdmitLogging.AdmitLogging.fatal方法的典型用法代码示例。如果您正苦于以下问题:Python AdmitLogging.fatal方法的具体用法?Python AdmitLogging.fatal怎么用?Python AdmitLogging.fatal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admit.util.AdmitLogging.AdmitLogging
的用法示例。
在下文中一共展示了AdmitLogging.fatal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import fatal [as 别名]
#.........这里部分代码省略.........
if False:
# this will fail on 3D cubes (see CAS-7648)
imval[i] = casa.imval(self.dir(fin),box=box)
else:
# work around that CAS-7648 bug
# another approach is the ia.getprofile(), see CubeStats, this will
# also integrate over regions, imval will not (!!!)
region = 'centerbox[[%dpix,%dpix],[1pix,1pix]]' % (xpos,ypos)
caption = "Average Spectrum at %s" % region
imval[i] = casa.imval(self.dir(fin),region=region)
elif type(xpos)==str:
# this is tricky, to stay under 1 pixel , or you get a 2x2 back.
region = 'centerbox[[%s,%s],[1pix,1pix]]' % (xpos,ypos)
caption = "Average Spectrum at %s" % region
sd.extend([xpos,ypos,region])
imval[i] = casa.imval(self.dir(fin),region=region)
else:
print "Data type: ",type(xpos)
raise Exception,"Data type for region not handled"
dt.tag("imval")
flux = imval[i]['data']
if len(flux.shape) > 1: # rare case if we step on a boundary between cells?
logging.warning("source %d has spectrum shape %s: averaging the spectra" % (i,repr(flux.shape)))
flux = np.average(flux,axis=0)
logging.debug('minmax: %f %f %d' % (flux.min(),flux.max(),len(flux)))
smax.append(flux.max())
if i==0: # for first point record few extra things
if len(imval[i]['coords'].shape) == 2: # normal case: 1 pixel
freqs = imval[i]['coords'].transpose()[2]/1e9 # convert to GHz @todo: input units ok?
elif len(imval[i]['coords'].shape) == 3: # rare case if > 1 point in imval()
freqs = imval[i]['coords'][0].transpose()[2]/1e9 # convert to GHz @todo: input units ok?
else:
logging.fatal("bad shape %s in freq return from imval - SHOULD NEVER HAPPEN" % imval[i]['coords'].shape)
chans = np.arange(len(freqs)) # channels 0..nchans-1
unit = imval[i]['unit']
restfreq = casa.imhead(self.dir(fin),mode="get",hdkey="restfreq")['value']/1e9 # in GHz
dt.tag("imhead")
vel = (1-freqs/restfreq)*utils.c # @todo : use a function (and what about relativistic?)
# construct the Table for CubeSpectrum_BDP
# @todo note data needs to be a tuple, later to be column_stack'd
labels = ["channel" ,"frequency" ,"flux" ]
units = ["number" ,"GHz" ,unit ]
data = (chans ,freqs ,flux )
if i==0:
# plane 0 : we are allowing a multiplane table, so the first plane is special
table = Table(columns=labels,units=units,data=np.column_stack(data),planes=["0"])
else:
# planes 1,2,3.... are stacked onto the previous one
table.addPlane(np.column_stack(data),"%d" % i)
# example plot , one per position for now
if use_vel:
x = vel
xlab = 'VLSR (km/s)'
else:
x = chans
xlab = 'Channel'
y = [flux]
sd.append(xlab)
if type(xpos)==int:
# grab the RA/DEC... kludgy
h = casa.imstat(self.dir(fin),box=box)
ra = h['blcf'].split(',')[0]