casatasks/src/private/task_getantposalma.py

Modified
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.
84 84 overwriten.
85 85
86 86 asdm is required to be specified. It is the associated ASDM UID in the
87 87 form uid://A002/Xc02418/X29c8.
88 88
89 89 tw is an optional parameter. It is time window in which the antenna positions
90 90 are required, specified as a comma separated pair. Times are UTC and are
91 91 expressed in YY-MM-DDThh:mm:ss.sss format. The end time must be later than
92 92 the begin time.
93 93
94 -snr is an optional parameter. It is the signal-to-noise ratio. Antenna
94 +snr is an optional parameter. If changed from the default value "default",
95 +it must be a nonnegative number representing the signal-to-noise ratio. Antenna
95 96 positions which have corrections less than this value will not be written.
96 -If not specified, positions of all antennas will be written.
97 +If not specified, the default snr as defined by the web service will be used.
98 +The server side default value may change over time as determined by the server
99 +side (non-CASA) team. As of this writing (March 2025), the web service team has
100 +not provided publicly facing documentation on the details of how the default
101 +value is chosen. The most recent information they have provided to us is that
102 +the default value is 5.0.
97 103
98 104 tw and search are optional parameters and are coupled as follows. search
99 105 indicates the search algorithm to use to find the desired antenna positions.
100 106 Supported values of this parameter at the time of writing are 'both_latest'
101 107 and 'both_closest'. The task passes the value of the search parameter verbatim to
102 108 the web service, meaning that users can take advantage of new search algorithms
103 109 as the web service team brings them online. The default algorithm used is
104 110 'both_latest'. In general, the search is limited in time to the specified
105 111 value of tw (time window). However, in the case that tw is not specified, the
106 112 following rules apply. For 'both_latest', the last updated position for each
241 247 raise ValueError(f"Begin time {s0} does not appear to have a valid format. {msg}")
242 248 try:
243 249 t_end = _qa.quantity(_qa.time(s1, form="fits")[0])
244 250 except Exception as e:
245 251 raise ValueError(f"End time {s1} does not appear to have a valid format. {msg}")
246 252 if _qa.ge(t_start, t_end):
247 253 raise ValueError(
248 254 f"Parameter tw, start time ({z[0]}) must be less than end time ({z[1]})."
249 255 )
250 256 parms["tw"] = tw
251 - if snr < 0:
252 - raise ValueError(f"Parameter snr ({snr}) must be non-negative.")
253 - elif snr > 0:
257 + if isinstance(snr, str):
258 + if snr != "default":
259 + raise ValueError("If snr is a string, it's only permissible value is 'default'")
260 + elif snr < 0.0:
261 + raise ValueError(f"If a number, parameter snr ({snr}) must be non-negative.")
262 + elif snr >= 0.0:
254 263 parms["snr"] = snr
255 264 if search:
256 265 parms['search'] = search
257 266 qs = f"?{urlencode(parms)}"
258 267 md.update(parms)
259 268 antpos = None
260 269 for h in hosts:
261 270 if not _is_valid_url_host(h):
262 271 raise ValueError(
263 272 f'Parameter hosts: {h} is not a valid host expressed as a URL.'

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut