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
-
elif os.path.exits(outvis) and not overwrite:
177
+
elif os.path.exists(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
append_tsys, append_gc)
185
185
186
186
187
187
419
419
def mjd_to_date(mjd):
420
420
# Method used in FITSDateUtil
421
421
mjd_epoch = dt.datetime(1858, 11 , 17, 0, 0, 0)
422
422
423
423
mjd_int = int(mjd / 86400)
424
424
delta = dt.timedelta(days=mjd_int)
425
425
return mjd_epoch + delta
426
426
427
427
def mjd_seconds(yy, mm, dd, d=0):
428
428
if (mm < 3):
429
-
yy -= 1
429
+
yy -= 1
430
430
mm += 12
431
431
432
432
dd += d
433
433
b = 0
434
434
435
435
if (yy>1582 or (yy==1582 and (mm>10 or (mm==10 and dd >= 15)))):
436
-
b = np.floor(yy/100.)
436
+
b = np.floor(yy/100.)
437
437
b = 2 - b + int(b/4)
438
438
439
439
val = np.floor(365.25*yy) + np.floor(30.6001*(mm+1)) + dd - 679006.0 + b
440
440
return val
441
441
442
442
443
443
def get_timetuple(ts):
444
444
# ts as string with these possible formats:
445
445
# hh.hh
446
446
# hh:mm.mm