00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032
00033
00034
00035
00036 #define visir_pfits_get_double(KEY) irplib_pfits_get_double(self, KEY)
00037 #define visir_pfits_get_int(KEY) irplib_pfits_get_int(self, KEY)
00038 #define visir_pfits_get_string(KEY) irplib_pfits_get_string(self, KEY)
00039
00040
00041
00042
00043
00044
00045 #include <string.h>
00046 #include <assert.h>
00047 #include <math.h>
00048 #include <cpl.h>
00049
00050 #include "irplib_pfits.h"
00051
00052 #include "visir_utils.h"
00053 #include "visir_pfits.h"
00054
00055
00056
00057
00058
00059
00060 static const char * visir_pfits_get_slitname(const cpl_propertylist *);
00061 static double visir_pfits_get_slitwidth_raw(const cpl_propertylist *);
00062
00063
00068
00069
00072
00073
00074
00075
00076
00082
00083 double visir_pfits_get_airmass_start(const cpl_propertylist * self)
00084 {
00085 return visir_pfits_get_double("ESO TEL AIRM START");
00086 }
00087
00088
00094
00095 double visir_pfits_get_airmass_end(const cpl_propertylist * self)
00096 {
00097 return visir_pfits_get_double("ESO TEL AIRM END");
00098 }
00099
00100
00106
00107 double visir_pfits_get_alpha(const cpl_propertylist * self)
00108 {
00109 return visir_pfits_get_double("ESO TEL TARG OFFSETALPHA");
00110 }
00111
00112
00118
00119 const char * visir_pfits_get_arcfile(const cpl_propertylist * self)
00120 {
00121 return visir_pfits_get_string("ARCFILE");
00122 }
00123
00124
00130
00131 const char * visir_pfits_get_chopnod_dir(const cpl_propertylist * self)
00132 {
00133 return visir_pfits_get_string("ESO SEQ CHOPNOD DIR");
00134 }
00135
00136
00137
00143
00144 double visir_pfits_get_chop_throw(const cpl_propertylist * self)
00145 {
00146 return visir_pfits_get_double(VISIR_PFITS_DOUBLE_CHOP_THROW);
00147 }
00148
00149
00150
00156
00157 int visir_pfits_get_chop_ncycles(const cpl_propertylist * self)
00158 {
00159 return visir_pfits_get_int("ESO DET CHOP NCYCLES");
00160 }
00161
00162
00168
00169 double visir_pfits_get_cumoffsetx(const cpl_propertylist * self)
00170 {
00171 return visir_pfits_get_double("ESO SEQ CUMOFFSETX");
00172 }
00173
00174
00180
00181 double visir_pfits_get_cumoffsety(const cpl_propertylist * self)
00182 {
00183 return visir_pfits_get_double("ESO SEQ CUMOFFSETY");
00184 }
00185
00186
00192
00193 const char * visir_pfits_get_date_obs(const cpl_propertylist * self)
00194 {
00195 return visir_pfits_get_string("DATE-OBS");
00196 }
00197
00198
00204
00205 double visir_pfits_get_delta(const cpl_propertylist * self)
00206 {
00207 return visir_pfits_get_double("ESO TEL TARG OFFSETDELTA");
00208 }
00209
00210
00216
00217 double visir_pfits_get_dec(const cpl_propertylist * self)
00218 {
00219 return visir_pfits_get_double("DEC");
00220 }
00221
00222
00228
00229 double visir_pfits_get_dit(const cpl_propertylist * self)
00230 {
00231 return visir_pfits_get_double("ESO DET DIT");
00232 }
00233
00234
00240
00241 int visir_pfits_get_expno(const cpl_propertylist * self)
00242 {
00243 return visir_pfits_get_int("ESO TPL EXPNO");
00244 }
00245
00246
00252
00253 const char * visir_pfits_get_filter(const cpl_propertylist * self)
00254 {
00255
00256
00257 const char * val = visir_pfits_get_insmode(self);
00258
00259
00260 if (val == NULL) return NULL ;
00261
00262
00263 if (!strcmp(val, "IMG" ))
00264 return visir_pfits_get_string("ESO INS FILT1 NAME");
00265
00266 if (!strcmp(val, "SPC" ))
00267 return visir_pfits_get_string("ESO INS FILT2 NAME");
00268
00269 if (!strcmp(val, "SPCIMG"))
00270 return visir_pfits_get_string("ESO INS FILT2 NAME");
00271
00272 cpl_ensure(0, CPL_ERROR_UNSUPPORTED_MODE, NULL);
00273
00274 }
00275
00276
00282
00283 double visir_pfits_get_focus(const cpl_propertylist * self)
00284 {
00285 return visir_pfits_get_double("ESO TEL FOCU LEN");
00286 }
00287
00288
00294
00295 double visir_pfits_get_exptime(const cpl_propertylist * self)
00296 {
00297 return visir_pfits_get_double("EXPTIME");
00298 }
00299
00300
00306
00307 const char * visir_pfits_get_frame_type(const cpl_propertylist * self)
00308 {
00309 return visir_pfits_get_string("ESO DET FRAM TYPE");
00310 }
00311
00312
00318
00319 const char * visir_pfits_get_grat1_name(const cpl_propertylist * self)
00320 {
00321 return visir_pfits_get_string("ESO INS GRAT1 NAME");
00322 }
00323
00324
00330
00331 const char * visir_pfits_get_insmode(const cpl_propertylist * self)
00332 {
00333 return visir_pfits_get_string("ESO INS MODE");
00334 }
00335
00336
00342
00343 const char * visir_pfits_get_instrument(const cpl_propertylist * self)
00344 {
00345 return visir_pfits_get_string("INSTRUME");
00346 }
00347
00348
00354
00355 double visir_pfits_get_mjdobs(const cpl_propertylist * self)
00356 {
00357 return visir_pfits_get_double("MJD-OBS");
00358 }
00359
00360
00366
00367 const char * visir_pfits_get_mode(const cpl_propertylist * self)
00368 {
00369 return visir_pfits_get_string("ESO DET MODE NAME");
00370 }
00371
00372
00378
00379 double visir_pfits_get_monoc_pos(const cpl_propertylist * self)
00380 {
00381 return visir_pfits_get_double("ESO INS MONOC1 POS");
00382 }
00383
00384
00390
00391 int visir_pfits_get_ndit(const cpl_propertylist * self)
00392 {
00393 return visir_pfits_get_int("ESO DET NDIT");
00394 }
00395
00396
00402
00403 int visir_pfits_get_naxis3(const cpl_propertylist * self)
00404 {
00405 return visir_pfits_get_int("NAXIS3");
00406 }
00407
00408
00414
00415 int visir_pfits_get_numbexp(const cpl_propertylist * self)
00416 {
00417 return visir_pfits_get_int("ESO TPL NEXP");
00418 }
00419
00420
00426
00427 int visir_pfits_get_obs_id(const cpl_propertylist * self)
00428 {
00429 return visir_pfits_get_int("ESO OBS ID");
00430 }
00431
00432
00438
00439 const char * visir_pfits_get_nodpos(const cpl_propertylist * self)
00440 {
00441 return visir_pfits_get_string("ESO SEQ NODPOS");
00442 }
00443
00444
00450
00451 const char * visir_pfits_get_pixscale(const cpl_propertylist * self)
00452 {
00453 return visir_pfits_get_string("ESO INS PFOV");
00454 }
00455
00456
00462
00463 double visir_pfits_get_pixspace(const cpl_propertylist * self)
00464 {
00465 return visir_pfits_get_double("ESO DET CHIP PXSPACE");
00466 }
00467
00468
00474
00475 double visir_pfits_get_ra(const cpl_propertylist * self)
00476 {
00477 return visir_pfits_get_double("RA");
00478 }
00479
00480
00486
00487 double visir_pfits_get_slitwidth(const cpl_propertylist * self)
00488 {
00489 const char * slitname = visir_pfits_get_slitname(self);
00490 double slitwidth = visir_pfits_get_slitwidth_raw(self);
00491
00492
00493 if (!cpl_error_get_code()) {
00494
00495 static const char * slit_name[] = {"CU_0.12", "CU_0.14", "CU_0.16",
00496 "CU_0.20", "CU_0.25", "CU_0.30",
00497 "CU_0.40", "CU_0.50", "CU_0.60",
00498 "CU_0.70", "CU_0.80", "CU_1.00",
00499 "CU_1.20", "CU_1.60", "ST_0.14",
00500 "ST_0.16", "ST_0.20", "ST_0.30",
00501 "ST_0.40", "ST_0.50", "ST_0.60"};
00502
00503 static double slit_width[] = {0.12, 0.14, 0.16,
00504 0.20, 0.25, 0.30,
00505 0.40, 0.50, 0.60,
00506 0.70, 0.80, 1.00,
00507 1.20, 1.60, 0.14,
00508 0.16, 0.20, 0.30,
00509 0.40, 0.50, 0.60};
00510
00511 static const int slit_nums = (int)(sizeof(slit_width)/sizeof(double));
00512
00513 int i;
00514
00515 for (i=0; i < slit_nums; i++)
00516 if (strstr(slitname, slit_name[i])) break;
00517
00518 if (i < slit_nums && fabs(slit_width[i] - slitwidth) < 0.001) {
00519
00520
00521
00522
00523
00524 cpl_msg_warning(cpl_func,"The Width of slit %s is written in the "
00525 "FITS card in units mm. Converting to ArcSecs: "
00526 "%g => %g", slitname, slitwidth, slitwidth * 2.5);
00527 slitwidth *= 2.5;
00528 }
00529 }
00530
00531 return slitwidth;
00532 }
00533
00534
00540
00541 const char * visir_pfits_get_starname(const cpl_propertylist * self)
00542 {
00543 return visir_pfits_get_string("ESO OBS TARG NAME");
00544 }
00545
00546
00552
00553 const char * visir_pfits_get_resol(const cpl_propertylist * self)
00554 {
00555 return visir_pfits_get_string("ESO INS RESOL");
00556 }
00557
00558
00564
00565 double visir_pfits_get_temp(const cpl_propertylist * self)
00566 {
00567 return visir_pfits_get_double("ESO TEL TH M1 TEMP");
00568 }
00569
00570
00576
00577 double visir_pfits_get_volt1dcta9(const cpl_propertylist * self)
00578 {
00579 return visir_pfits_get_double("ESO DET VOLT1 DCTA9");
00580 }
00581
00582
00588
00589 double visir_pfits_get_volt1dctb9(const cpl_propertylist * self)
00590 {
00591 return visir_pfits_get_double("ESO DET VOLT1 DCTB9");
00592 }
00593
00594
00600
00601 double visir_pfits_get_volt2dcta9(const cpl_propertylist * self)
00602 {
00603 return visir_pfits_get_double("ESO DET VOLT2 DCTA9");
00604 }
00605
00606
00612
00613 double visir_pfits_get_volt2dctb9(const cpl_propertylist * self)
00614 {
00615 return visir_pfits_get_double("ESO DET VOLT2 DCTB9");
00616 }
00617
00618
00624
00625 double visir_pfits_get_wlen(const cpl_propertylist * self)
00626 {
00627 return visir_pfits_get_double("ESO INS GRAT1 WLEN");
00628 }
00629
00632
00639
00640 static double visir_pfits_get_slitwidth_raw(const cpl_propertylist * self)
00641 {
00642 return visir_pfits_get_double("ESO INS SLIT1 WID");
00643 }
00644
00645
00651
00652 static const char * visir_pfits_get_slitname(const cpl_propertylist * self)
00653 {
00654 return visir_pfits_get_string("ESO INS SLIT1 NAME");
00655 }