-
Notifications
You must be signed in to change notification settings - Fork 1
/
des_check_footprint.py
767 lines (555 loc) · 20.4 KB
/
des_check_footprint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
"""
"""
from __future__ import print_function, division
import glob
import os
import sys
import time
from time import strftime, gmtime
from os.path import basename
import tempfile, logging
import traceback
import matplotlib as mpl
print('matplotlib: ', mpl.__version__)
print('matplotlib.matplotlib_fname(): ',mpl.matplotlib_fname())
# Force matplotlib to not use any Xwindows backend:
try:
mpl.use('Agg')
except:
pass
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
import numpy as np
import astropy
print('astropy.__version__: ', astropy.__version__)
from astropy.table import Table, join
from astropy.coordinates import Angle
import astropy.units as u
# use sys.path.append of functions not in PYTHONPATH
sys.path.append('/home/rgm/soft/python/lib/')
from librgm.table_stats import table_stats
from librgm.plotid import plotid
from librgm.plot_radec import plot_radec
#from librgm import des
from rd_sadt import rd_sadt
import plot_radec_tile as plt_tile
import des_footprint
# functions for ESO progress files
import ob_progress as ob_progress
debug=False
def rd_obprogress(url=False, date=None):
"""
Read in VISTA ESO progress file
Only reads VHS for now
specify url so can read over internet
"""
url_default='http://www.ast.cam.ac.uk/~rgm/vhs/progress/data/current/'
inpath='/data/vhs/progress/'
progid='179A2010'
# no changes should be needed below
if date is None: datestamp = strftime("%Y%m%d", gmtime())
if date is not None: datestamp = date
datestamp = strftime("%Y%m%d", gmtime())
infile = inpath + date + '/' + progid + '.fits'
print('Current working directory: ', os.getcwd())
print('Reading: ', infile)
print('Path: ', os.path.dirname(infile))
print('Absolute Path: ', os.path.abspath(infile))
# read table
ob_table=Table.read(infile)
# add filename into the table metadata
ob_table.meta['filename'] = infile
# how to access the filename later
# 1. filename=ob_table.meta['filename']
# 2. print('plotting: ',ob_table.meta['filename'])
# 3. print('plotting: ' os.path.basename(ob_table.meta['filename']))
# where 3. shows how to trim of the path of the filename
print(ob_table.colnames)
print('table.meta: ', ob_table.meta)
table_stats(infile)
return ob_table
def plot_sadt_tile(sadtfile=None, sadtfiles=None, sadtfile_path=None,
xlimits=None, ylimits=None, raUnits=None,
color='orange'):
"""
"""
from astropy.table import vstack
print('plot_sadt_file:')
if xlimits is None: xlimits=(-180.0,180.0)
if ylimits is None: ylimits=(-90.0,2.0)
print('xlimits: ', xlimits)
print('ylimits: ', ylimits)
print('sadtfile:', sadtfile)
print('sadtfiles:', sadtfiles)
print('sadtfile_path:', sadtfile_path)
raw_input("Enter any key to continue: ")
# read a single sadtfile
if sadtfile_path is None and sadtfiles is None :
sadt = rd_sadt(infile=sadtfile, csv=False)
print('Path: ', os.path.dirname(sadtfile))
sadt.meta['inpath']=os.path.dirname(sadtfile)
sadt.meta['filename']=sadtfile
if sadtfile_path is not None or sadtfiles is not None:
if sadtfiles is None:
filelist = os.listdir(sadtfile_path)
if sadtfiles is not None:
filelist = sadtfiles
print('sadtfile_path: ', sadtfile_path)
print('Number of files in filelist:', len(filelist))
print('filelist:', filelist)
ifile=0
for file in filelist:
ifile = ifile + 1
print('reading file: ', file)
#if sadtfile_path is not None:
# sadtfile = sadtfile_path + '/' + file
#if sadtfile_path is None:
# sadtfile = file
sadtfile = file
if ifile == 1: sadt=rd_sadt(infile=sadtfile, csv=False)
print('Number of SADT tiles: ', len(sadt))
if ifile > 1:
temp=rd_sadt(infile=sadtfile, csv=False)
print('Number of SADT tiles: ', len(temp))
sadt=vstack([sadt, temp])
print('Number of SADT tiles: ', len(sadt))
del temp
print('Path: ', os.path.dirname(sadtfile))
sadt.meta['inpath']=os.path.dirname(sadtfile)
sadt.meta['filename'+str(ifile)]=sadtfile
print('Number of SADT tiles: ', len(sadt))
print(sadt.colnames)
raw_input("Enter any key to continue: ")
xdata=sadt['ra']
ydata=sadt['dec']
print('xrange: ', np.min(xdata), np.max(xdata))
print('yrange: ', np.min(ydata), np.max(ydata))
print('ndata: ', len(xdata))
ntiles=len(xdata)
plt.plot(xdata, ydata, '+k', ms=1.0, label='SADT Tiles: ' + str(ntiles))
plt.title(desfile)
plt.suptitle(sadtfile)
plotid(progname=True)
plt.grid()
plt.legend(markerscale=2.0, fontsize='medium')
# filled polygon
ra=xdata
dec=ydata
for i in range(len(ra)):
if i==0 or i == len(ra): print('i: ', i)
ra_poly, dec_poly=plt_tile.mk_polytile(ra_cen=ra[i], dec_cen=dec[i],
coverage='twice')
xypolygon=np.column_stack((ra_poly, dec_poly))
if i==0 or i == len(ra):
print('xypolygon.shape: ', xypolygon.shape)
print('xypolygon: ',xypolygon)
polygon = Polygon(xypolygon, True, color=color, alpha=0.2)
plt.gca().add_patch(polygon)
ra_poly, dec_poly=plt_tile.mk_polytile(ra_cen=ra[i], dec_cen=dec[i],
coverage='single')
xypolygon=np.column_stack((ra_poly, dec_poly))
if i==0 or i == len(ra):
print('xypolygon.shape: ', xypolygon.shape)
print('xypolygon: ',xypolygon)
polygon = Polygon(xypolygon, True, color=color, alpha=0.1)
plt.gca().add_patch(polygon)
plt.xlim(xlimits)
plt.ylim(ylimits)
print('xlimits: ', xlimits)
print('ylimits: ', ylimits)
plotdir='./'
figname='vhs_des_check'+ '_sadt_'+ datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
def plot_viking_tiles(ra=None, dec=None, PA=0.0,
wrap_24hr=True, overplot=True):
"""
ra, dec in degrees
"""
plot_polygon=True
xdata=ra
ydata=dec
angle=Angle(xdata * u.deg)
angle.wrap_at('180d', inplace=True)
xdata=angle.degree
print('plotting: ',vhs_obprogress.meta['filename'])
filename=vhs_obprogress.meta['filename']
if not plot_polygon:
plt.plot(xdata, ydata, 's', ms=7.0,
color='yellow', markeredgecolor='yellow',
alpha=0.1,
label='OB Progress (submitted)\n' + filename)
if plot_polygon:
plt.plot(xdata, ydata, '.', ms=7.0,
color='yellow', markeredgecolor='yellow',
alpha=0.1,
label='OB Progress (submitted):' + filename)
# filled polygon
ra=xdata
dec=ydata
for i in range(len(ra)):
if i==0 or i == len(ra): print('i: ', i)
ra_poly, dec_poly=plt_tile.mk_polytile(ra_cen=ra[i], dec_cen=dec[i],
coverage='twice', PA=PA)
xypolygon=np.column_stack((ra_poly, dec_poly))
if i==0 or i == len(ra):
print('xypolygon.shape: ', xypolygon.shape)
print('xypolygon: ',xypolygon)
polygon = Polygon(xypolygon, True, color='green', alpha=0.1)
plt.gca().add_patch(polygon)
#print(ob_table.meta)
plt.suptitle(dqcfile_vhs)
plt.legend(fontsize='small')
figname='vhs_des_check_progress_vhs_obprogress_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
plt.suptitle('')
def plot_vhs_obprogress(vhs_obprogress=None, wrap_ra24hr=True,
overplot=True, savefig=True):
"""
"""
plot_polygon=True
PA=90.0
xdata=vhs_obprogress['RA (hrs)']*15.0
ydata=vhs_obprogress['DEC (deg)']
angle=Angle(xdata * u.deg)
angle.wrap_at('180d', inplace=True)
xdata=angle.degree
print('plotting: ',vhs_obprogress.meta['filename'])
filename=vhs_obprogress.meta['filename']
if not plot_polygon:
plt.plot(xdata, ydata, 's', ms=7.0,
color='yellow', markeredgecolor='yellow',
alpha=0.1,
label='OB Progress (submitted)\n' + filename)
if plot_polygon:
plt.plot(xdata, ydata, '.', ms=7.0,
color='yellow', markeredgecolor='yellow',
alpha=0.1,
label='OB Progress (submitted):' + filename)
# filled polygon
ra=xdata
dec=ydata
for i in range(len(ra)):
if i==0 or i == len(ra): print('i: ', i)
ra_poly, dec_poly=plt_tile.mk_polytile(ra_cen=ra[i], dec_cen=dec[i],
coverage='twice', PA=PA)
xypolygon=np.column_stack((ra_poly, dec_poly))
if i==0 or i == len(ra):
print('xypolygon.shape: ', xypolygon.shape)
print('xypolygon: ',xypolygon)
polygon = Polygon(xypolygon, True, color='green', alpha=0.1)
plt.gca().add_patch(polygon)
#print(ob_table.meta)
plt.suptitle(dqcfile_vhs)
plt.legend(fontsize='small')
figname='vhs_des_check_progress_vhs_obprogress_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
plt.suptitle('')
def plot_vhs_tiles(table=None,ra=None, dec=None,
wrap_ra24hr=False, PA=90.0, overplot=True, savefig=True):
"""
table is astropy table
ra, dec in degrees
"""
plot_polygon=True
if wrap_ra24hr:
angle=Angle(xdata * u.deg)
angle.wrap_at('180d', inplace=True)
xdata=angle.degree
# assumes filename is in table.meta
print('plotting: ', table.meta['filename'])
filename = table.meta['filename']
if not plot_polygon:
plt.plot(xdata, ydata, 's', ms=7.0,
color='yellow', markeredgecolor='yellow',
alpha=0.1,
label='OB Progress (submitted)\n' + filename)
if plot_polygon:
plt.plot(xdata, ydata, '.', ms=7.0,
color='yellow', markeredgecolor='yellow',
alpha=0.1,
label='OB Progress (submitted):' + filename)
# filled polygon
ra=xdata
dec=ydata
for i in range(len(ra)):
if i==0 or i == len(ra): print('i: ', i)
ra_poly, dec_poly=plt_tile.mk_polytile(ra_cen=ra[i], dec_cen=dec[i],
coverage='twice', PA=PA)
xypolygon=np.column_stack((ra_poly, dec_poly))
if i==0 or i == len(ra):
print('xypolygon.shape: ', xypolygon.shape)
print('xypolygon: ',xypolygon)
polygon = Polygon(xypolygon, True, color='green', alpha=0.1)
plt.gca().add_patch(polygon)
#print(ob_table.meta)
plt.suptitle(dqcfile_vhs)
plt.legend(fontsize='small')
figname='vhs_des_check_progress_vhs_obprogress_'+ datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
plt.suptitle('')
def plot_phase2_des_check():
"""
"""
datestamp = strftime("%Y%m%d", gmtime())
plotdir='./'
figname='vhs_des_check'+ '_sadt_check_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
if __name__ == '__main__':
import argparse
from argparse import ArgumentParser
global t0
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='check des footprint against SADT xml Tile layout')
date_default = time.strftime("%Y%m%d", gmtime())
parser.set_defaults(date=date_default)
parser.add_argument(
"--date", default=date_default,
dest='date',
help="date as string e.g. '20151101' [DEFAULT is today(gmt)]")
parser.add_argument(
"--rarange", default=[0.0, 360.0], type=float, nargs=2,
help="RA range in degrees in form Deg Deg]")
parser.add_argument(
"--decrange", default=[-90.0, 90.0], type=float, nargs=2,
help="Declination range in degrees in form Deg Deg")
parser.add_argument(
"--raunits", default="hour",
help="RA units hour or degree; default = 'hour'")
parser.set_defaults(path=None)
parser.add_argument(
"--path",
help="Path to SADT xml files")
print('Number of arguments:', len(sys.argv), 'arguments: ', sys.argv[0])
args = parser.parse_args()
date = args.date
rarange = args.rarange
print('RA range:', rarange)
decrange = args.decrange
print('Dec range:', decrange)
raUnits = args.raunits
print('raUnits:', raUnits)
t0 = time.time()
datestamp = strftime("%Y%m%d", gmtime())
if debug: help(plt_tile)
plotdir='./'
t0=time.time()
# extend North to give legend some space
# show DES regions
xlimits=(-60.0,120.0)
xlimits=(120.0, -60.0)
xlimits=(180.0, -180.0)
ylimits=(-90.0,90.0)
xlimits = rarange
ylimits = decrange
# DES related files
desfile = '/home/rgm/soft/des/round13-poly.txt'
descat = '/data/des/Y2Q1/mag_psf_i_leq_18p5_thin.fits'
# VHS SADT files
# maybe change to a directory
sadtfile_path = '/home/rgm/Projects/VHS/Phase2/Period96/20150819'
# 20160803
sadtfile_path = '/data/mbanerji/Projects/VHS_Survey/SADT_outputs/Boundary_tests/'
sadtfile_path = '/data/mbanerji/Projects/VHS_Survey/SADT_outputs/Boundary_tests/Dec2017/'
sadtfiles = ['Str45_DES_RA_XXX_XXX.xml',
'Str46_DES_RA_XXX_XXX.xml',
'Str47_DES_RA_XXX_XXX.xml',
'Str48_DES_RA_XXX_XXX.xml']
# Nov 2016 SADT xml files
sadtfiles = ['Str08_DES_RA_XXX_XXX.xml',
'Str09_DES_RA_XXX_XXX.xml',
'Str10_DES_RA_XXX_XXX.xml',
'Str11_DES_RA_XXX_XXX.xml',
'Str12_DES_RA_XXX_XXX.xml']
# sadtfile='Str02_DES_RA_XXX_XXX.xml'
# sadtfile = sadtfiles[0]
sadtfiles = sorted(glob.glob(sadtfile_path + '*.xml'))
# filelist=os.listdir(sadtfile_path)
# _GPS
# sadtfiles = sorted(glob.glob(sadtfile_path + '*_GPS*.xml'))
if args.path is not None: sadtfile_path = args.path
print('sadtfile_path: ', sadtfile_path)
sadtfiles = sorted(glob.glob(sadtfile_path + '*.xml'))
for sadtfile in sadtfiles:
print('SADT file: ', sadtfile)
raw_input("Enter any key to continue: ")
# VHS and other VISTA footprint files
dqcfile_vhs='/data/vhs/dqc/casu/2015/vistaqc_20150531_tiles_vhs.fits'
dqcfile_viking ='/data/vhs/dqc/casu/2015/vistaqc_20150531_tiles_viking.fits'
vhs_dqc=False
vhs_progress=False
vhs_sadt = True
viking_dqc = True
des_y2q1 = False
vhs_progress_dr3 = False
if vhs_progress_dr3:
eso_date='20130930'
print('Reading vhs_progress_dr3: ' + eso_date)
vhs_obprogress_dr3=rd_obprogress(date=eso_date)
table=vhs_obprogress_dr3
ExecutionTime = ob_progress.rd_ExecutionTimes(table=table, debug=False)
DES = ob_progress.vhs_select_survey(ExecutionTime, survey='DES')
vhs_obprogress_dr3 = vhs_obprogress_dr3[DES]
table=vhs_obprogress_dr3
OBstatus = ob_progress.rd_OBstatus(table=table, debug=False)
completed=True
if completed:
itest = (OBstatus == 'C')
print(len(itest), len(OBstatus[itest]))
vhs_obprogress_dr3 = vhs_obprogress_dr3[itest]
print('Number of completed VHS DES OBs: ', len(vhs_obprogress_dr3))
raw_input("Enter any key to continue: ")
vhs_progress_20150930 = False
if vhs_progress_20150930:
eso_date='20150930'
print('Reading vhs_progress_dr3: ' + eso_date)
vhs_obprogress_20150930=rd_obprogress(date=eso_date)
table=vhs_obprogress_20150930
ExecutionTime = ob_progress.rd_ExecutionTimes(table=table, debug=False)
DES = ob_progress.vhs_select_survey(ExecutionTime, survey='DES')
vhs_obprogress_20150930 = vhs_obprogress_20150930[DES]
table=vhs_obprogress_20150930
OBstatus = ob_progress.rd_OBstatus(table=table, debug=False)
completed=True
if completed:
itest = (OBstatus == 'C')
print(len(itest), len(OBstatus[itest]))
vhs_obprogress_20150930 = vhs_obprogress_20150930[itest]
print('Number of completed VHS DES OBs: ',
len(vhs_obprogress_20150930))
raw_input("Enter any key to continue: ")
if vhs_progress:
print('Read VHS progress from:', date)
vhs_obprogress=rd_obprogress(date=date)
raw_input("Enter any key to continue: ")
if viking_dqc:
print('Read VIKING DQC')
viking=Table.read(dqcfile_viking)
viking.meta['filename'] = dqcfile_viking
print('Table column names: \n', viking.colnames)
print('Table metadata: \n', viking.meta)
viking.pprint
if vhs_dqc:
print('Read VHS DQC')
vhsdqc=Table.read(dqcfile_vhs)
vhsdqc.meta['filename'] = dqcfile_vhs
print('Table column names: \n', vhsdqc.colnames)
print('Table metadata: \n', vhsdqc.meta)
vhsdqc.pprint
despolygon = des_footprint.rd_despolygon(desfile)
raw_input("Enter any key to continue: ")
print('xlimits:', xlimits)
print('ylimits:', ylimits)
fig = plt.figure(figsize=(12,6))
if vhs_sadt:
print('sadtfile_path:', sadtfile_path)
plot_sadt_tile(sadtfile=None, sadtfiles=sadtfiles,
sadtfile_path=sadtfile_path,
xlimits=xlimits, ylimits=ylimits)
print('xlimits:', xlimits)
print('ylimits:', ylimits)
plt.xlim(xlimits)
plt.ylim(ylimits)
plt.title(desfile)
plt.xlabel('RA (degrees)')
plt.ylabel('Declination (degrees)')
xdata=despolygon['ra']
ydata=despolygon['dec']
plt.plot(xdata, ydata, label='DES Round13-poly')
plotid(progname=True)
figname='vhs_des_check_sadt_despolygon_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
plt.suptitle('')
if viking:
xdata=viking['ra']
ydata=viking['dec']
angle=Angle(xdata * u.deg)
angle.wrap_at('180d', inplace=True)
xdata=angle.degree
plt.plot(xdata, ydata, 'sr',
ms=7.0, markeredgecolor='r', alpha=0.2, label='VIKING')
plt.suptitle(dqcfile_viking)
figname='vhs_des_check_viking_1_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
plt.suptitle('')
if vhs_progress:
print('Plot VHS obprogress data')
plot_vhs_obprogress(vhs_obprogress=vhs_obprogress)
raw_input("Enter any key to continue: ")
fig = plt.figure(figsize=(12,6))
plt.xlim(xlimits)
plt.ylim(ylimits)
plt.title(desfile)
plt.xlabel('RA (degrees)')
plt.ylabel('Declination (degrees)')
xdata=despolygon['ra']
ydata=despolygon['dec']
plt.plot(xdata, ydata)
plotid(progname=True)
if viking:
xdata=viking['ra']
ydata=viking['dec']
angle=Angle(xdata * u.deg)
angle.wrap_at('180d', inplace=True)
xdata=angle.degree
plt.plot(xdata, ydata, 'sr',ms=7.0, markeredgecolor='r', alpha=0.2)
plt.suptitle(dqcfile_viking)
figname='vhs_des_check_viking_1_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
plt.suptitle('')
raw_input("Enter any key to continue: ")
if des_y2q1:
print('Reading : ', descat)
y2q1=Table.read(descat)
y2q1.meta['filename'] = descat
print(y2q1.colnames)
xdata=y2q1['RA']
print(np.min(xdata), np.max(xdata))
angle=Angle(xdata * u.deg)
angle.wrap_at('180d', inplace=True)
xdata=angle.degree
ydata=y2q1['DEC']
print(np.min(xdata), np.max(xdata))
print(np.min(ydata), np.max(ydata))
ndata=len(xdata)
plt.plot(xdata, ydata, '.', ms=0.1, color='blue', alpha=0.1,
markeredgecolor=None,
label='Y2Q1 sources: ' +str(ndata))
plt.title(desfile)
plt.suptitle(sadtfile)
xdata=despolygon['ra']
ydata=despolygon['dec']
plt.plot(xdata, ydata, label='DES Round13')
plotid(progname=True)
plt.grid()
plt.legend(fontsize='small')
plotid(progname=True)
plotdir='./'
figname='vhs_des_check'+ '_sadt_y2q1_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
if vhs_dqc:
xdata=vhsdqc['ra']
ydata=vhsdqc['dec']
angle=Angle(xdata * u.deg)
angle.wrap_at('180d', inplace=True)
xdata=angle.degree
plt.plot(xdata, ydata, 'sy',ms=7.0, markeredgecolor='y', alpha=0.2,
label=os.path.basename(dqcfile_vhs))
plt.suptitle(dqcfile_vhs)
plt.legend(fontsize='small')
figname='vhs_des_check_viking_2_' + datestamp + '.png'
print('Saving: '+figname)
plt.savefig(plotdir+figname)
plt.suptitle('')
if vhs_progress:
ob_table=vhs_obprogress
plot_vhs_obprogress(vhs_obprogress=ob_table)