Browse Source

Some updates I did.. Lazy enough to remember what

master
Benito Marcote 2 months ago
parent
commit
81c1de29e2
2 changed files with 13 additions and 8 deletions
  1. +2
    -2
      _import_idi2ms.py
  2. +11
    -6
      import_idi2ms.py

+ 2
- 2
_import_idi2ms.py View File

@@ -1,8 +1,8 @@
#!/usr/bin/env python3
import glob
import sys


myidifiles = sorted(glob.glob(sys.argv[1]))
importfitsidi(vis=sys.argv[2], fitsidifile=myidifiles, constobsid=True, scanreindexgap_s=8.0)
importfitsidi(vis=sys.argv[1], fitsidifile=sorted(glob.glob(sys.argv[2])), constobsid=True, scanreindexgap_s=8.0)



+ 11
- 6
import_idi2ms.py View File

@@ -1,28 +1,33 @@
#!/usr/bin/env python3
import sys
import argparse
import subprocess
import pathlib


usage = "%(prog)s [-h] <idifiles> <msfile>"
description = """Converts a set of FITS IDI files into a single MS file by using the 'importfitsidi()'
function from CASA, with the standard parameters expected for EVN data.

Arguments:
- idifiles : str
A single word referring to the FITS IDI files to be read (using wildcards).
- msfile : str
Name of the MS file to be created.
- idifiles : str
FITS IDI files to be read (either a space-separated list or a single word using wildcards).
"""

help_idifiles = "FITS IDI files to be read. e.g. exp_1_1.IDI* to take all files related to exp_1_1."
help_idifiles = "FITS IDI files to be read. Allows wildcards (then it nees to be passed with '..')."


parser = argparse.ArgumentParser(description=description, prog='import_idi2ms.py', usage=usage)
parser.add_argument('idifiles', type=str, help=help_idifiles)
parser.add_argument('msfile', type=str, help='Name of the MS file to be created.')
parser.add_argument('idifiles', type=str, help=help_idifiles)

args = parser.parse_args()


subprocess.run(f"casa --nogui -c _import_idi2ms.py {idifiles} {msfile}", shell=True, capture_output=True)
subprocess.call(f"casa --nogui -c {pathlib.Path(__file__).parent.absolute()}/_import_idi2ms.py ",
# subprocess.call(f"casa --nogui -c {pathlib.Path(__file__).parent.absolute()}/_import_idi2ms.py {args.msfile} {args.idifiles}",
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)





Loading…
Cancel
Save