Source
167
167
tb.open(vis)
168
168
times = tb.getcol('TIME')
169
169
first_time = times[0]
170
170
last_time = times[-1]
171
171
tb.close()
172
172
173
173
# remove existing data copy
174
174
if os.path.exists(outvis) and overwrite:
175
175
print("REMOVING EXISTING COPY")
176
176
shutil.rmtree(outvis)
177
-
else os.path.exits(outvis) and not overwrite:
177
+
elif os.path.exits(outvis) and not overwrite:
178
178
print("File ", outvis, " already exists, set overwrite=True or change outvis name")
179
179
return
180
180
# run the antab parsing and table filling
181
181
shutil.copytree(vis, outvis)
182
182
antab_interp(vis, outvis, antab, ant_names, n_band, spws,
183
183
gc_interval, gc_time, first_time, last_time)
184
184
185
185
186
186
187
187
#################################################################################################
419
419
# Method used in FITSDateUtil
420
420
mjd_epoch = dt.datetime(1858, 11 , 17, 0, 0, 0)
421
421
422
422
mjd_int = int(mjd / 86400)
423
423
delta = dt.timedelta(days=mjd_int)
424
424
return mjd_epoch + delta
425
425
426
426
def mjd_seconds(yy, mm, dd, d=0):
427
427
if (mm < 3):
428
428
yy -= 1
429
-
mm += 12
429
+
mm += 12
430
430
431
431
dd += d
432
432
b = 0
433
433
434
434
if (yy>1582 or (yy==1582 and (mm>10 or (mm==10 and dd >= 15)))):
435
435
b = np.floor(yy/100.)
436
-
b = 2 - b + int(b/4)
436
+
b = 2 - b + int(b/4)
437
437
438
438
val = np.floor(365.25*yy) + np.floor(30.6001*(mm+1)) + dd - 679006.0 + b
439
439
return val
440
440
441
441
442
442
def get_timetuple(ts):
443
443
# ts as string with these possible formats:
444
444
# hh.hh
445
445
# hh:mm.mm
446
446
# hh:mm:ss.ss