示例#1
0
文件: ms.py 项目: SpheMakh/pyxis
def from_uvfits (fitsfile,msname="$MS"):
  """Converts UVFITS file into MS""";
  fitsfile,msname = interpolate_locals("fitsfile msname");
  if not msname:
    msname = fitsfile+".MS";
  std.runcasapy("""ms.fromfits(msfile='$msname',fitsfile='$fitsfile')""");
  verify_antpos(msname,fix=True);
示例#2
0
文件: ms.py 项目: pthouvenin/pyxis
def from_uvfits(fitsfile, msname="$MS"):
    """Converts UVFITS file into MS"""
    fitsfile, msname = interpolate_locals("fitsfile msname")
    if not msname:
        msname = fitsfile + ".MS"
    std.runcasapy("""ms.fromfits(msfile='$msname',fitsfile='$fitsfile')""")
    verify_antpos(msname, fix=True)
示例#3
0
文件: argo.py 项目: pthouvenin/pyxis
def fits2casa (input,output):
    """Converts FITS image to CASA image."""
    if exists(output):
        rm_fr(output)
    if not exists(input):
        abort("$input does not exist")
    std.runcasapy("importfits('$input','$output',overwrite=True)")
示例#4
0
文件: ms.py 项目: pthouvenin/pyxis
def split_rebin(msname="$MS",
                output="$MSOUT",
                chan=None,
                time=None,
                field=None,
                spw=None,
                column="DATA"):
    """Splits and/or resamples MS in frequency with the given channel stepping size, and/or in time
  with the give time bin size (e.g. '5s'), and/or breaks out the specified fields and spws"""
    msname, output = interpolate_locals("msname output")
    args = ""

    def list2str(arg):
        return ",".join(map(str, stg)) if isinstance(arg,
                                                     (list,
                                                      tuple)) else str(arg)

    if chan:
        args += II(",width=[$chan]")
    if time:
        args += II(",timebin='$time'")
    if field:
        args += II(",field='%s'" % list2str(field))
    if spw:
        args += II(",spw='%s'" % list2str(spw))
    column = column.lower()
    std.runcasapy(
        """split(vis='$msname',outputvis='$output',datacolumn='$column'$args);"""
    )
示例#5
0
文件: ms.py 项目: pthouvenin/pyxis
def virtconcat(output="concat.MS", thorough=False, subtables=False):
    """Virtually concatenates the MSs given by MS_List into an output MS."""
    output, options = interpolate_locals("output options")
    auxfile = II("${output}.dat")
    if not v.MS_List:
        abort("MS_List must be set before calling ms.virtconcat()")
    if len(v.MS_List) != len(set([os.path.basename(x) for x in v.MS_List])):
        abort(
            "ms.virtconcat: MSs to be concatenated need to have unique basenames. Please rename your MSs accordingly."
        )
    cmd = ""
    if thorough:
        cmd = """ms.open("%s", nomodify=False)\n""" % v.MS_List[0]
        for msl in v.MS_List[1:]:
            cmd += II(
                """ms.virtconcatenate("$msl","$auxfile",'1GHz','1arcsec')\n""")
        cmd += II("""ms.close()\nos.remove('$auxfile')\n""")
    cmd += """if not ms.createmultims('$output',["%s"],
  [],
  True, # nomodify  
  False,# lock  
  $subtables): # copysubtables from first to all other members  
  os._exit(1);
ms.close();
""" % '","'.join(v.MS_List)
    std.runcasapy(cmd)
    info("virtually concatenated %d inputs MSs into $output" % len(v.MS_List))
示例#6
0
文件: ms.py 项目: SpheMakh/pyxis
def fixuvw (msname="$MS",fix=True,rowstep=100000):
  """Fixes the UVW column of an MS by recomputing it from scratch. If fix=False, only prints differences with current 
  UVW column at every rowstep-th row"""
  # these are parameters for the CASA script given by 
  msname = interpolate_locals("msname");
  write_uvw = fix;
  std.runcasapy(_utils.casa_scripts.fixuvw_casa,content="_utils.casa_scripts.fixuvw_casa");
  if fix:
    info("updated UVWs have been written to $msname");
  else:
    info("fix=False, updated UVWs not written out");
示例#7
0
文件: ms.py 项目: pthouvenin/pyxis
def fixuvw(msname="$MS", fix=True, rowstep=100000):
    """Fixes the UVW column of an MS by recomputing it from scratch. If fix=False, only prints differences with current 
  UVW column at every rowstep-th row"""
    # these are parameters for the CASA script given by
    msname = interpolate_locals("msname")
    write_uvw = fix
    std.runcasapy(_utils.casa_scripts.fixuvw_casa,
                  content="_utils.casa_scripts.fixuvw_casa")
    if fix:
        info("updated UVWs have been written to $msname")
    else:
        info("fix=False, updated UVWs not written out")
