36#define visir_pfits_get_int(KEY) irplib_pfits_get_int(self, KEY)
37#define visir_pfits_get_string(KEY) irplib_pfits_get_string(self, KEY)
49#include "irplib_pfits.h"
51#include "visir_utils.h"
52#include "visir_pfits.h"
59static const char * visir_pfits_get_slitname(
const cpl_propertylist *);
60static double visir_pfits_get_slitwidth_raw(
const cpl_propertylist *);
77visir_pfits_get_double(
const cpl_propertylist * self,
const char *key) {
78 if (cpl_propertylist_get_type(self, key) == CPL_TYPE_INT) {
79 return irplib_pfits_get_int(self, key);
81 return irplib_pfits_get_double(self, key);
93 return visir_pfits_get_double(self,
"ESO TEL AIRM START");
105 return visir_pfits_get_double(self,
"ESO TEL AIRM END");
117 return visir_pfits_get_double(self,
"ESO TEL TARG OFFSETALPHA");
129 return visir_pfits_get_string(
"ARCFILE");
141 return visir_pfits_get_string(VISIR_PFITS_STRING_CHOPNOD_DIR);
154 if (cpl_propertylist_has(self, VISIR_PFITS_DOUBLE_CHOP_THROW)) {
155 return visir_pfits_get_double(self, VISIR_PFITS_DOUBLE_CHOP_THROW);
158 return visir_pfits_get_double(self,
"ESO DET CHOP THROW");
172 if (cpl_propertylist_has(self, VISIR_PFITS_DOUBLE_CHOP_FREQ)) {
173 return visir_pfits_get_double(self, VISIR_PFITS_DOUBLE_CHOP_FREQ);
176 return visir_pfits_get_double(self,
"ESO DET CHOP FREQ");
189 if (cpl_propertylist_has(self, VISIR_PFITS_BOOL_CHOP_STATUS)) {
190 return cpl_propertylist_get_bool(self, VISIR_PFITS_BOOL_CHOP_STATUS);
193 return cpl_propertylist_get_bool(self,
"ESO DET CHOP ST");
207 if (!cpl_propertylist_has(self, VISIR_PFITS_DOUBLE_CHOP_POSANG)) {
210 return CPL_MATH_RAD_DEG *
211 cpl_propertylist_get_double(self, VISIR_PFITS_DOUBLE_CHOP_POSANG);
226 return pscale > 0.0 ?
throw / pscale : 0.0;
239 return visir_pfits_get_int(
"ESO DET CHOP NCYCLES");
251 if (!cpl_propertylist_has(self, VISIR_PFITS_DOUBLE_ADA_POSANG)) {
254 return CPL_MATH_RAD_DEG *
255 cpl_propertylist_get_double(self, VISIR_PFITS_DOUBLE_ADA_POSANG);
267 return visir_pfits_get_double(self,
"ESO SEQ CUMOFFSETX");
279 return visir_pfits_get_double(self,
"ESO SEQ CUMOFFSETY");
291 return visir_pfits_get_string(
"DATE-OBS");
303 return visir_pfits_get_double(self,
"ESO TEL TARG OFFSETDELTA");
315 return visir_pfits_get_double(self,
"DEC");
327 if (cpl_propertylist_has(self, VISIR_PFITS_DOUBLE_SEQ1_DIT))
328 return visir_pfits_get_double(self, VISIR_PFITS_DOUBLE_SEQ1_DIT);
329 return visir_pfits_get_double(self, VISIR_PFITS_DOUBLE_DIT);
341 if (cpl_propertylist_has(self, VISIR_PFITS_INT_NAVRG))
342 return visir_pfits_get_int(VISIR_PFITS_INT_NAVRG);
355 return visir_pfits_get_int(
"ESO TPL EXPNO");
370 static const char * spec[] = {
380 if (val == NULL)
return NULL ;
383 if (!strcmp(val,
"IMG" ))
384 return visir_pfits_get_string(
"ESO INS FILT1 NAME");
386 if (!strcmp(val,
"SPC" ))
387 return visir_pfits_get_string(
"ESO INS FILT2 NAME");
389 if (!strcmp(val,
"SPCIMG")) {
390 const char * filt = visir_pfits_get_string(
"ESO INS FILT2 NAME");
391 for (
size_t i = 0; i < 6; i++) {
392 if (strncmp(spec[i], filt, strlen(spec[i]) - 5) == 0) {
399 cpl_ensure(0, CPL_ERROR_UNSUPPORTED_MODE, NULL);
412 return visir_pfits_get_double(self,
"ESO TEL FOCU LEN");
424 return visir_pfits_get_double(self,
"EXPTIME");
436 return visir_pfits_get_string(
"ESO DET FRAM TYPE");
449 if (cpl_propertylist_has(self,
"ESO DET NAME")) {
450 return visir_pfits_get_string(
"ESO DET NAME");
464 return visir_pfits_get_string(
"ESO INS GRAT1 NAME");
476 const char * mode = visir_pfits_get_string(
"ESO INS MODE");
477 return mode ? mode :
"(none)";
489 return visir_pfits_get_string(
"INSTRUME");
501 return visir_pfits_get_double(self,
"MJD-OBS");
513 return visir_pfits_get_string(
"ESO DET MODE NAME");
525 return visir_pfits_get_double(self,
"ESO INS MONOC1 POS");
537 return visir_pfits_get_int(
"ESO DET NDIT");
548 if (cpl_propertylist_has(self,
"ZNAXIS1"))
549 return visir_pfits_get_int(
"ZNAXIS1");
551 return visir_pfits_get_int(
"NAXIS1");
563 if (cpl_propertylist_has(self,
"ZNAXIS2"))
564 return visir_pfits_get_int(
"ZNAXIS2");
566 return visir_pfits_get_int(
"NAXIS2");
578 if (cpl_propertylist_has(self,
"ZNAXIS3"))
579 return visir_pfits_get_int(
"ZNAXIS3");
581 return visir_pfits_get_int(
"NAXIS3");
593 if (cpl_propertylist_has(self,
"ESO DET WIN NX")) {;
594 return visir_pfits_get_int(
"ESO DET WIN NX");
596 else if (cpl_propertylist_has(self,
"ESO DET1 WIN NX")) {;
597 return visir_pfits_get_int(
"ESO DET1 WIN NX");
599 else if (cpl_propertylist_has(self,
"ESO DET ACQ1 WIN NX")) {;
600 return visir_pfits_get_int(
"ESO DET ACQ1 WIN NX");
614 if (cpl_propertylist_has(self,
"ESO DET WIN NY")) {;
615 return visir_pfits_get_int(
"ESO DET WIN NY");
617 else if (cpl_propertylist_has(self,
"ESO DET1 WIN NY")) {;
618 return visir_pfits_get_int(
"ESO DET1 WIN NY");
620 else if (cpl_propertylist_has(self,
"ESO DET ACQ1 WIN NY")) {;
621 return visir_pfits_get_int(
"ESO DET ACQ1 WIN NY");
635 if (cpl_propertylist_has(self,
"ESO DET WIN STRX")) {;
636 return visir_pfits_get_int(
"ESO DET WIN STRX");
638 else if (cpl_propertylist_has(self,
"ESO DET1 WIN STRX")) {;
639 return visir_pfits_get_int(
"ESO DET1 WIN STRX");
641 else if (cpl_propertylist_has(self,
"ESO DET ACQ1 WIN STRX")) {;
642 return visir_pfits_get_int(
"ESO DET ACQ1 WIN STRX");
656 if (cpl_propertylist_has(self,
"ESO DET WIN STRY")) {;
657 return visir_pfits_get_int(
"ESO DET WIN STRY");
659 else if (cpl_propertylist_has(self,
"ESO DET1 WIN STRY")) {;
660 return visir_pfits_get_int(
"ESO DET1 WIN STRY");
662 else if (cpl_propertylist_has(self,
"ESO DET ACQ1 WIN STRY")) {;
663 return visir_pfits_get_int(
"ESO DET ACQ1 WIN STRY");
677 return visir_pfits_get_int(
"ESO TPL NEXP");
689 return visir_pfits_get_int(
"ESO OBS ID");
701 return visir_pfits_get_string(
"ESO SEQ NODPOS");
713 const char * sscale = visir_pfits_get_string(VISIR_PFITS_STRING_PIXSCALE);
714 if (sscale && strlen(sscale) > 0)
729 if (cpl_propertylist_has(self,
"ESO DET CHIP1 PXSPACE")) {
730 return visir_pfits_get_double(self,
"ESO DET CHIP1 PXSPACE");
732 return visir_pfits_get_double(self,
"ESO DET CHIP PXSPACE");
744 return visir_pfits_get_double(self,
"RA");
756 const char * slitname = visir_pfits_get_slitname(self);
757 double slitwidth = visir_pfits_get_slitwidth_raw(self);
760 if (!cpl_error_get_code()) {
762 static const char * slit_name[] = {
"CU_0.12",
"CU_0.14",
"CU_0.16",
763 "CU_0.20",
"CU_0.25",
"CU_0.30",
764 "CU_0.40",
"CU_0.50",
"CU_0.60",
765 "CU_0.70",
"CU_0.80",
"CU_1.00",
766 "CU_1.20",
"CU_1.60",
"ST_0.14",
767 "ST_0.16",
"ST_0.20",
"ST_0.30",
768 "ST_0.40",
"ST_0.50",
"ST_0.60"};
770 static double slit_width[] = {0.12, 0.14, 0.16,
778 static const int slit_nums = (int)(
sizeof(slit_width)/
sizeof(double));
782 for (i=0; i < slit_nums; i++)
783 if (strstr(slitname, slit_name[i]))
break;
785 if (i < slit_nums && fabs(slit_width[i] - slitwidth) < 0.001) {
791 cpl_msg_warning(cpl_func,
"The Width of slit %s is written in the "
792 "FITS card in units mm. Converting to ArcSecs: "
793 "%g => %g", slitname, slitwidth, slitwidth * 2.5);
810 return visir_pfits_get_string(
"ESO OBS TARG NAME");
822 if (cpl_propertylist_has(self,
"ESO INS RESOL")) {
823 return visir_pfits_get_string(
"ESO INS RESOL");
837 return visir_pfits_get_double(self,
"ESO TEL TH M1 TEMP");
849 return visir_pfits_get_double(self,
"ESO DET VOLT1 DCTA9");
861 return visir_pfits_get_double(self,
"ESO DET VOLT1 DCTB9");
873 return visir_pfits_get_double(self,
"ESO DET VOLT2 DCTA9");
885 return visir_pfits_get_double(self,
"ESO DET VOLT2 DCTB9");
897 if (cpl_propertylist_has(self, VISIR_PFITS_DOUBLE_PWLEN)) {
898 return visir_pfits_get_double(self, VISIR_PFITS_DOUBLE_PWLEN);
900 return visir_pfits_get_double(self, VISIR_PFITS_DOUBLE_WLEN);
916 if (cpl_propertylist_has(self,
"ESO DRS IMGWGT"))
917 imgwgt = cpl_propertylist_get_float(self,
"ESO DRS IMGWGT");
934 const cpl_boolean chop_on =
935 cpl_propertylist_get_bool(self, VISIR_PFITS_BOOL_CHOP_STATUS);
939 return chop_on ? 4 : 2;
952static double visir_pfits_get_slitwidth_raw(
const cpl_propertylist * self)
954 return visir_pfits_get_double(self,
"ESO INS SLIT1 WID");
964static const char * visir_pfits_get_slitname(
const cpl_propertylist * self)
966 return visir_pfits_get_string(
"ESO INS SLIT1 NAME");
double visir_pfits_get_monoc_pos(const cpl_propertylist *self)
The INS.MONOC1.POS.
int visir_pfits_get_navrg(const cpl_propertylist *self)
The NAVRG.
double visir_pfits_get_airmass_start(const cpl_propertylist *self)
The airmass start.
double visir_pfits_get_dit(const cpl_propertylist *self)
The DIT.
double visir_pfits_get_ra(const cpl_propertylist *self)
The RA.
double visir_pfits_get_mjdobs(const cpl_propertylist *self)
The MJD-OBS.
double visir_pfits_get_img_weight(const cpl_propertylist *self)
The relative weight of the image compared to the other images.
double visir_pfits_get_temp(const cpl_propertylist *self)
The telescope (M1) temperature [Celcius].
const char * visir_pfits_get_instrument(const cpl_propertylist *self)
The instrument.
int visir_pfits_get_win_nx(const cpl_propertylist *self)
The WIN NX key.
double visir_pfits_get_delta(const cpl_propertylist *self)
The DELTA keyword in a VISIR header.
int visir_pfits_get_win_ny(const cpl_propertylist *self)
The WIN NY key.
double visir_pfits_get_dec(const cpl_propertylist *self)
The DEC.
double visir_pfits_get_volt1dctb9(const cpl_propertylist *self)
The VOLT1.DCTB9.
int visir_pfits_get_chop_ncycles(const cpl_propertylist *self)
The number of chopping cycles.
double visir_pfits_get_slitwidth(const cpl_propertylist *self)
The slit width in Arcseconds.
int visir_pfits_get_expno(const cpl_propertylist *self)
The number of the current exposition.
double visir_pfits_get_pixscale(const cpl_propertylist *self)
The pixel scale.
double visir_pfits_get_volt2dctb9(const cpl_propertylist *self)
The VOLT2.DCTB9.
const char * visir_pfits_get_date_obs(const cpl_propertylist *self)
The date of observation.
double visir_pfits_get_ada_posang(const cpl_propertylist *self)
The adapter position angle in rad.
double visir_pfits_get_chop_posang(const cpl_propertylist *self)
The chopping position angle in rad.
const char * visir_pfits_get_starname(const cpl_propertylist *self)
The std star name.
int visir_pfits_get_obs_id(const cpl_propertylist *self)
The OBS ID.
const char * visir_pfits_get_det_name(const cpl_propertylist *self)
The detector name.
const char * visir_pfits_get_insmode(const cpl_propertylist *self)
The mode.
const char * visir_pfits_get_arcfile(const cpl_propertylist *self)
The arcfile
double visir_pfits_get_exptime(const cpl_propertylist *self)
The exposure time.
double visir_pfits_get_cumoffsety(const cpl_propertylist *self)
The cumulative offset in Y.
const char * visir_pfits_get_filter(const cpl_propertylist *self)
The filter.
double visir_pfits_get_pixspace(const cpl_propertylist *self)
The pixel spacing.
const char * visir_pfits_get_chopnod_dir(const cpl_propertylist *self)
The chopping direction.
double visir_pfits_get_focus(const cpl_propertylist *self)
The focus.
double visir_pfits_get_volt2dcta9(const cpl_propertylist *self)
The VOLT2.DCTA9.
int visir_pfits_get_ndit(const cpl_propertylist *self)
The NDIT keyword.
double visir_pfits_get_airmass_end(const cpl_propertylist *self)
The airmass end.
int visir_pfits_get_naxis3(const cpl_propertylist *self)
The NAXIS3 key.
double visir_pfits_get_chop_pthrow(const cpl_propertylist *self)
The chopping throw in pixels.
const char * visir_pfits_get_grat1_name(const cpl_propertylist *self)
The name of grating 1.
double visir_pfits_get_alpha(const cpl_propertylist *self)
The alpha angle.
double visir_pfits_get_volt1dcta9(const cpl_propertylist *self)
The VOLT1.DCTA9.
int visir_pfits_get_naxis1(const cpl_propertylist *self)
The NAXIS1 key.
double visir_pfits_get_chop_throw(const cpl_propertylist *self)
The chopping throw.
int visir_pfits_get_naxis2(const cpl_propertylist *self)
The NAXIS2 key.
double visir_pfits_get_chop_freq(const cpl_propertylist *self)
The chopping frequency.
int visir_pfits_get_start_y(const cpl_propertylist *self)
The WIN STRY key.
const char * visir_pfits_get_frame_type(const cpl_propertylist *self)
The frame type.
const char * visir_pfits_get_mode(const cpl_propertylist *self)
The mode name.
double visir_pfits_get_cumoffsetx(const cpl_propertylist *self)
The cumulative offset in X.
int visir_pfits_get_start_x(const cpl_propertylist *self)
The WIN STRX key.
double visir_pfits_get_wlen(const cpl_propertylist *self)
The central wavelength.
const char * visir_pfits_get_nodpos(const cpl_propertylist *self)
The nodding position.
const char * visir_pfits_get_resol(const cpl_propertylist *self)
The spectral resolution.
int visir_pfits_get_numbexp(const cpl_propertylist *self)
The number of exposures.
double visir_pfits_get_chop_stat(const cpl_propertylist *self)
The chopping status.
int visir_pfits_get_nbeams(const cpl_propertylist *self)
The number of input beams.