-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestCDS_DB.py
1224 lines (813 loc) · 64.5 KB
/
TestCDS_DB.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
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'''
Created on Sep 30, 2013
@author: Julian Garrido
'''
import unittest
from diffTables import diff_DB_CDS
import numpy
import ConfigParser
import os
class TestAMIGAdb(unittest.TestCase):
'''
This class tests the consistency between amiga database and CDS
It needs to access to a database. The access information should be
in ~/.amigaDB.cfg' or ./amigaDB.cfg' For example:
[amigaDB]
useramiga = *****
passamiga = *****
'''
@classmethod
def setUpClass(self):
try :
config = ConfigParser.RawConfigParser(allow_no_value=True)
config.read(['amigaDB.cfg', os.path.expanduser('~/.amigaDB.cfg')])
self.user = config.get("rootAMIGA", "user")
self.password = config.get("rootAMIGA", "passw")
except (ConfigParser.NoOptionError, ConfigParser.NoOptionError, ConfigParser.Error):
message = "Problems with the configuration options to access the DB"
print message
self.fail(message)
def setUp(self):
pass
def tearDown(self):
pass
@unittest.skip("skipped to avoid overload")
def test_SM_SIZE_FERNANDEZ13_table1(self):
'''
It compares table 1 in the paper of sm size with table 1 in the database (PAPERS_SM_SIZE_FERNANDEZ13.TABLE1)
Fields in PAPERS_SM_SIZE_FERNANDEZ13.TABLE1:
`CIG`, `MType`, `gmag`, `e_gmag`, `rmag`, `e_rmag`, `imag`, `e_imag`, `Ksmag`, `e_Ksmag`, `logM(0.7)`,
`e_logM(0.7)`, `R50(0.7)`, `e_R50(0.7)`, `nsersic`, `e_nsersic`, `Re(0.7)`, `e_Re(0.7)`, `b/a`, `logM(0.75)`,
`e_logM(0.75)`, `R50(0.75)`, `e_R50(0.75)`, `Re(0.75)`, `e_Re(0.75)`
Fields in CDS table (table 1) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'CIG', 'MType', 'gmag', 'rmag', 'imag', 'Ksmag', 'logM(0.7)',
'n', 'Re(0.7)', 'b/a', 'logM(0.75)', 'Re(0.75)'
Therefore columns some columns are not checked.
These are in the DB and not in CDS: `e_gmag`, `e_rmag`, `e_imag`,`e_Ksmag`, `e_logM(0.7)`, `e_nsersic`, `R50(0.7)`, `e_R50(0.7)`, `e_Re(0.7)`,
`e_logM(0.75)`, `R50(0.75)`, `e_R50(0.75)`, `e_Re(0.75)`
These are in CDS and not in the DB: CIG86, AMIGA, Simbad, NED, LEDA, _RA, _DE
'''
print "Test PAPERS_SM_SIZE_FERNANDEZ13.Table1\n"
print " - are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_SM_SIZE_FERNANDEZ13", self.user, self.password)
cdsnames = ['CIG', 'MType', 'gmag', 'rmag', 'imag', 'Ksmag', 'logM(0.7)',
'n', 'Re(0.7)', 'b/a', 'logM(0.75)', 'Re(0.75)' ]
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/MNRAS/434/325/table1&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('MType', int), ('gmag', float), ('rmag', float), ('imag', float),
('Ksmag', float), ('logM(0.7)', float), ('nsersic', float), ('Re(0.7)', float),
('b/a', float), ('logM(0.75)', float), ('Re(0.75)', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `MType`, `gmag`, `rmag`, `imag`, `Ksmag`, `logM(0.7)`, `nsersic`, `Re(0.7)`, `b/a`, `logM(0.75)`, `Re(0.75)` FROM `TABLE1`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0, 0.001, 0.001, 0.001,
0.001, 0.001, 0.01, 0.01,
0.001, 0.01, 0.01])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in SM size Fernandez 13 (table 1)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_table1(self):
'''
It compares table 1 in the paper of AGN Sabater 12 with table 1 in the database (PAPERS_AGN_SABATER12.TABLE1)
Fields in PAPERS_AGN_SABATER12.TABLE1: 'CIG', 'fks', 'e_fks', 'logLks', 'e_logLks', 'f_logLks', 'logLB', 'MType', 'e_MType'
Fields in CDS table (table 1) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'CIG', 'fks', 'e_fks', 'logLks', 'e_logLks', 'f_logLks', 'logLB', 'MType', 'e_MType', CIG86, AMIGA, Simbad, NED, LEDA, _RA, _DE
Therefore CIG86, AMIGA, Simbad, NED, LEDA, _RA, _DE columns are not checked.
TODAS ESTAS COLUMNAS DAN IGUAL
'''
print "Test PAPERS_AGN_SABATER12.Table1\n"
print " - CIG86, AMIGA, Simbad, NED, LEDA, _RA, _DE are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['CIG', 'fks', 'e_fks', 'logLks', 'e_logLks', 'f_logLks', 'logLB', 'MType', 'e_MType']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/table1&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('fks', float), ('e_fks', float), ('logLks', float), ('e_logLks', float),
('f_logLks', int), ('logLB', float), ('MType', float), ('e_MType', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT CIG, fks, e_fks, logLks, e_logLks, f_logLks, logLB, MType, e_MType FROM `TABLE1`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.0000000001, 0.0000000001, 0.001, 0.001, 0, 0.001, 0.01, 0.01])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table 1)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_table2_7(self):
'''
It compares table 2 and 7 (nuclear) in the paper of AGN Sabater 12 with table in the database (PAPERS_AGN_SABATER12.TABLE2 and TABLE7)
Fields in PAPERS_AGN_SABATER12.TABLE2: 'CIG', Plate, MJD, Fiber, cc, z, e_z, v, e_v, zsp, e_zsp, sigma, e_sigma, Com
Fields in PAPERS_AGN_SABATER12.TABLE7: 'CIG', cl.NII, cl.SII, cl.OI, Class, TOType
Fields in CDS table (table nuclear) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'CIG', Plate, MJD, Fiber, cc, z, e_z, v, e_v, zsp, e_zsp, sigma, e_sigma, Com, Sloan, cl.NII, cl.SII, cl.OI, Class, TOType
Therefore Sloan column is not checked
'''
print "Test PAPERS_AGN_SABATER12.Table2 and Table7\n"
print " - Sloan is not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['CIG', 'Plate', 'MJD', 'Fiber', 'cc', 'z', 'e_z', 'v', 'e_v', 'zsp', 'e_zsp', 'sigma', 'e_sigma', 'Com', 'cl.NII', 'cl.SII', 'cl.OI', 'Class', 'TOType']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/nuclear&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('Plate', int), ('MJD', int), ('Fiber', int), ('cc', int),
('z', float), ('e_z', float), ('v', int), ('e_v', int), ('zsp', float),
('e_zsp', float), ('sigma', float), ('e_sigma', float), ('Com', 'S2'),
('cl.NII', 'S9'), ('cl.SII', 'S5'), ('cl.OI', 'S5'), ('Class', 'S9'), ('TOType', 'S5')]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT t2.CIG, Plate, MJD, Fiber, cc, z, e_z, v, e_v, zsp, e_zsp, sigma, e_sigma, Com, `cl.NII`, `cl.SII`, `cl.OI`, `Class`, `TOType` FROM `TABLE7` as t7, TABLE2 as t2 where t2.CIG = t7.CIG"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0, 0, 0, 0,
0.0000001, 0.0000001, 0, 0, 0.0000001,
0.0000001, 0.01, 0.01, -1,
-1, -1, -1, -1, -1])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table 2 and 7)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_table3_6(self):
'''
It compares table 3 and 6 (lines) in the paper of AGN Sabater 12 with table in the database (PAPERS_AGN_SABATER12.TABLE3 and TABLE6)
Fields in PAPERS_AGN_SABATER12.TABLE3: 'CIG', vshift, vdisp, Anu
Fields in PAPERS_AGN_SABATER12.TABLE6: 'CIG', `f_logNIIa`, `l_logNIIa`, `logNIIa`, `e_logNIIa`, `f_logOIIIb`, `l_logOIIIb`, `logOIIIb`, `e_logOIIIb`, `f_logSIIa`, `l_logSIIa`, `logSIIa`, `e_logSIIa`, `f_logOIa`, `l_logOIa`, `logOIa`, `e_logOIa`
Fields in CDS table (table lines) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'CIG', 'vshift', 'vdisp', 'Anu', 'f_logNIIa', 'l_logNIIa', 'logNIIa', 'e_logNIIa', 'f_logOIIIb', 'l_logOIIIb', 'logOIIIb', 'e_logOIIIb', 'f_logSIIa', 'l_logSIIa', 'logSIIa', 'e_logSIIa', 'f_logOIa', 'l_logOIa', 'logOIa', 'e_logOIa'
'''
print "Test PAPERS_AGN_SABATER12.Table3 and Table6\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['CIG', 'vshift', 'vdisp', 'Anu', 'f_logNIIa', 'l_logNIIa', 'logNIIa', 'e_logNIIa', 'f_logOIIIb', 'l_logOIIIb', 'logOIIIb', 'e_logOIIIb', 'f_logSIIa', 'l_logSIIa', 'logSIIa', 'e_logSIIa', 'f_logOIa', 'l_logOIa', 'logOIa', 'e_logOIa']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/lines&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('vshift', float), ('vdisp', float), ('Anu', float),
('f_logNIIa', int), ('l_logNIIa', int), ('logNIIa', float), ('e_logNIIa', float),
('f_logOIIIb', int), ('l_logOIIIb', int), ('ogOIIIb', float), ('e_logOIIIb', float),
('f_logSIIa', int), ('l_logSIIa', int), ('logSIIa', float), ('e_logSIIa', float),
('f_logOIa', int), ('l_logOIa', int), ('logOIa', float), ('e_logOIa', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT t3.CIG, vshift, vdisp, Anu,`f_logNIIa`, `l_logNIIa`, `logNIIa`, `e_logNIIa`, `f_logOIIIb`, `l_logOIIIb`, `logOIIIb`, `e_logOIIIb`, `f_logSIIa`, `l_logSIIa`, `logSIIa`, `e_logSIIa`, `f_logOIa`, `l_logOIa`, `logOIa`, `e_logOIa` FROM TABLE6 as t6, TABLE3 as t3 WHERE t3.CIG = t6.CIG"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.001, 0.001, 0.00001,
0, 0, 0.00001, 0.00001,
0, 0, 0.00001, 0.00001,
0, 0, 0.00001, 0.00001,
0, 0, 0.00001, 0.00001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table 3 and 6)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_table4(self):
'''
It compares table 4 in the paper of AGN Sabater 12 with table in the database (PAPERS_AGN_SABATER12.TABLE4)
Fields in PAPERS_AGN_SABATER12.TABLE4: 'CIG', Age, Z, Per
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'CIG', Age, Z, Per
'''
print "Test PAPERS_AGN_SABATER12.Table4\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['CIG', 'Age', 'Z', 'Per']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/table4&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('Age', float), ('Z', float), ('Per', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT CIG, Age, Z, Per FROM TABLE4"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.001, 0.0001, 0.00001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table 4)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_table5(self):
'''
It compares table 5 in the paper of AGN Sabater 12 with table in the database (PAPERS_AGN_SABATER12.TABLE4)
Fields in PAPERS_AGN_SABATER12.TABLE5: `CIG`, `Line`, `l_Flux`, `Flux`, `e_Flux`, `pkInt`, `Width`, `Pos`, `sigma`, `Com`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'`CIG`, `Line`, `l_Flux`, `Flux`, `e_Flux`, `pkInt`, `Width`, `Pos`, `sigma`, `Com`
'''
print "Test PAPERS_AGN_SABATER12.Table5\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['CIG', 'Line', 'l_Flux', 'Flux', 'e_Flux', 'pkInt', 'Width', 'Pos', 'sigma', 'Com']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/table5&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('Line', int), ('l_Flux', int), ('Flux', float), ('e_Flux', float),
('pkInt', float), ('Width', float), ('Pos', float), ('sigma', float), ('Com', int)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `Line`, `l_Flux`, `Flux`, `e_Flux`, `pkInt`, `Width`, `Pos`, `sigma`, `Com` FROM TABLE5"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0, 0, 0.01, 0.01,
0.00001, 0.00001, 0.001, 0.00001, 0])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table 5)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_tablea1(self):
'''
It compares table A1 in the paper of AGN Sabater 12 with table in the database (PAPERS_AGN_SABATER12.TABLEA1)
Fields in PAPERS_AGN_SABATER12.TABLEA1: `CIG`, `ObjId`, `umag`, `gmag`, `rmag`, `imag`, `zmag`, `Com`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'`CIG`, `ObjId`, `umag`, `gmag`, `rmag`, `imag`, `zmag`, `Com`
'''
print "Test PAPERS_AGN_SABATER12.Tablea1\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['CIG', 'ObjId', 'umag', 'gmag', 'rmag', 'imag', 'zmag', 'Com']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/tablea1&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('ObjId', 'S18'), ('umag', float), ('gmag', float), ('rmag', float),
('imag', float), ('zmag', float), ('Com', int)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `ObjId`, `umag`, `gmag`, `rmag`, `imag`, `zmag`, `Com` FROM `TABLEA1`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, -1, 0.001, 0.001, 0.001,
0.001, 0.001, 0])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table A1)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_tablea2(self):
'''
It compares table A2 in the paper of AGN Sabater 12 with table in the database (PAPERS_AGN_SABATER12.TABLEA2)
Fields in PAPERS_AGN_SABATER12.TABLEA2: `CIG`, MType, BMAG
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
`CIG`, MType, BMAG
'''
print "Test PAPERS_AGN_SABATER12.Tablea2\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['CIG', 'MType', 'BMAG']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/tablea2&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('MType', float), ('BMAG', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, MType, BMAG FROM `TABLEA2`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.01, 0.0001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table A2)')
@unittest.skip("skipped to avoid overload")
def test_AGN_SABATER12_tablea3(self):
'''
It compares table A3 in the paper of AGN Sabater 12 with table in the database (PAPERS_AGN_SABATER12.TABLEA3)
Fields in PAPERS_AGN_SABATER12.TABLEA2: HCG, MType, BMAG
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
HCG, MType, BMAG, Class, SimbadName, _RA, _DE
Therefore Class, SimbadName, _RA, _DE columns are not checked
'''
print "Test PAPERS_AGN_SABATER12.Tablea3\n"
print "Class, SimbadName, _RA, _DE columns are not checked"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_AGN_SABATER12", self.user, self.password)
cdsnames = ['HCG', 'MType', 'BMAG']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/545/A15/tablea3&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('HCG', 'S5'), ('MType', float), ('BMAG', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT HCG, MType, BMAG FROM `TABLEA3`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([-1, 0.01, 0.0001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in AGN Sabater 12 (table A3)')
@unittest.skip("skipped to avoid overload")
def test_COLOR_FERNANDEZ12_table1(self):
'''
It compares table 1 in the paper of sm size with table 1 in the database (PAPERS_COLOR_FERNANDEZ12.TABLE1)
Fields in PAPERS_COLOR_FERNANDEZ12.TABLE1:
`CIG`, `VELOC_HC`, `E_VELOC_HC`, `r_Vhel`, `DIST`, `MType`, `e_MType`, `OptAssym`, `r_MType`, `Bmag`, `e_Bmag`,
`Ag`, `Ai`, `Ak`, `Bmag_corr`, `LogLB`, `MajAxis`, `MinAxis`, `MajAxis_p`, `MinAxis_p`, `Inc`, `Studied`
Fields in CDS table (table 1) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'CIG', 'HV', 'Dist', 'TT', 'Bmag', 'Bmagc' , 'logLB', 'amaj', 'bmin', 'amajp', 'bminp', 'i', 'St'
Therefore columns some columns are not checked.
These are in the DB and not in CDS: `E_VELOC_HC`, `e_MType`, `OptAssym`, `r_MType`, `e_Bmag`, `Ag`, `Ai`, `Ak`,
These are in CDS and not in the DB: CIG86, AMIGA, Simbad, NED, LEDA, _RA, _DE
'''
print "Test PAPERS_COLOR_FERNANDEZ12.Table1\n"
print " - are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_COLOR_FERNANDEZ12", self.user, self.password)
cdsnames = ['CIG', 'HV', 'Dist', 'TT', 'Bmag', 'Bmagc' , 'logLB', 'amaj', 'bmin', 'amajp', 'bminp', 'i', 'St' ]
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/540/A47/table1&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('VELOC_HC', float), ('DIST', float), ('Mtype', float), ('Bmag', float), ('Bmag_corr', float),
('LogLB', float), ('MajAxis', float), ('MinAxis', float), ('MajAxis_p', float),
('MinAxis_p', float), ('Inc', float), ('Studied', int)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `VELOC_HC`, `DIST`, `MType`, `Bmag`, `Bmag_corr`, `LogLB`, `MajAxis`, `MinAxis`, `MajAxis_p`, `MinAxis_p`, `Inc`, `Studied` FROM `TABLE1`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.0001, 0])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in Color Fernandez 12 (table 1)')
@unittest.skip("skipped to avoid overload")
def test_COLOR_FERNANDEZ12_table2(self):
'''
It compares table 2 in the paper of sm size with table 2 in the database (PAPERS_COLOR_FERNANDEZ12.TABLE2)
Fields in PAPERS_COLOR_FERNANDEZ12.TABLE2:
`cig`, `gmag`, `gmagExt`, `Kcorr_g`, `gMag_abs`, `rmag`, `rmagExt`, `Kcorr_r`, `rMag_abs`, `Ai(g-r)`, `g-r`
Fields in CDS table (table 2) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/545/A15:
'CIG', `gmag`, `gAg`, `gKcorr`, `gMAG`, `rmag`, `rAg`, `rKcorr`, `rMAG`, `Ai(g-r)`, `g-r`
Therefore columns some columns are not checked.
These are in the DB and not in CDS: ---
These are in CDS and not in the DB: ---
'''
print "Test PAPERS_COLOR_FERNANDEZ12.Table2\n"
print " - are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_COLOR_FERNANDEZ12", self.user, self.password)
cdsnames = ['CIG', 'gmag', 'gAg', 'gKcorr', 'gMAG', 'rmag', 'rAg', 'rKcorr', 'rMAG', 'Ai(g-r)', 'g-r']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/540/A47/table2&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('cig',int), ('gmag', float), ('gmagExt', float), ('Kcorr_g', float), ('gMag_abs', float), ('rmag', float),
('rmagExt', float), ('Kcorr_r', float), ('rMag_abs', float), ('Ai(g-r)', float), ('g-r', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `cig`, `gmag`, `gmagExt`, `Kcorr_g`, `gMag_abs`, `rmag`, `rmagExt`, `Kcorr_r`, `rMag_abs`, `Ai(g-r)`, `g-r` FROM `TABLE2`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in Color Fernandez 12 (table 2)')
@unittest.skip("skipped to avoid overload")
def test_HI_ESPADA11_table1(self):
'''
It compares table 1 in the paper of sm size with table 1 in the database (PAPERS_HI_ESPADA11.TABLE1)
Fields in PAPERS_HI_ESPADA11.TABLE1:
`cig`, `Class`, `AFR`, `e_AFR`, `e1`, `e2`
Fields in CDS table (table 1) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/532/A117:
'CIG', 'Class', 'AFR', 'e_AFR', 'e1', 'e2' AMIGA, Simbad, NED, LEDA, _RA, _DE, CIG_DATA
Therefore columns some columns are not checked.
These are in the DB and not in CDS:
These are in CDS and not in the DB: AMIGA, Simbad, NED, LEDA, _RA, _DE, CIG_DATA
'''
print "Test PAPERS_HI_ESPADA11.Table1\n"
print " - are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_HI_ESPADA11", self.user, self.password)
cdsnames = ['CIG', 'Class', 'AFR', 'e_AFR', 'e1', 'e2']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/532/A117/table1&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('cig',int), ('Class', float), ('AFR', float), ('e_AFR', float), ('e1', float), ('e2', float),
('LogLB', float), ('MajAxis', float), ('MinAxis', float), ('MajAxis_p', float),
('MinAxis_p', float), ('Inc', float), ('Studied', int)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `cig`, `Class`, `AFR`, `e_AFR`, `e1`, `e2` FROM `TABLE1`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0, 0.0001, 0.0001, 0.0001, 0.0001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in HI_ESPADA11 (table 1)')
@unittest.skip("skipped to avoid overload")
def test_LISENFELD2011_table1_5(self):
'''
It compares table 1 and 5 in the paper of Lisenfeld 2011 with table 1 and 5 in the database (CIG_CO_LISENFELD11).
Fields in CIG_CO_LISENFELD11.Table1: cig, DIST, VEL, D25, POS_INCLIN_LOS, MType, IA, log(LB), l_log(LFIR), log(LFIR) and log(LK)
Fields in CIG_CO_LISENFELD11.Table5: cig: , Det, log(MH2c), log(MH2m), log(MH2e), Tel, BibCode
Fields in CDS table (table 1 and 5) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/534/A102:
CIG, Dist, Vel, D25, i, TT, Mi, log(LB), l_log(LFIR), log(LFIR), log(LK), Det, MH2c, MH2e, Simbad, NED, LEDA, AMIGA, _RA, _DE
Therefore, log(MH2m), tel and bibcode are not checked (because they are not in CDS).
Therefore, Simbad, NED, LEDA, AMIGA, _RA, _DE, V are not checked because they are not in the BD
'''
print "Test LISENFELD2011_table1_5 \n"
print " - log(MH2m), tel and bibcode are not checked (because they are not in CDS).\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_CO_LISENFELD11", self.user, self.password)
cdsnames = ['CIG', 'Dist', 'Vel','D25','i','TT','Mi','log(LB)','l_log(LFIR)','log(LFIR)','log(LK)','Det','MH2c','MH2e']
url="http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/534/A102"
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/534/A102/table15&-out.max=unlimited"
self.diff.getTableFromCDS(url)
#dtypes=[('cig',int), ('DIST', int), ('VEL', int), ('D25', float), ('POS_INCL_LOS', float), ('MType', int), ('IA', int), ('log(LB)', float), ('l_log(LFIR)', str), ('log(LFIR)', float), ('log(LK)', float), ('Det', int), ('log(MH2c)', float), ('log(MH2m)', float), ('log(MH2e)', float), ('Tel', int), ('BibCode', int)]
#query = "select t1.cig, t1.dist, t1.vel, t1.d25, t1.pos_incl_los, t1.mtype, t1.ia, t1.`log(LB)`, t1.`l_log(lfir)`, t1.`log(lfir)`, t1.`log(LK)`, t5.Det, t5.`log(MH2c)`, t5.`log(MH2m)`, t5.`log(MH2e)`, t5.Tel, t5.BibCode from TABLE1 as t1, TABLE5 as t5 WHERE t1.cig = t5.cig"
#I have to remove ('log(MH2m)', float), tel y bibcode, from the query because cds doesn't return these columns: , t5.`log(MH2m)`
dtypes=[('cig',int), ('DIST', int), ('VEL', int), ('D25', float), ('POS_INCL_LOS', float), ('MType', int), ('IA', int), ('log(LB)', float), ('l_log(LFIR)', 'S2'), ('log(LFIR)', float), ('log(LK)', float), ('Det', int), ('log(MH2c)', float), ('log(MH2e)', float)]
dbnames =[pair[0] for pair in dtypes]
query = "select t1.cig, t1.dist, t1.vel, t1.d25, t1.pos_incl_los, t1.mtype, t1.ia, t1.`log(LB)`, t1.`l_log(lfir)`, t1.`log(lfir)`, t1.`log(LK)`, t5.Det, t5.`log(MH2c)`, t5.`log(MH2e)` from TABLE1 as t1, TABLE5 as t5 WHERE t1.cig = t5.cig"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0.0001, 0.0001, 0.0001, 0.001, 0.0001, 0.0001, 0.0001, 0.001, 0, 0.001, 0.001, 0.0001, 0.001, 0.001 ])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in Lisenfeld 2011 (table 1 and 5)')
@unittest.skip("skipped to avoid overload")
def test_LISENFELD2011_table4(self):
'''
It compares table 4 in the paper of Lisenfeld 2011 with table 1 and 5 in the database (CIG_CO_LISENFELD11).
Fields in CIG_CO_LISENFELD11.Table4: `cig`, `u_CIG`, `oRA`, `oDE`, `rms`, `l_ICO`, `ICO`, `e_ICO`, `VCO`, `WCO`, `Tel`
Fields in CDS table (table 4) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/534/A102:
'CIG', 'u_CIG', 'oRA','oDE','rms','l_ICO','ICO','e_ICO','VCO','WCO','Tel'
'''
print "Test LISENFELD2011_table4 \n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_CO_LISENFELD11", self.user, self.password)
cdsnames = ['CIG', 'u_CIG', 'oRA','oDE','rms','l_ICO','ICO','e_ICO','VCO','WCO','Tel']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/534/A102/table4&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('cig',int), ('u_CIG', 'S2'), ('oRA', int), ('oDE', int), ('rms', float), ('l_ICO', 'S2'), ('ICO', float), ('e_ICO', float), ('VCO', int), ('WCO', int), ('Tel', int)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `cig`, `u_CIG`, `oRA`, `oDE`, `rms`, `l_ICO`, `ICO`, `e_ICO`, `VCO`, `WCO`, `Tel` FROM `TABLE4`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0.1, -1, 0.1, 0.1, 0.001, -1, 0.001, 0.001, 0.1, 0.1, 0.1 ])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in Lisenfeld 2011 (table 4)')
@unittest.skip("skipped to avoid overload")
def test_FOURIER_DURBALA09_table1(self):
'''
It compares table 1 in the paper of sm size with table 1 in the database (PAPERS_FOURIER_DURBALA09.TABLE1)
Fields in PAPERS_FOURIER_DURBALA09.TABLE1:
`cig`, `PA`, `method`, `Qg`, `e_Qg`, `Qb`, `e_Qb`, `Qs`, `e_Qs`, `A2b`, `A4b`, `A6b`, `lbar`, `r(Qb)`
Fields in CDS table (table 1) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/mnras/397/1756:
'CIG', 'PA', 'met', 'Qg', 'e_Qg', 'Qb', 'e_Qb', 'Qs', 'e_Qs', 'A2b', 'A4b', 'A6b', 'lbar', 'r(Qb)'
Therefore columns some columns are not checked.
These are in the DB and not in CDS:
These are in CDS and not in the DB: CIG86, AMIGA, Simbad, NED, LEDA, _RA, _DE
'''
print "Test PAPERS_FOURIER_DURBALA09.Table1\n"
print " - are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_FOURIER_DURBALA09", self.user, self.password)
cdsnames = ['CIG', 'PA', 'met', 'Qg', 'e_Qg', 'Qb', 'e_Qb', 'Qs', 'e_Qs', 'A2b', 'A4b', 'A6b', 'lbar', 'r(Qb)']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/mnras/397/1756/table1&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('PA', int), ('method', 'S3'), ('Qg', float), ('e_Qg', float), ('Qb', float),
('e_Qb', float), ('Qs', float), ('e_Qs', float), ('A2b', float),
('A4b', float), ('A6b', float), ('lbar', float), ('r(Qb)', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `cig`, `PA`, `method`, `Qg`, `e_Qg`, `Qb`, `e_Qb`, `Qs`, `e_Qs`, `A2b`, `A4b`, `A6b`, `lbar`, `r(Qb)` FROM `TABLE1`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0, -1, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.0001, 0.0001,
0.0001, 0.0001, 0.01, 0.01])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in FOURIER_DURBALA09 (table 1)')
@unittest.skip("skipped to avoid overload")
def test_PHOT_DURBALA08_table1_2_4_9(self):
'''
It compares table 1,2,4,9 in the paper of sm size with table 1,2,4,9 in the database (PAPERS_PHOT_DURBALA08.TABLE1)
Fields in PAPERS_PHOT_DURBALA08.TABLE1:
`cig`, `UGC_NGCname`, `RAh`, `RAm`, `RAs`, `DE-`, `DEd`, `DEm`, `DEs`, `Vr`, `Inc`, `MType_old`, `MType_rev`
t2.`(g-i)`, t2.`iMag`, t2.`a_i25`, t2.`a_g25`,
t4.`B/T`, t4.`D/T`, t4.`Bar/T`, t4.`B/D`, t4.`r_e`, t4.`mu_e`, t4.`n_b`, t4.`h_r`, t4.`mu_0`, t4.`l_bar`, t4.`n_bar`,
t9.`C`, t9.`A`, t9.`S`
Fields in CDS table (table 1) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/mnras/390/881:
'CIG', RAJ2000, DEJ2000, Vr, Inc, MTrev, g-i, iMAG, ai25, ag25, B/T, D/T, Bar/T, B/D, re, mue, nb, hr, mu0, lbar, nbar, C, A,S
Therefore columns some columns are not checked.
These are in the DB and not in CDS: UGC_NGCname`, `MType_old`, `RAh`, `RAm`, `RAs`, `DE-`, `DEd`, `DEm`, `DEs`,
These are in CDS and not in the DB: RAJ2000, DEJ2000, AMIGA, Simbad, NED, LEDA, _RA, _DE
'''
print "Test PAPERS_PHOT_DURBALA08.Table1,2,4,9\n"
print " - are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_PHOT_DURBALA08", self.user, self.password)
cdsnames = ['CIG', 'Vr', 'Inc', 'MTrev', 'g-i', 'iMAG', 'ai25', 'ag25', 'B/T', 'D/T', 'Bar/T', 'B/D', 're', 'mue', 'nb', 'hr', 'mu0', 'lbar', 'nbar', 'C', 'A','S']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/MNRAS/390/881/catalog&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('Vr', int), ('Inc', int), ('MType_rev', 'S15'), ('(g-i)', float),
('iMag', float), ('a_i25', float), ('a_g25', float), ('B/T', float), ('D/T', float),
('Bar/T', float), ('B/D', float), ('r_e', float), ('mu_e', float), ('n_b', float),
('h_r', float), ('mu_0', float), ('l_bar', float), ('n_bar', float), ('C', float) ,
('A', float), ('S', float)]
dbnames =[pair[0] for pair in dtypes]
#query = "SELECT t1.`cig`, t1.`Vr`, t1.`Inc`, t1.`MType_rev`, t2.`(g-i)`, t2.`iMag`, t2.`a_i25`, t2.`a_g25`, t4.`B/T`, t4.`D/T`, t4.`Bar/T`, t4.`B/D`, t4.`r_e`, t4.`mu_e`, t4.`n_b`, t4.`h_r`, t4.`mu_0`, t4.`l_bar`, t4.`n_bar`, t9.`C`, t9.`A`, t9.`S` FROM `TABLE1` as t1, TABLE2 as t2, TABLE4 as t4, TABLE9 as t9 where t1.cig = t2.cig AND t1.cig = t4.cig AND t1.cig=t9.cig"
query = "SELECT t1.`cig`, t1.`Vr`, t1.`Inc`, t1.`MType_rev`, t2.`(g-i)`, t2.`iMag`, t2.`a_i25`, t2.`a_g25`, t4.`B/T`, t4.`D/T`, t4.`Bar/T`, t4.`B/D`, t4.`r_e`, t4.`mu_e`, t4.`n_b`, t4.`h_r`, t4.`mu_0`, t4.`l_bar`, t4.`n_bar`, t9.`C`, t9.`A`, t9.`S` FROM `TABLE1` as t1 LEFT JOIN (TABLE2 as t2, TABLE4 as t4, TABLE9 as t9) ON (t1.cig = t2.cig AND t1.cig = t4.cig AND t1.cig=t9.cig)"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0, 0,-1, 0.001,
0.001, 0.01, 0.01, 0.0001, 0.0001,
0.0001 , 0.0001, 0.001, 0.001, 0.001,
0.001, 0.001, 0.001, 0.001, 0.001,
0.001, 0.001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in PHOT_DURBALA08 (table 1,2,4,9)')
@unittest.skip("skipped to avoid overload")
def test_RADIOFIR_SABATER08_table1(self):
'''
It compares table 1 in the paper of RadioFIR Sabater 08 with table in the database (PAPERS_RADIOFIR_SABATER08.TABLE1)
Fields in PAPERS_RADIOFIR_SABATER08.TABLE1: `CIG`, `Type1`, `Type2`, `Type3`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/486/73:
`CIG`, `Type1`, `Type2`, `Type3`, Link1, AMIGA, NED, Simbad, _RA, _DE
Therefore: Link1, AMIGA, NED, Simbad, _RA, _DE columns are not checked
'''
print "Test PAPERS_RADIOFIR_SABATER08.Table1\n"
print "Link1, AMIGA, NED, Simbad, _RA, _DE columns are not checked"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_RADIOFIR_SABATER08", self.user, self.password)
cdsnames = ['CIG', 'Type1', 'Type2', 'Type3']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/486/73/table1&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('CIG', int), ('Type1', 'S11'), ('Type2', 'S6'), ('Type3', 'S5')]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `Type1`, `Type2`, `Type3` FROM `TABLE1`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, -1, -1, -1])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in RADIOFIR Sabater 08 (table 1)')
@unittest.skip("skipped to avoid overload")
def test_RADIOFIR_SABATER08_table2(self):
'''
It compares table 2 in the paper of RadioFIR Sabater 08 with table in the database (PAPERS_RADIOFIR_SABATER08.TABLE2)
Fields in PAPERS_RADIOFIR_SABATER08.TABLE2: `CIG`, `Sample`, `logLFIR`, `l_logLFIR`, `logL1.4GHz`, `MType`, `Excess
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/486/73:
`CIG`, `Sample`, `logLFIR`, `l_logLFIR`, `logL1.4GHz`, `MType`, `Excess`, Link5, AMIGA, NED, Simbad, _RA, _DE
Therefore: Link5, AMIGA, NED, Simbad, _RA, _DE columns are not checked
'''
print "Test PAPERS_RADIOFIR_SABATER08.Table2\n"
print "Link5, AMIGA, NED, Simbad, _RA, _DE columns are not checked"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_RADIOFIR_SABATER08", self.user, self.password)
cdsnames = ['CIG', 'Sample', 'logLFIR', 'l_logLFIR', 'logL1.4GHz', 'MType', 'Excess']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/486/73/table2&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('CIG', int), ('Sample', 'S1'), ('logLFIR', float), ('l_logLFIR', int),
('logL1.4GHz', float), ('MType', 'S4'), ('Excess', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `Sample`, `logLFIR`, `l_logLFIR`, `logL1.4GHz`, `MType`, `Excess` FROM `TABLE2`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, -1, 0.001, 0, 0.001, -1, 0.01])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in RADIOFIR Sabater 08 (table 2)')
@unittest.skip("skipped to avoid overload")
def test_RADIOFIR_SABATER08_table4(self):
'''
It compares table 4 in the paper of RadioFIR Sabater 08 with table in the database (PAPERS_RADIOFIR_SABATER08.TABLE4)
Fields in PAPERS_RADIOFIR_SABATER08.TABLE4: `CIG`, `NVSS`, `FIRST`, `Dist`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/486/73:
`CIG`, `NVSS`, `FIRST`, `Dist`, Link9, AMIGA, NED, Simbad, _RA, _DE
Therefore: Link9, AMIGA, NED, Simbad, _RA, _DE columns are not checked
'''
print "Test PAPERS_RADIOFIR_SABATER08.Table4\n"
print "Link9, AMIGA, NED, Simbad, _RA, _DE columns are not checked"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_RADIOFIR_SABATER08", self.user, self.password)
cdsnames = ['CIG', 'NVSS', 'FIRST', 'Dist']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/486/73/table4&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('CIG', int), ('NVSS', float), ('FIRST', float), ('Dist', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `NVSS`, `FIRST`, `Dist` FROM `TABLE4`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.01, 0.001, 0.01])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in RADIOFIR Sabater 08 (table 4)')
@unittest.skip("skipped to avoid overload")
def test_RADIOFIR_SABATER08_table5(self):
'''
It compares table 5 in the paper of RadioFIR Sabater 08 with table in the database (PAPERS_RADIOFIR_SABATER08.TABLE5)
Fields in PAPERS_RADIOFIR_SABATER08.TABLE5: `CIG`, `Sample`, `S25um`, `l_S25um`, `S60um`, `l_S60um`, `Type`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/486/73:
`CIG`, `Sample`, `S25um`, `l_S25um`, `S60um`, `l_S60um`, `Type`, Link13, AMIGA, NED, Simbad, _RA, _DE
Therefore: Link13, AMIGA, NED, Simbad, _RA, _DE columns are not checked
'''
print "Test PAPERS_RADIOFIR_SABATER08.Table5\n"
print "Link13, AMIGA, NED, Simbad, _RA, _DE columns are not checked"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_RADIOFIR_SABATER08", self.user, self.password)
cdsnames = ['CIG', 'Sample', 'S25um', 'l_S25um', 'S60um', 'l_S60um', 'Type']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/486/73/table5&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('CIG', int), ('Sample', 'S1'), ('S25um', float), ('l_S25um', int),
('S60um', float), ('l_S60um', int), ('Type', 'S6')]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `Sample`, `S25um`, `l_S25um`, `S60um`, `l_S60um`, `Type` FROM `TABLE5`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, -1, 0.001, 0, 0.001, 0, -1])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in RADIOFIR Sabater 08 (table 5)')
@unittest.skip("skipped to avoid overload")
def test_RADIOFIR_SABATER08_table6(self):
'''
It compares table 6 in the paper of RadioFIR Sabater 08 with table in the database (PAPERS_RADIOFIR_SABATER08.TABLE6)
Fields in PAPERS_RADIOFIR_SABATER08.TABLE6: `CIG`, `RAJ2000`, `DEJ2000`, `Type1`, `Type2`, `F3`, `F5`, `Sample`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/486/73:
`CIG`, `RAJ2000`, `DEJ2000`, `Type1`, `Type2`, `F3`, `F5`, `Sample`, Link17, AMIGA, NED, Simbad, _RA, _DE
Therefore: Link17, AMIGA, NED, Simbad, _RA, _DE columns are not checked
'''
print "Test PAPERS_RADIOFIR_SABATER08.Table6\n"
print "Link17, AMIGA, NED, Simbad, _RA, _DE columns are not checked"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_RADIOFIR_SABATER08", self.user, self.password)
cdsnames = ['CIG', 'RAJ2000', 'DEJ2000', 'Type1', 'Type2', 'F3', 'F5', 'Sample']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/486/73/table6&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('CIG', int), ('RAJ2000', 'S11'), ('DEJ2000', 'S11'), ('Type1', 'S5'),
('Type2', 'S6'), ('F3', int), ('F5', int), ('Sample', int)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `RAJ2000`, `DEJ2000`, `Type1`, `Type2`, `F3`, `F5`, `Sample` FROM `TABLE6`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, -1, -1, -1, -1, 0, 0, 0])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in RADIOFIR Sabater 08 (table 6)')
@unittest.skip("RADIOCONT_LEON08 is skipped. it has errorsssssssssss")
def test_RADIOCONT_LEON08_table2(self):
'''
It compares table 2 in the paper of RADIOCONT LEON 08 with table 2 in the database (PAPERS_RADIOCONT_LEON08.TABLE2).
Fields in PAPERS_RADIOCONT_LEON08.TABLE2: 'CIG', 'l_F325', 'F325', 'e_F325', 'r_F325', 'l_P325', 'P325', 'l_F1420', 'F1420', 'e_F1420', 'r_F1420', 'l_P1420', 'P1420', 'l_F4850', 'F4850', 'e_F4850', 'r_F4850', 'l_P4850', 'P4850'
Fields in CDS table (table 2) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/485/475:
'CIG', 'l_F325', 'F325', 'e_F325', 'r_F325', 'l_P325', 'P325', 'l_F1420', 'F1420', 'e_F1420', 'r_F1420', 'l_P1420', 'P1420', 'l_F4850', 'F4850', 'e_F4850', 'r_F4850', 'l_P4850', 'P4850', K73, AMIGa, Simbad, NED, _RA, _DE
Therefore K73, AMIGA, Simbad, NED, _RA, _DE columns are not checked
'''
print "Test PAPERS_RADIOCONT_LEON08.Table2\n"
print " - K73, AMIGA, Simbad, NED, _RA, _DE are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_RADIOCONT_LEON08", self.user, self.password)
cdsnames = ['CIG', 'l_F325', 'F325', 'e_F325', 'r_F325', 'l_P325', 'P325', 'l_F1420', 'F1420', 'e_F1420', 'r_F1420', 'l_P1420', 'P1420', 'l_F4850', 'F4850', 'e_F4850', 'r_F4850', 'l_P4850', 'P4850']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/485/475/table2&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('l_F325', 'S1'), ('F325', float), ('e_F325', float), ('r_F325', int), ('l_P325', 'S1'), ('P325', float),
('l_F1420', 'S1'), ('F1420', float), ('e_F1420', float), ('r_F1420', int), ('l_P1420', 'S1'), ('P1420', float),
('l_F4850', 'S1'), ('F4850', float), ('e_F4850', float), ('r_F4850', int), ('l_P4850', 'S1'), ('P4850', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT CIG, l_F325, F325, e_F325, r_F325, l_P325, P325, l_F1420, F1420, e_F1420, r_F1420, l_P1420, P1420, l_F4850, F4850, e_F4850, r_F4850, l_P4850, P4850 FROM `TABLE2`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, -1, 0.001, 0.001, 0, -1, 0.0001, -1, 0.001, 0.001, 0, -1, 0.0001, -1, 0.001, 0.001, 0, -1, 0.0001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in RADIOCONT LEON 2008 (table 2)')
@unittest.skip("skipped to avoid overload")
def test_ISOLATATION_VERLEY07b_table3(self):
'''
It compares table 3 in the paper of ISOLATATION_VERLEY07b with table in the database (PAPERS_ISOLATATION_VERLEY07b.TABLE3)
Fields in PAPERS_ISOLATATION_VERLEY07b.TABLE3: `cig`, `NName`, `RAdeg`, `DEdeg`, `Area`, `Emag`, `Dist`, `D25`, `Flg1`, `Flg2`, `Vel`, `Ref`, BIB
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/470/505:
`CIG`, `NName`, `RAJ2000`, `DEJ2000`, `Area`, `Emag`, `Dist`, `D25`, `Flg1`, `Flg2`, `Vel`, `Ref`, Source, Simad, Ned
Therefore: BIB, Source, Simad, Ned columns are not checked
'''
print "Test PAPERS_ISOLATATION_VERLEY07b.Table3\n"
print "BIB, Source, Simad, Ned columns are not checked"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_ISOLATION_VERLEY07b", self.user, self.password)
cdsnames = ['CIG', 'NName', 'RAJ2000', 'DEJ2000', 'Area', 'Emag', 'Dist', 'D25', 'Flg1', 'Flg2', 'Vel', 'Ref']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/470/505/table3&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('cig', int), ('NName', int), ('RAdeg', float), ('DEdeg', float),
('Area', float), ('Emag', float), ('Dist', float), ('D25', float),
('Flg1', int), ('Flg2', int), ('Vel', int), ('Ref', int)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `cig`, `NName`, `RAdeg`, `DEdeg`, `Area`, `Emag`, `Dist`, `D25`, `Flg1`, `Flg2`, `Vel`, `Ref` FROM `TABLE3`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0, 0.000001, 0.000001, 0.0001, 0.0001, 0.01, 0.01, 0, 0, 0, 0])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in ISOLATION Verley 07b (table 3)')
@unittest.skip("skipped to avoid overload")
def test_FIR_LISENFELD07_table2(self):
'''
It compares table 2 in the paper of FIR_LISENFELD07 with table in the database (PAPERS_FIR_LISENFELD07.TABLE2)
Fields in PAPERS_FIR_LISENFELD07.TABLE2: `cig`, `l_F12um`, `F12um`, `e_F12um`, `n_F12um`, `f_F12um`, `l_F25um`,
`F25um`, `e_F25um`, `n_F25um`, `f_F25um`, `l_F60um`, `F60um`, `e_F60um`, `n_F60um`, `f_F60um`, `l_F100um`,
`F100um`, `e_F100um`, `n_F100um`, `f_F100um`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/462/507:
`CIG`, `l_F12um`, `F12um`, `e_F12um`, `n_F12um`, `f_F12um`, `l_F25um`,
`F25um`, `e_F25um`, `n_F25um`, `f_F25um`, `l_F60um`, `F60um`, `e_F60um`, `n_F60um`, `f_F60um`, `l_F100um`,
`F100um`, `e_F100um`, `n_F100um`, `f_F100um`, CIG_data, IRAS
Therefore: CIG_data, IRAS columns are not checked
'''
print "Test PAPERS_FIR_LISENFELD07.Table3\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_FIR_LISENFELD07", self.user, self.password)
cdsnames = ['CIG', 'l_F12um', 'F12um', 'e_F12um', 'n_F12um', 'f_F12um', 'l_F25um',
'F25um', 'e_F25um', 'n_F25um', 'f_F25um', 'l_F60um', 'F60um', 'e_F60um', 'n_F60um',
'f_F60um', 'l_F100um', 'F100um', 'e_F100um', 'n_F100um', 'f_F100um']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/462/507/table2&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('cig', int), ('l_F12um', 'S1'), ('F12um', float), ('e_F12um', float), ('n_F12um', int), ('f_F12um', 'S1'),
('l_F25um', 'S1'), ('F25um', float), ('e_F25um', float), ('n_F25um', int), ('f_F25um', 'S1'),
('l_F60um', 'S1'), ('F60um', float), ('e_F60um', float), ('n_F60um', int), ('f_F60um', 'S1'),
('l_F100um', 'S1'), ('F100um', float), ('e_F100um', float), ('n_F100um', int), ('f_F100um', 'S1') ]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `cig`, `l_F12um`, `F12um`, `e_F12um`, `n_F12um`, `f_F12um`, `l_F25um`, `F25um`, `e_F25um`, `n_F25um`, `f_F25um`, `l_F60um`, `F60um`, `e_F60um`, `n_F60um`, `f_F60um`, `l_F100um`, `F100um`, `e_F100um`, `n_F100um`, `f_F100um` FROM `TABLE2`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, -1, 0.0001, 0.0001, 0, -1,
-1, 0.0001, 0.0001, 0, -1,
-1, 0.0001, 0.0001, 0, -1,
-1, 0.0001, 0.0001, 0, -1])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in FIR_LISENFELD07 (table 2)')
@unittest.skip("skipped to avoid overload")
def test_FIR_LISENFELD07_table3(self):
'''
It compares table 3 in the paper of FIR_LISENFELD07 with table in the database (PAPERS_FIR_LISENFELD07.TABLE3)
Fields in PAPERS_FIR_LISENFELD07.TABLE3: `cig`, `Dist`, `l_logLFIR`, `logLFIR`, `logLB`
Fields in CDS table using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/462/507:
`CIG`, `Dist`, `l_logLFIR`, `logLFIR`, `logLB`, CIG_data, Simbad, NED, _RA, _DE
Therefore: , CIG_data, Simbad, NED, _RA, _DE columns are not checked
'''
print "Test PAPERS_FIR_LISENFELD07.Table3\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_FIR_LISENFELD07", self.user, self.password)
cdsnames = ['CIG', 'Dist', 'l_logLFIR', 'logLFIR', 'logLB']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/462/507/table3&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[ ('cig', int), ('Dist', float), ('l_logLFIR', 'S1'), ('logLFIR', float),
('logLB', float)]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `cig`, `Dist`, `l_logLFIR`, `logLFIR`, `logLB` FROM `TABLE3`"
self.diff.getTableFromDB(query, dtypes)
tolerance = numpy.array([0, 0.01, -1, 0.001, 0.001])
self.assertTrue( self.diff.compareTables(dbnames, cdsnames, tolerance), 'There is a mismatch in FIR_LISENFELD07 (table 3)')
#SULENTIC 2006
#SULENTIC2006.TABLE1 is in CDS but not in the DB
@unittest.skip("skipped to avoid overload")
def test_SULENTIC2006_table3(self):
'''
It compares table 3 in the paper of Sulentic 2006 with table 3 in the database (PAPERS_MORPHO_SULENTIC06.TABLE3).
Fields in PAPERS_MORPHO_SULENTIC06.TABLE3: 'CIG', 'T', 'u_T', 'Bar', 'I/A'
Fields in CDS table (table 3) using this url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=J/A+A/449/937:
More, CIG, T, u_T, Bar, I/A, CIG_data, Simbad, NED, _RA, _DE
Therefore, More, CIG_data, Simbad, NED, _RA, _DE are not checked.
'''
print "SULENTIC2006.TABLE1 is in CDS but not in the DB.\n"
print "Test SULENTIC2006.Table3\n"
print " - More, CIG_data, Simbad, NED, _RA, _DE are not checked\n"
self.diff = diff_DB_CDS("amiga.iaa.es", "PAPERS_MORPHO_SULENTIC06", self.user, self.password)
cdsnames = ['CIG', 'T', 'u_T', 'Bar', 'I/A']
url="http://vizier.u-strasbg.fr/viz-bin/votable?-source=J/A%2bA/449/937/table3&-out.max=unlimited"
self.diff.getTableFromCDS(url)
dtypes=[('CIG',int), ('T', int), ('u_T', 'S1'), ('Bar', 'S1'), ('I/A', 'S1')]
dbnames =[pair[0] for pair in dtypes]
query = "SELECT `CIG`, `T`, `u_T`, `Bar`, `I/A` FROM `TABLE3`"
self.diff.getTableFromDB(query, dtypes)