def new(args): """Create a new empty measurement set using simms, given the arguments parsed.""" # Check for antenna table selected if args.pos == 'kat-7.itrf.txt': args.pos = KAT7 else: raise NotImplemented("Only kat-7 table is supported") # Create empty measurment set print(f"==> Creating empty ms: {args.msname}") simms.create_empty_ms(msname=args.msname, tel=args.tel, pos_type=args.pos_type, pos=args.pos, dec=args.dec, ra=args.ra, synthesis=args.synthesis, dtime=args.dtime, freq0=args.freq0, nchan=args.nchan, dfreq=args.dfreq, stokes=args.stokes, scan_length=[args.synthesis], nolog=True)
def create_empty_ms(msname="$MS", tel=None, pos=None, pos_type='casa', coords="itrf", synthesis=4, dtime=10, freq0="1.4GHz", dfreq="10MHz", lon_lat=None, **kw): """ Uses simms to create an empty measurement set. Requires either an antenna table (CASA table) or a list of ITRF or ENU positions. msname: MS name tel: Telescope name (This name must be in the CASA Database (check in me.obslist() in casapy) If its not there, then you will need to specify the telescope coordinates via "lon_lat" pos: Antenna positions. This can either a CASA table or an ASCII file. (see simms --help for more on using an ascii file) pos_type: Antenna position type. Choices are (casa, ascii) coords: This is only applicable if you are using an ASCII file. Choices are (itrf, enu) synthesis: Synthesis time in hours dtime: Integration time in seconds freq0: Start frequency dfreq: Channel width nbands: Number of frequency bands **kw: extra keyword arguments. A standard file should have the format: pos1 pos2 pos3* dish_diameter station mount. NOTE: In the case of ENU, the 3rd position (up) is not essential and may not be specified; indicate that your file doesn't have this dimension by enebaling the --noup (-nu) option. """ try: from simms import simms except ImportError: abort( "Import simms failed. Please make sure you simms intalled.\n" "Find simms at github.com/SpheMakh/simms or install it by running" " pip install simms") simms.create_empty_ms(msname=II(msname), tel=tel, pos=pos, pos_type=pos_type, coords=coords, synthesis=synthesis, dtime=dtime, freq0=freq0, dfreq=dfreq, lon_lat=lon_lat, **kw)
def new(msname, **kwargs): """Create a new simple empty measurement set using simms, given the arguments parsed.""" # Options to attributed dictionary if kwargs["yaml"] is not None: options = ocf.load(kwargs["yaml"]) else: options = ocf.create(kwargs) # Set to struct ocf.set_struct(options, True) # Change path to antenna table try: pos = antenna_tables[options.tel.lower()] except: raise ValueError(f"Invalid antenna table selection, "\ + "the following are available: "\ + f"{', '.join(antenna_tables.keys())}") # Create empty measurment set (design of simms doesn't allow suppressing of output) print(f"==> Creating empty ms with `simms`: {msname}") simms.create_empty_ms( msname=msname, tel=options.tel, pos_type=options.pos_type, pos=pos, dec=options.dec, ra=options.ra, synthesis=options.synthesis, dtime=options.dtime, freq0=options.freq0, nchan=options.nchan, dfreq=options.dfreq, stokes=options.stokes, scan_length=[options.synthesis], nolog=True)
def create_empty_ms(msname="$MS", tel=None, pos=None, pos_type='casa', coords="itrf", synthesis=4, dtime=10, freq0="1.4GHz", dfreq="10MHz", lon_lat=None, **kw): """ Uses simms to create an empty measurement set. Requires either an antenna table (CASA table) or a list of ITRF or ENU positions. msname: MS name tel: Telescope name (This name must be in the CASA Database (check in me.obslist() in casapy) If its not there, then you will need to specify the telescope coordinates via "lon_lat" pos: Antenna positions. This can either a CASA table or an ASCII file. (see simms --help for more on using an ascii file) pos_type: Antenna position type. Choices are (casa, ascii) coords: This is only applicable if you are using an ASCII file. Choices are (itrf, enu) synthesis: Synthesis time in hours dtime: Integration time in seconds freq0: Start frequency dfreq: Channel width nbands: Number of frequency bands **kw: extra keyword arguments. A standard file should have the format: pos1 pos2 pos3* dish_diameter station mount. NOTE: In the case of ENU, the 3rd position (up) is not essential and may not be specified; indicate that your file doesn't have this dimension by enebaling the --noup (-nu) option. """ try: from simms import simms except ImportError: abort("Import simms failed. Please make sure you simms intalled.\n" "Find simms at github.com/SpheMakh/simms or install it by running" " pip install simms") simms.create_empty_ms(msname=II(msname), tel=tel, pos=pos, pos_type=pos_type, coords=coords, synthesis=synthesis, dtime=dtime, freq0=freq0, dfreq=dfreq, lon_lat=lon_lat, **kw)
cmd, stderr=subprocess.PIPE if not isinstance(sys.stderr, file) else sys.stderr, stdout=subprocess.PIPE if not isinstance(sys.stdout, file) else sys.stdout, shell=shell, ) if process.stdout or process.stderr: out, err = process.comunicate() sys.stdout.write(out) sys.stderr.write(err) out = None else: process.wait() if process.returncode: raise SystemExit("%s: returns errr code %d. \n %s" % (command, process.returncode, message or "")) # check if simms is installed _run("simms", ["--help"], message="Something went wrong with the installation") # check if casapy is installed _run("casapy", ["--help", "--log2term", "--nologger", "--nogui", "--help", "-c", "quit"], message=message) # Finally see if we can run simms from simms import simms simms.create_empty_ms( msname="test.MS", tel="kat-7", pos="../simms/observatories/KAT7_ANTENNAS", synthesis=0.5, dtime=60 ) print "Done! All is good"
simms.create_empty_ms( msname=MS, label=None, tel="EVN", pos=itrf, pos_type='ascii', ra=pointing_centre[0], dec=pointing_centre[1], synthesis=tos, scan_length=[tos], dtime=30, freq0="%.8fGHz" % freq0, #1536000000.0, dfreq="%.8fMHz" % (bw / 64.), nchan="64", stokes=stokes, setlimits=False, elevation_limit=0, shadow_limit=0, outdir="./", nolog=False, coords='itrf', lon_lat=None, noup=False, nbands=1, direction=[], date=None, fromknown=False, feed='perfect R L', scan_lag=0, auto_corr=False, optimise_start=None)
shell=shell) if process.stdout or process.stderr: out, err = process.comunicate() sys.stdout.write(out) sys.stderr.write(err) out = None else: process.wait() if process.returncode: raise SystemExit('%s: returns errr code %d. \n %s' % (command, process.returncode, message or "")) # check if simms is installed _run("simms", ["--help"], message="Something went wrong with the installation") # check if casapy is installed _run("casapy", ['--help', '--log2term', '--nologger', '--nogui', '--help', '-c', 'quit'], message=message) # Finally see if we can run simms from simms import simms simms.create_empty_ms(msname="test.MS", tel="kat-7", pos="../simms/observatories/KAT7_ANTENNAS", synthesis=0.5, dtime=60) print "Done! All is good"