示例#8
0
文件: ms.py 项目: SpheMakh/pyxis
def concat (output="concat.MS",thorough=False,subtables=False,freqtol='1MHz',dirtol='1arcsec'):
  """Concatenates the MSs given by MS_List into an output MS."""
  output,freqtol,dirtol = interpolate_locals("output freqtol dirtol");
  info("concatenating",v.MS_List,"into $output");
  if not v.MS_List:
    abort("MS_List must be set before calling ms.concat()");
  if len(v.MS_List) != len(set([os.path.basename(name) for name in v.MS_List])):
    abort("ms.virtconcat: MSs to be concatenated need to have unique basenames. Please rename your MSs accordingly.");
  x.sh("cp -a "+v.MS_List[0]+" "+output);
  cmd = """ms.open("%s", nomodify=False)\n"""%output;
  for msl in v.MS_List[1:]:
    cmd += II("""ms.concatenate("$msl",freqtol='$freqtol',dirtol='$dirtol')\n""");  
  cmd += II("""ms.close()\n""");
  std.runcasapy(cmd);
  info("concatenated %d inputs MSs into $output"%len(v.MS_List));
示例#9
0
文件: ms.py 项目: SpheMakh/pyxis
def split_rebin (msname="$MS",output="$MSOUT",chan=None,time=None,field=None,spw=None,column="DATA"):
  """Splits and/or resamples MS in frequency with the given channel stepping size, and/or in time
  with the give time bin size (e.g. '5s'), and/or breaks out the specified fields and spws""";
  msname,output = interpolate_locals("msname output");
  args = ""
  def list2str (arg):
    return ",".join(map(str,stg)) if isinstance(arg,(list,tuple)) else str(arg);
  if chan:
    args += II(",width=[$chan]");
  if time:
    args += II(",timebin='$time'");
  if field:
    args += II(",field='%s'"%list2str(field));
  if spw:
    args += II(",spw='%s'"%list2str(spw));
  column = column.lower();
  std.runcasapy("""split(vis='$msname',outputvis='$output',datacolumn='$column'$args);""");
示例#10
0
文件: ms.py 项目: pthouvenin/pyxis
def concat(output="concat.MS",
           thorough=False,
           subtables=False,
           freqtol='1MHz',
           dirtol='1arcsec'):
    """Concatenates the MSs given by MS_List into an output MS."""
    output, freqtol, dirtol = interpolate_locals("output freqtol dirtol")
    info("concatenating", v.MS_List, "into $output")
    if not v.MS_List:
        abort("MS_List must be set before calling ms.concat()")
    if len(v.MS_List) != len(
            set([os.path.basename(name) for name in v.MS_List])):
        abort(
            "ms.virtconcat: MSs to be concatenated need to have unique basenames. Please rename your MSs accordingly."
        )
    x.sh("cp -a " + v.MS_List[0] + " " + output)
    cmd = """ms.open("%s", nomodify=False)\n""" % output
    for msl in v.MS_List[1:]:
        cmd += II(
            """ms.concatenate("$msl",freqtol='$freqtol',dirtol='$dirtol')\n""")
    cmd += II("""ms.close()\n""")
    std.runcasapy(cmd)
    info("concatenated %d inputs MSs into $output" % len(v.MS_List))
示例#11
0
文件: ms.py 项目: SpheMakh/pyxis
def virtconcat (output="concat.MS",thorough=False,subtables=False):
  """Virtually concatenates the MSs given by MS_List into an output MS."""
  output,options = interpolate_locals("output options");
  auxfile = II("${output}.dat");
  if not v.MS_List:
    abort("MS_List must be set before calling ms.virtconcat()");
  if len(v.MS_List) != len(set([os.path.basename(x) for x in v.MS_List])):
    abort("ms.virtconcat: MSs to be concatenated need to have unique basenames. Please rename your MSs accordingly.");
  cmd = "";
  if thorough:
    cmd = """ms.open("%s", nomodify=False)\n"""%v.MS_List[0];
    for msl in v.MS_List[1:]:
      cmd += II("""ms.virtconcatenate("$msl","$auxfile",'1GHz','1arcsec')\n""");  
    cmd += II("""ms.close()\nos.remove('$auxfile')\n""");
  cmd += """if not ms.createmultims('$output',["%s"],
  [],
  True, # nomodify  
  False,# lock  
  $subtables): # copysubtables from first to all other members  
  os._exit(1);
ms.close();
"""%'","'.join(v.MS_List); 
  std.runcasapy(cmd);
  info("virtually concatenated %d inputs MSs into $output"%len(v.MS_List));
示例#12
0
文件: ms.py 项目: SpheMakh/pyxis
def summary (msname="$MS"):
  msname = interpolate_locals("msname");
  std.runcasapy("listobs('$msname')");
示例#13
0
文件: ms.py 项目: pthouvenin/pyxis
def summary(msname="$MS"):
    msname = interpolate_locals("msname")
    std.runcasapy("listobs('$msname')")
示例#14
0
文件: ms.py 项目: griffinfoster/pyxis
def rebin_freq (msname="$MS",output="$MSOUT",step=1):
  """Resamples MS in frequency with the given step size""";
  msname,output = interpolate_locals("msname output");
  std.runcasapy("""ms.open("$msname"); ms.split(outputms='$output',step=$step);""");
示例#15
0
文件: ms.py 项目: griffinfoster/pyxis
def from_uvfits (fitsfile,msname="$MS"):
  fitsfile,msname = interpolate_locals("fitsfile msname");
  if not msname:
    msname = fitsfile+".MS";
  std.runcasapy("""ms.fromfits(msfile='$msname',fitsfile='$fitsfile')""");