Commits

David Mehringer authored 46908642405 Merge
Merge branch 'master' into CAS-14235
No tags

casatasks/src/private/correct_ant_posns_evla.py

Modified
6 6
7 7 from urllib.request import urlopen
8 8 from urllib.error import URLError
9 9 from casatools import table, quanta
10 10 from casatasks import casalog
11 11
12 12 _tb = table( )
13 13 _qa = quanta( )
14 14
15 15 ######################################################################
16 -def correct_ant_posns_evla (vis_name, print_offsets=False):
16 +def correct_ant_posns_evla (vis_name, print_offsets=False, time_limit=0):
17 17 '''
18 18 Given an input visibility MS name (vis_name), find the antenna
19 19 position offsets that should be applied. This application should
20 20 be via the gencal task, using caltype='antpos'.
21 21
22 22 If the print_offsets parameter is True, will print out each of
23 23 the found offsets (or indicate that none were found), otherwise
24 24 runs silently.
25 25
26 26 A list is returned where the first element is the returned error
167 167 if moved_time > obs_time:
168 168 # we are done considering this antenna
169 169 ant_num_stas[ant_ind][6] = True
170 170 else:
171 171 # otherwise, it moved, so the offsets should be reset
172 172 ant_num_stas[ant_ind][3] = 0.0
173 173 ant_num_stas[ant_ind][4] = 0.0
174 174 ant_num_stas[ant_ind][5] = 0.0
175 175 if put_time > obs_time and not ant_num_stas[ant_ind][6] and pad == ant_num_stas[ant_ind][2]:
176 176 # it's the right antenna/pad; add the offsets to those already accumulated
177 - ant_num_stas[ant_ind][3] += Bx
178 - ant_num_stas[ant_ind][4] += By
179 - ant_num_stas[ant_ind][5] += Bz
177 +
178 + # Time limit for antenna corrections in days
179 + #put_time_days = int(str(put_time)[:4]) + int(str(put_time)[4:6]) + int(str(put_time)[6:8])
180 + put_time_str = str(put_time)
181 + put_time_str = put_time_str[:4]+'/'+put_time_str[4:6]+'/'+put_time_str[6:8]
182 +
183 + obs_time_str = str(obs_time)
184 + obs_time_str = obs_time_str[:4]+'/'+obs_time_str[4:6]+'/'+obs_time_str[6:8]
185 +
186 + time_diff = _qa.quantity(put_time_str)['value']-_qa.quantity(obs_time_str)['value']
187 +
188 + if time_limit <= 0 or ( time_diff < time_limit ):
189 + #print("put seperated: " put_time % 10000, )
190 + #print("put time MJD, antenna, pad, offsets = %f %d %s %f %f %f" % (put_time_MJD,ant_num_stas[ant_ind][0],ant_num_stas[ant_ind][2],Bx,By,Bz))
191 + ant_num_stas[ant_ind][3] += Bx
192 + ant_num_stas[ant_ind][4] += By
193 + ant_num_stas[ant_ind][5] += Bz
180 194
181 195 ants = []
182 196 parms = []
183 197 for ant_num_sta in ant_num_stas:
184 198 if ant_num_sta[3] != 0.0 or ant_num_sta[4] != 0.0 or ant_num_sta[5] != 0.0:
185 199 if print_offsets:
186 200 print("Offsets for antenna %4s on pad %3s: %8.5f %8.5f %8.5f" % \
187 201 (ant_num_sta[1], ant_num_sta[2], ant_num_sta[3], ant_num_sta[4], ant_num_sta[5]))
188 202 else:
189 203 casalog.post("offsets for antenna %4s : %8.5f %8.5f %8.5f" % \

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

Add shortcut