-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfc_output.c
776 lines (662 loc) · 23.9 KB
/
fc_output.c
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
// HDS OPE file Editor
// fc_output.c : Output CSV for Finding Chart List
// 2010.3.15 A.Tajitsu
#include"main.h"
void fcdb_out_simbad(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"SIMBAD MAIN_ID\", \"RA (deg)\", \"Dec (deg)\", \"Sp type\", \"Obj type\", \"mag_U\", \"mag_B\", \"mag_V\", \"mag_R\", \"mag_I\", \"mag_J\", \"mag_H\", \"mag_K\", \"PM_RA (mas/yr)\", \"PM_Dec (mas/yr)\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, \"%s\", \"%s\", %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.6lf, %.6lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].sp,
hg->fcdb[i_list].otype,
hg->fcdb[i_list].u,
hg->fcdb[i_list].b,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].i,
hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
hg->fcdb[i_list].k,
hg->fcdb[i_list].pmra,
hg->fcdb[i_list].pmdec,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_ned(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Name\", \"RA (deg)\", \"Dec (deg)\", \"Obj type\", \"Velocity\", \"Redshift\", \"Mag & Filter\", \"References\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, \"%s\", %.2lf, %.6lf, \"%s\", %d, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].otype,
hg->fcdb[i_list].nedvel,
hg->fcdb[i_list].nedz,
hg->fcdb[i_list].nedmag,
hg->fcdb[i_list].ref,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_gsc(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"HST ID\", \"RA (deg)\", \"Dec (deg)\", \"mag_U\", \"mag_B\", \"mag_V\", \"mag_R\", \"mag_I\", \"mag_J\", \"mag_H\", \"mag_K\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].u,
hg->fcdb[i_list].b,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].i,
hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
hg->fcdb[i_list].k,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_ps1(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Name\", \"RA mean (deg)\", \"Dec mean (deg)\", \"nDetections\", \"mag_g\", \"mag_r\", \"mag_i\", \"mag_z\", \"mag_y\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %d, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].ref,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].i,
hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_sdss(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object ID\", \"RA (deg)\", \"Dec (deg)\", \"mag_u\", \"mag_g\", \"mag_r\", \"mag_i\", \"mag_z\", \"class\", \"Redshift\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, \"%s\", %.6lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].u,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].i,
hg->fcdb[i_list].j,
hg->fcdb[i_list].otype,
hg->fcdb[i_list].nedz,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_usno(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"USNO ID\", \"RA (deg)\", \"Dec (deg)\", \"mag_B1\", \"mag_R1\", \"mag_B2\", \"mag_R2\", \"mag_I2\", \"PM_RA (mas/yr)\", \"PM_Dec (mas/yr)\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.6lf, %.6lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].i,
hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
hg->fcdb[i_list].pmra,
hg->fcdb[i_list].pmdec,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_ucac(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"UCAC4 ID\", \"RA (deg)\", \"Dec (deg)\", \"mag_B\", \"mag_g\", \"mag_V\", \"mag_r\", \"mag_i\", \"mag_J\", \"mag_H\", \"mag_K\", \"PM_RA (mas/yr)\", \"PM_Dec (mas/yr)\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.6lf, %.6lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].b,
hg->fcdb[i_list].u,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].i,
hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
hg->fcdb[i_list].k,
hg->fcdb[i_list].pmra,
hg->fcdb[i_list].pmdec,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_gaia(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Source\", \"RA (deg)\", \"Dec (deg)\", \"G mag\", \"RP mag\", \"BP mag\", \"AG\", \"Parallax\", \"D (kpc)\", \"PM_RA (mas/yr)\", \"PM_Dec (mas/yr)\", \"HRV (km/s)\", \"Teff (K)\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.2lf, %.6lf, %.4lf, %.6lf, %.6lf, %.1lf, %.0lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].b,
hg->fcdb[i_list].j,
hg->fcdb[i_list].plx,
hg->fcdb[i_list].h,
hg->fcdb[i_list].pmra,
hg->fcdb[i_list].pmdec,
hg->fcdb[i_list].i,
hg->fcdb[i_list].u,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_kepler(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"KIC\", \"RA (deg)\", \"Dec (deg)\", \"Kep mag\", \"r mag\", \"J mag\", \"Teff (K)\", \"log g\", \"[Fe/H]\", \"E(B-V)\", \"Radius\", \"PM (arcsec/yr)\", \"g-r\", \"2MASS ID\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"%s, %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.0lf, %.3lf, %.3lf, %.3lf, %.3lf, %.3lf, %.3lf, %s, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].j,
hg->fcdb[i_list].u,
hg->fcdb[i_list].h,
hg->fcdb[i_list].b,
hg->fcdb[i_list].k,
hg->fcdb[i_list].i,
hg->fcdb[i_list].plx,
hg->fcdb[i_list].eplx,
hg->fcdb[i_list].otype,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_2mass(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Designation\", \"RA (deg)\", \"Dec (deg)\", \"mag_J\", \"mag_H\", \"mag_K\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
hg->fcdb[i_list].k,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_wise(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"WISE\", \"RA (deg)\", \"Dec (deg)\", \"mag_J\", \"mag_H\", \"mag_K\", \"mag_W1 (3.4um)\", \"mag_W2 (4.6um)\", \"mag_W3 (12um)\", \"mag_W4 (22um)\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
hg->fcdb[i_list].k,
hg->fcdb[i_list].u,
hg->fcdb[i_list].b,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_irc(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Name\", \"RA (deg)\", \"Dec (deg)\", \"S9W\", \"Q(S9W)\", \"L18W\", \"Q(L18W)\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %d, %.2lf, %d, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].u,
(gint)hg->fcdb[i_list].b,
hg->fcdb[i_list].v,
(gint)hg->fcdb[i_list].r,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_fis(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Name\", \"RA (deg)\", \"Dec (deg)\", \"N60\", \"Q(N60)\", \"WIDE-S\", \"Q(WIDE-S)\", \"WIDE-L\", \"Q(WIDE-L)\", \"N160\", \"Q(N160)\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %.2lf, %d, %.2lf, %d, %.2lf, %d, %.2lf, %d, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].u,
(gint)hg->fcdb[i_list].b,
hg->fcdb[i_list].v,
(gint)hg->fcdb[i_list].r,
hg->fcdb[i_list].i,
(gint)hg->fcdb[i_list].j,
hg->fcdb[i_list].h,
(gint)hg->fcdb[i_list].k,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_lamost(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Designation\", \"RA (deg)\", \"Dec (deg)\", \"T_eff\", \"log g\", \"[Fe/H]\", \"V_helio\", \"Class\", \"SubClass\", \"Obs. ID\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", %.5lf, %.5lf, %d, %.2lf, %+.2lf, %.1lf, \"%s\", \"%s\", %d, %.5lf\n",
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
(gint)hg->fcdb[i_list].u,
hg->fcdb[i_list].b,
hg->fcdb[i_list].v,
hg->fcdb[i_list].r,
hg->fcdb[i_list].otype,
hg->fcdb[i_list].sp,
hg->fcdb[i_list].ref,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_smoka(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Frame ID\", \"Date Obs.\", \"Obs. Mode\", \"Data Type\", \"Object\", \"Filter\", \"Wavelength\", \"RA (deg)\", \"Dec (deg)\", \"Exptime\", \"Observer\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", %.5lf, %.5lf, %.2lf, \"%s\", %.5lf\n",
hg->fcdb[i_list].fid,
hg->fcdb[i_list].date,
hg->fcdb[i_list].mode,
hg->fcdb[i_list].type,
hg->fcdb[i_list].name,
hg->fcdb[i_list].fil,
hg->fcdb[i_list].wv,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].u,
hg->fcdb[i_list].obs,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_hst(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Dataset\", \"Taget Name\", \"RA (deg)\", \"Dec (deg)\", \"Start Time\", \"Exptime\", \"Instrument\", \"Filters/Gratings\", \"Central Wavelength\", \"Proposal ID\", \"Apertures\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", \"%s\", %.5lf, %.5lf, \"%s\", %.2lf, \"%s\", \"%s\", %.1lf, \"%s\", \"%s\", %.5lf\n",
hg->fcdb[i_list].fid,
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].date,
hg->fcdb[i_list].u,
hg->fcdb[i_list].mode,
hg->fcdb[i_list].fil,
hg->fcdb[i_list].v,
hg->fcdb[i_list].obs,
hg->fcdb[i_list].type,
hg->fcdb[i_list].sep*60.);
}
}
void fcdb_out_eso(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Dataset\", \"Object\", \"RA (deg)\", \"Dec (deg)\", \"Exptime\", \"Instrument\", \"Mode\", \"Prog. ID\", \"Release Date\", \"Dist. (arcmin)\"\n");
for(i_list=0;i_list<hg->fcdb_i_max;i_list++){
fprintf(fp,"\"%s\", \"%s\", %.5lf, %.5lf, %.2lf, \"%s\", \"%s\", \"%s\", \"%s\", %.5lf\n",
hg->fcdb[i_list].fid,
hg->fcdb[i_list].name,
hg->fcdb[i_list].d_ra,
hg->fcdb[i_list].d_dec,
hg->fcdb[i_list].u,
hg->fcdb[i_list].mode,
hg->fcdb[i_list].type,
hg->fcdb[i_list].obs,
hg->fcdb[i_list].date,
hg->fcdb[i_list].sep*60.);
}
}
void Export_FCDB_CSV(typHOE *hg){
FILE *fp;
if(hg->fcdb_i_max<=0) return;
if((fp=fopen(hg->filename_fcdb,"w"))==NULL){
fprintf(stderr," File Write Error \"%s\" \n", hg->filename_fcdb);
exit(1);
}
switch(hg->fcdb_type){
case FCDB_TYPE_SIMBAD:
fcdb_out_simbad(hg, fp);
break;
case FCDB_TYPE_NED:
fcdb_out_ned(hg, fp);
break;
case FCDB_TYPE_GSC:
fcdb_out_gsc(hg, fp);
break;
case FCDB_TYPE_PS1:
fcdb_out_ps1(hg, fp);
break;
case FCDB_TYPE_SDSS:
fcdb_out_sdss(hg, fp);
break;
case FCDB_TYPE_LAMOST:
fcdb_out_lamost(hg, fp);
break;
case FCDB_TYPE_USNO:
fcdb_out_usno(hg, fp);
break;
case FCDB_TYPE_UCAC:
fcdb_out_ucac(hg, fp);
break;
case FCDB_TYPE_GAIA:
fcdb_out_gaia(hg, fp);
break;
case FCDB_TYPE_KEPLER:
fcdb_out_kepler(hg, fp);
break;
case FCDB_TYPE_2MASS:
fcdb_out_2mass(hg, fp);
break;
case FCDB_TYPE_WISE:
fcdb_out_wise(hg, fp);
break;
case FCDB_TYPE_IRC:
fcdb_out_irc(hg, fp);
break;
case FCDB_TYPE_FIS:
fcdb_out_fis(hg, fp);
break;
case FCDB_TYPE_SMOKA:
fcdb_out_smoka(hg, fp);
break;
case FCDB_TYPE_HST:
fcdb_out_hst(hg, fp);
break;
case FCDB_TYPE_ESO:
fcdb_out_eso(hg, fp);
break;
}
fclose(fp);
}
void trdb_out(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Data\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
if(hg->obj[i_list].trdb_band_max>0){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", \"%s\"\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].trdb_str);
}
else{
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\"\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--");
}
}
}
void magdb_out_simbad(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"Simbad Name\", \"Object Type\", \"Spectral Type\", \"U\", \"B\", \"V\", \"R\", \"I\", \"J\", \"H\", \"K\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, \"%s\", \"%s\", \"%s\", %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_simbad_hits,
hg->obj[i_list].magdb_simbad_sep*3600,
(hg->obj[i_list].magdb_simbad_name)?
(hg->obj[i_list].magdb_simbad_name) : "---",
(hg->obj[i_list].magdb_simbad_type)?
(hg->obj[i_list].magdb_simbad_type) : "---",
(hg->obj[i_list].magdb_simbad_sp)?
(hg->obj[i_list].magdb_simbad_sp) : "---",
hg->obj[i_list].magdb_simbad_u,
hg->obj[i_list].magdb_simbad_b,
hg->obj[i_list].magdb_simbad_v,
hg->obj[i_list].magdb_simbad_r,
hg->obj[i_list].magdb_simbad_i,
hg->obj[i_list].magdb_simbad_j,
hg->obj[i_list].magdb_simbad_h,
hg->obj[i_list].magdb_simbad_k);
}
}
void magdb_out_ned(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"NED Name\", \"Object Type\", \"Mag.\", \"z\", \"ref#\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, \"%s\", \"%s\", \"%s\", %.6lf, %d\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_ned_hits,
hg->obj[i_list].magdb_ned_sep*3600,
(hg->obj[i_list].magdb_ned_name)?
(hg->obj[i_list].magdb_ned_name) : "---",
(hg->obj[i_list].magdb_ned_type)?
(hg->obj[i_list].magdb_ned_type) : "---",
(hg->obj[i_list].magdb_ned_mag)?
(hg->obj[i_list].magdb_ned_mag) : "---",
hg->obj[i_list].magdb_ned_z,
hg->obj[i_list].magdb_ned_ref);
}
}
void magdb_out_lamost(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"LAMOST Name\", \"Obs ID\", \"Teff\", \"log g\", \"[Fe/H]\", \"HRV\", \"Type\", \"Sp.\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, \"%s\", %d, %.0lf, %.2lf, %+.2lf, %+.1lf, \"%s\", \"%s\"\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_lamost_hits,
hg->obj[i_list].magdb_lamost_sep*3600,
(hg->obj[i_list].magdb_lamost_name)?
(hg->obj[i_list].magdb_lamost_name) : "---",
hg->obj[i_list].magdb_lamost_ref,
hg->obj[i_list].magdb_lamost_teff,
hg->obj[i_list].magdb_lamost_logg,
hg->obj[i_list].magdb_lamost_feh,
hg->obj[i_list].magdb_lamost_hrv,
(hg->obj[i_list].magdb_lamost_type)?
(hg->obj[i_list].magdb_lamost_type) : "---",
(hg->obj[i_list].magdb_lamost_sp)?
(hg->obj[i_list].magdb_lamost_sp) : "---");
}
}
void magdb_out_gsc(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"U\", \"B\", \"V\", \"R\", \"I\", \"J\", \"H\", \"K\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_gsc_hits,
hg->obj[i_list].magdb_gsc_sep*3600,
hg->obj[i_list].magdb_gsc_u,
hg->obj[i_list].magdb_gsc_b,
hg->obj[i_list].magdb_gsc_v,
hg->obj[i_list].magdb_gsc_r,
hg->obj[i_list].magdb_gsc_i,
hg->obj[i_list].magdb_gsc_j,
hg->obj[i_list].magdb_gsc_h,
hg->obj[i_list].magdb_gsc_k);
}
}
void magdb_out_ucac(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"B\", \"g\", \"V\", \"r\", \"i\", \"J\", \"H\", \"K\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_ucac_hits,
hg->obj[i_list].magdb_ucac_sep*3600,
hg->obj[i_list].magdb_ucac_b,
hg->obj[i_list].magdb_ucac_g,
hg->obj[i_list].magdb_ucac_v,
hg->obj[i_list].magdb_ucac_r,
hg->obj[i_list].magdb_ucac_i,
hg->obj[i_list].magdb_ucac_j,
hg->obj[i_list].magdb_ucac_h,
hg->obj[i_list].magdb_ucac_k);
}
}
void magdb_out_ps1(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"g\", \"r\", \"i\", \"z\", \"y\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_ps1_hits,
hg->obj[i_list].magdb_ps1_sep*3600,
hg->obj[i_list].magdb_ps1_g,
hg->obj[i_list].magdb_ps1_r,
hg->obj[i_list].magdb_ps1_i,
hg->obj[i_list].magdb_ps1_z,
hg->obj[i_list].magdb_ps1_y);
}
}
void magdb_out_sdss(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"u\", \"g\", \"r\", \"i\", \"z\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, %.2lf, %.2lf, %.2lf, %.2lf, %.2lf\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_sdss_hits,
hg->obj[i_list].magdb_sdss_sep*3600,
hg->obj[i_list].magdb_sdss_u,
hg->obj[i_list].magdb_sdss_g,
hg->obj[i_list].magdb_sdss_r,
hg->obj[i_list].magdb_sdss_i,
hg->obj[i_list].magdb_sdss_z);
}
}
void magdb_out_gaia(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"G\", \"RP\", \"BP\", \"AG\", \"E(BP-RP)\", \"Parallax\", \"e_Parallax\", \"Distance\", \"HRV\", \"Teff\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, %.2lf, %.2lf, %.2lf, %.2lf, %.4lf, %.4lf, %.4lf, %.4lf, %.1lf, %.0lf\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_gaia_hits,
hg->obj[i_list].magdb_gaia_sep*3600,
hg->obj[i_list].magdb_gaia_g,
hg->obj[i_list].magdb_gaia_rp,
hg->obj[i_list].magdb_gaia_bp,
hg->obj[i_list].magdb_gaia_ag,
hg->obj[i_list].magdb_gaia_ebr,
hg->obj[i_list].magdb_gaia_p,
hg->obj[i_list].magdb_gaia_ep,
hg->obj[i_list].magdb_gaia_dist,
hg->obj[i_list].magdb_gaia_rv,
hg->obj[i_list].magdb_gaia_teff);
}
}
void magdb_out_kepler(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"KIC\", \"Kepler mag\", \"r mag\", \"J mag\", \"Teff\", \"log g\", \"[Fe/H]\", \"E(B-V)\", \"Radius\", \"PM (aarcsec/yr)\", \"g-r\", \"2MASS ID\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, %s, %.3lf, %.3lf, %.3lf, %.0lf, %.3lf, %+.3lf, %.3lf, %.3lf, %.3lf, %.3lf, %s\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_kepler_hits,
hg->obj[i_list].magdb_kepler_sep*3600,
hg->obj[i_list].magdb_kepler_name,
hg->obj[i_list].magdb_kepler_k,
hg->obj[i_list].magdb_kepler_r,
hg->obj[i_list].magdb_kepler_j,
hg->obj[i_list].magdb_kepler_teff,
hg->obj[i_list].magdb_kepler_logg,
hg->obj[i_list].magdb_kepler_feh,
hg->obj[i_list].magdb_kepler_ebv,
hg->obj[i_list].magdb_kepler_rad,
hg->obj[i_list].magdb_kepler_pm,
hg->obj[i_list].magdb_kepler_gr,
hg->obj[i_list].magdb_kepler_2mass);
}
}
void magdb_out_2mass(typHOE *hg, FILE *fp){
int i_list;
fprintf(fp, "\"Object\", \"RA\", \"Dec\", \"Note\", \"Hits\", \"Sep.\", \"J\", \"H\", \"K\"\n");
for(i_list=0;i_list<hg->i_max;i_list++){
fprintf(fp,"\"%s\", \"%09.2lf\", \"%+010.2lf\", \"%s\", %d, %.1lf, %.2lf, %.2lf, %.2lf\n",
hg->obj[i_list].name,
hg->obj[i_list].ra,
hg->obj[i_list].dec,
(hg->obj[i_list].note) ? (hg->obj[i_list].note) : "--",
hg->obj[i_list].magdb_2mass_hits,
hg->obj[i_list].magdb_2mass_sep*3600,
hg->obj[i_list].magdb_2mass_j,
hg->obj[i_list].magdb_2mass_h,
hg->obj[i_list].magdb_2mass_k);
}
}
void Export_TRDB_CSV(typHOE *hg){
FILE *fp;
if(hg->i_max<=0) return;
if((fp=fopen(hg->filename_trdb,"w"))==NULL){
fprintf(stderr," File Write Error \"%s\" \n", hg->filename_trdb);
exit(1);
}
switch(hg->trdb_used){
case TRDB_TYPE_SMOKA:
case TRDB_TYPE_HST:
case TRDB_TYPE_ESO:
case TRDB_TYPE_GEMINI:
trdb_out(hg, fp);
break;
case MAGDB_TYPE_SIMBAD:
magdb_out_simbad(hg, fp);
break;
case MAGDB_TYPE_NED:
magdb_out_ned(hg, fp);
break;
case MAGDB_TYPE_LAMOST:
magdb_out_lamost(hg, fp);
break;
case MAGDB_TYPE_GSC:
magdb_out_gsc(hg, fp);
break;
case MAGDB_TYPE_UCAC:
magdb_out_ucac(hg, fp);
break;
case MAGDB_TYPE_PS1:
magdb_out_ps1(hg, fp);
break;
case MAGDB_TYPE_SDSS:
magdb_out_sdss(hg, fp);
break;
case MAGDB_TYPE_GAIA:
magdb_out_gaia(hg, fp);
break;
case MAGDB_TYPE_KEPLER:
magdb_out_kepler(hg, fp);
break;
case MAGDB_TYPE_2MASS:
magdb_out_2mass(hg, fp);
break;
}
fclose(fp);
}