Source
28
28
"WARN"
29
29
)
30
30
except URLError as e:
31
31
casalog.post(f"Caught URLError: {str(e)}", "WARN")
32
32
except Exception as e:
33
33
casalog.post(f"Caught Exception when trying to connect: {str(e)}", "WARN")
34
34
return myjson
35
35
36
36
37
37
def getantposalma(
38
-
outfile='', overwrite=False, asdm='', tw='', snr=0, search='both_latest',
38
+
outfile='', overwrite=False, asdm='', tw='', snr="default", search='both_latest',
39
39
hosts=['tbd1.alma.cl', 'tbd2.alma.cl']
40
40
):
41
41
r"""
42
42
Retrieve antenna positions by querying ALMA web service.
43
43
44
44
[`Description`_] [`Examples`_] [`Development`_] [`Details`_]
45
45
46
46
47
47
Parameters
48
48
- outfile_ (path='') - Name of output file to which to write retrieved antenna positions.
241
241
raise ValueError(f"Begin time {s0} does not appear to have a valid format. {msg}")
242
242
try:
243
243
t_end = _qa.quantity(_qa.time(s1, form="fits")[0])
244
244
except Exception as e:
245
245
raise ValueError(f"End time {s1} does not appear to have a valid format. {msg}")
246
246
if _qa.ge(t_start, t_end):
247
247
raise ValueError(
248
248
f"Parameter tw, start time ({z[0]}) must be less than end time ({z[1]})."
249
249
)
250
250
parms["tw"] = tw
251
-
if snr < 0:
252
-
raise ValueError(f"Parameter snr ({snr}) must be non-negative.")
253
-
elif snr > 0:
251
+
if isinstance(snr, str):
252
+
if snr != "default":
253
+
raise ValueError("If snr is a string, it's only permissible value is 'default'")
254
+
elif snr < 0:
255
+
raise ValueError(f"If a number, parameter snr ({snr}) must be non-negative.")
256
+
elif snr >= 0:
254
257
parms["snr"] = snr
255
258
if search:
256
259
parms['search'] = search
257
260
qs = f"?{urlencode(parms)}"
258
261
md.update(parms)
259
262
antpos = None
260
263
for h in hosts:
261
264
if not _is_valid_url_host(h):
262
265
raise ValueError(
263
266
f'Parameter hosts: {h} is not a valid host expressed as a URL.'