def precision_accuracy(): b = pl.float16(1.0) e16 = 0 while pl.float16(1.0) - pl.float16(2**e16) != pl.float16(1.0): b = b / pl.float16(2) e16 -= 1 b = pl.float32(1.0) e32 = 0 while pl.float32(1.0) - pl.float32(2**e32) != pl.float32(1.0): b = b / pl.float32(2) e32 -= 1 b = pl.float64(1.0) e64 = 0 while pl.float64(1.0) - pl.float64(2**e64) != pl.float64(1.0): b = b / pl.float64(2) e64 -= 1 b = pl.longdouble(1.0) e128 = 0 while pl.longdouble(1.0) - pl.longdouble(2**e128) != pl.longdouble(1.0): b = b / pl.longdouble(2) e128 -= 1 return e16 + 1, e32 + 1, e64 + 1, e128 + 1
def split_spec(): global tag, msfile, spw_lower, spw_upper, btable, gtable, ftable; spw_lower, spw_upper = get_chans(msfile, pl.float32(ui['fi']), int(ui['di'])); print '\n' print '\n' print 'Splitting '+msfile+' from '+spw_lower+' to '+spw_upper; print '\n' print '\n' tag = options.retag+'.'+spw_lower+'to'+spw_upper; #print "breakpoint: split_spec" #print tag split(vis = msfile, outputvis = tag+'.ms', datacolumn = 'data', spw = '0:'+spw_lower+'~'+spw_upper); msfile = tag+'.ms'; btable = tag+'.B0'; gtable = tag+'.G0'; ftable = tag+'.F0';
def easy_im(): print '\n' print '\n' print "Cleaning over Spectral Range" print '\n' print '\n' imname = options.retag+'.contsub.'+ui['niter']+'iters'; if os.path.exists(imname)==True: print '\n'; print 'Deleting old contsub image'; print '\n' os.system('rm -r '+imname) clean(vis = tag+'.contsub', imagename = imname, field = source, selectdata = False, mode = 'channel', niter = int(ui['niter']), interactive = False, imsize = int(ui['imsize']), cell = ui['cell'], restfreq = '1420.406MHz', pbcor=ui['pbcor'], minpb=pl.float32(ui['minpb'])); im.open(tag+'.contsub'); pss = im.sensitivity(); pss = pss['pointsource']['value'] os.system('rm -r '+imname+'image.mom*') immoments(imagename = imname+'.image', moments = [0,1,2], includepix = [5*pss,1000000], outfile = imname+'.image.mom'); im.close(); print '\n' print '\n' print "Cleaning Continuum" print '\n' print '\n' imname = options.retag+'.cont.'+ui['niter']+'iters'; if os.path.exists(imname)==True: print '\n'; print 'Deleting old cont image'; print '\n' os.system('rm -r '+imname) clean(vis = tag+'.cont', imagename = imname, field = source, selectdata = False, mode = 'channel', niter = int(ui['niter']), interactive = False, imsize = int(ui['imsize']), cell = ui['cell'], restfreq = '1420.406MHz', pbcor=ui['pbcor'], minpb=pl.float32(ui['minpb'])); im.open(tag+'.contsub'); os.system('rm -r '+imname+'image.mom*') pss = im.sensitivity(); pss = pss['pointsource']['value'] immoments(imagename = imname+".image", moments = [0,1,2], includepix = [5*pss,1000000], outfile = imname+'.image.mom')
def import_letter(filename): if not re.search('\.png$', filename): filename += '.png' arr = imread(filename) f_rev = lambda a: float32(not aa) return amap(lambda y: map(f_rev, y), arr[:,:,0]).flatten()