本文整理汇总了Python中parallel.parallel_data_helper.ParallelDataHelper.go方法的典型用法代码示例。如果您正苦于以下问题:Python ParallelDataHelper.go方法的具体用法?Python ParallelDataHelper.go怎么用?Python ParallelDataHelper.go使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parallel.parallel_data_helper.ParallelDataHelper
的用法示例。
在下文中一共展示了ParallelDataHelper.go方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: importasdm
# 需要导入模块: from parallel.parallel_data_helper import ParallelDataHelper [as 别名]
# 或者: from parallel.parallel_data_helper.ParallelDataHelper import go [as 别名]
#.........这里部分代码省略.........
tblocal.close()
tblocal.open(myviso+'/SOURCE')
sourceposref = tblocal.getcolkeywords('DIRECTION')['MEASINFO']['Ref']
tblocal.close()
directions = []
msmdlocal = casac.msmetadata()
msmdlocal.open(myviso)
for fld in thesamplefields:
thedirmeas = msmdlocal.phasecenter(fld)
if thedirmeas['refer']!=sourceposref:
casalog.post('Ephemeris is in '+thedirmeas['refer']+' instead of '+sourceposref
+' frame.\nEntry in SOURCE table will be converted to '+sourceposref, 'WARN')
melocal = metool()
melocal.doframe(thedirmeas)
thedirmeas = melocal.measure(thedirmeas, sourceposref)
directions.append([thedirmeas['m0']['value'], thedirmeas['m1']['value']])
thetime = me.epoch(v0=str(ftimes[fld])+'s', rf=ftimekw['MEASINFO']['Ref'])
casalog.post("Will set SOURCE direction for SOURCE_ID "+str(sourceids[fld])
+" to ephemeris phase center for time "+str(thetime['m0']['value'])+" "+thetime['m0']['unit']+" "+thetime['refer'])
#endfor
msmdlocal.close()
# restore original PHASE_DIR
tblocal.open(myviso+'/FIELD', nomodify=False)
tblocal.putcol('PHASE_DIR', origphasedir)
tblocal.close()
# write source directions
tblocal.open(myviso+'/SOURCE', nomodify=False)
ssourceids = tblocal.getcol('SOURCE_ID')
sdirs = tblocal.getcol('DIRECTION')
for row in xrange(0,len(ssourceids)):
for i in xrange(0,len(affectedsids)):
if ssourceids[row]==affectedsids[i]:
sdirs[0][row] = directions[i][0]
sdirs[1][row] = directions[i][1]
break
#endfor
#endfor
tblocal.putcol('DIRECTION', sdirs) # write back corrected directions
tblocal.close()
#end if
##############################################################################################3
# CAS-7369 - Create an output Multi-MS (MMS)
if createmms:
# Get the default parameters of partition
from tasks import partition
fpars = partition.parameters
for mypar in fpars.keys():
fpars[mypar] = partition.itsdefault(mypar)
# Call the cluster for each MS
for myviso in vistoproc:
casalog.origin('importasdm')
# Move original MS to tempdir
tempname = myviso+'.temp.ms'
outputmms = myviso
shutil.move(myviso, tempname)
# Get the proper column
datacolumn = 'DATA'
dcols = ['DATA', 'FLOAT_DATA']
for dc in dcols:
if len(th.getColDesc(tempname, dc)) > 0:
datacolumn = dc
break
fpars['datacolumn'] = datacolumn
casalog.post('Will create a Multi-MS for: '+myviso)
fpars['vis'] = tempname
fpars['flagbackup'] = False
fpars['outputvis'] = outputmms
fpars['separationaxis'] = separationaxis
fpars['numsubms'] = numsubms
pdh = ParallelDataHelper('partition', fpars)
# Get a cluster
pdh.setupCluster(thistask='partition')
try:
pdh.go()
# Remove original MS
shutil.rmtree(tempname)
except Exception, instance:
# Restore MS in case of error in MMS creation
shutil.move(tempname, myviso)
casalog.post('%s'%instance,'ERROR')
return False
casalog.origin('importasdm')
示例2: importasdm
# 需要导入模块: from parallel.parallel_data_helper import ParallelDataHelper [as 别名]
# 或者: from parallel.parallel_data_helper.ParallelDataHelper import go [as 别名]
#.........这里部分代码省略.........
# Apply flags to the MS
if nflags > 0:
idx = 0
for myviso in vistoproc:
if applyflags:
# Open the MS and attach it to the tool
aflocal.open(myviso)
# Select the data
aflocal.selectdata()
# Setup the agent's parameters
fh.parseAgents(aflocal, flagcmds, [], True, True, '')
# Initialize the agents
aflocal.init()
# Run the tool
aflocal.run(True, True)
casalog.post('Applied %s flag commands to %s'%(nflags,myviso))
# Destroy the tool and de-attach the MS
aflocal.done()
# Save to FLAG_CMD table. APPLIED is set to True.
fh.writeFlagCommands(myviso, flagcmds, True, '', '', True)
else:
casalog.post('Will not apply flags to %s (apply_flags=False), use flagcmd to apply'%myviso)
# Write to FLAG_CMD, APPLIED is set to False
fh.writeFlagCommands(myviso, flagcmds, False, '', '', True)
# Save the flag cmds to an ASCII file
if savecmds:
# Save to standard filename
fh.writeFlagCommands(myviso, flagcmds, False, '', outfile[idx], False)
casalog.post('Saved %s flag commands to %s'%(nflags,outfile[idx]))
idx += 1
else:
casalog.post('There are no flag commands to process')
else:
casalog.post('There is no Flag.xml in ASDM', 'WARN')
import recipes.ephemerides.convertephem as ce
theephemfields = ce.findattachedephemfields(myviso,field='*')
if len(theephemfields)>0: # temporary fix until asdm2MS does this internally: recalc the UVW coordinates for ephem fields
imt = imtool()
imt.open(myviso, usescratch=False)
imt.calcuvw(theephemfields, refcode='J2000', reuse=False)
imt.close()
if convert_ephem2geo:
for myviso in vistoproc:
ce.convert2geo(myviso, '*') # convert any attached ephemerides to GEO
# CAS-7369 - Create an output Multi-MS (MMS)
if createmms:
# Get the default parameters of partition
from tasks import partition
fpars = partition.parameters
for mypar in fpars.keys():
fpars[mypar] = partition.itsdefault(mypar)
# Call the cluster for each MS
for myviso in vistoproc:
casalog.origin('importasdm')
outputmms = myviso.replace('.ms','.mms')
# Get the proper column
datacolumn = 'DATA'
dcols = ['DATA', 'FLOAT_DATA']
for dc in dcols:
if len(th.getColDesc(myviso, dc)) > 0:
datacolumn = dc
break
fpars['datacolumn'] = datacolumn
casalog.post('Will create a Multi-MS for: '+myviso)
fpars['vis'] = myviso
fpars['flagbackup'] = False
fpars['outputvis'] = outputmms
fpars['separationaxis'] = separationaxis
fpars['numsubms'] = numsubms
pdh = ParallelDataHelper('partition', fpars)
# Get a cluster
pdh.setupCluster(thistask='partition')
try:
pdh.go()
# Rename MMS to MS
shutil.rmtree(myviso)
shutil.move(outputmms, myviso)
except Exception, instance:
casalog.post('%s'%instance,'ERROR')
return False
casalog.origin('importasdm')
return