| ``overwrite (bool=False)`` - Overwrite a file or directory of the same name of outfile if it exists. If overwrite=False and a file or directory of the same name as outfile exists, an exception will be thrown.
from casatools import componentlist, measures, quanta
from casatasks import casalog
from datetime import datetime, timedelta
from urllib import request
from urllib.error import URLError, HTTPError
from urllib.parse import urlparse, quote
def __is_valid_url_host(url):
return bool(parsed.netloc)
context = ssl.create_default_context(cafile=certifi.where())
with request.urlopen(url, context=context, timeout=400) as response:
if response.status == 200:
components = json.loads(response.read().decode('utf-8'))
f"Caught HTTPError: {e.code} {e.reason}: {e.read().decode('utf-8')}",
casalog.post(f"Caught URLError: {str(e)}", "WARN")
casalog.post(f"Caught Exception when trying to connect: {str(e)}", "WARN")
def __getMJD(date_or_mjd, varname):
if isinstance(date_or_mjd, numbers.Number):
elif isinstance(date_or_mjd, str):
pattern = "^\d{4}-\d{2}-\d{2}$"
if re.match(pattern, date_or_mjd):
mjd = int(qa.time(date_or_mjd, form="mjd")[0][:5])
f"If specified as a string, {varname} must be of the form "
f"{varname} must either be a number or a string of the form "
def getcalmodvla(outfile='', overwrite=False, source='', direction='', band='', obsdate='0', refdate='0', hosts=['http://obs.vla.nrao.edu/calmodvla']):