/*-------------------------------------------------------------------------*/ /** @file dicbkeys.c @author Y. Jung @date July 2000 @version $Revision: 1.9 $ @brief ISAAC functions using FITS header keywords */ /*--------------------------------------------------------------------------*/ /* $Id: dicbkeys.c,v 1.9 2001/11/28 16:31:51 yjung Exp $ $Author: yjung $ $Date: 2001/11/28 16:31:51 $ $Revision: 1.9 $ */ /*--------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include #include #include #include "isaacp_lib.h" #include "dicbkeys.h" /*--------------------------------------------------------------------------- Function codes ---------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** @brief find out the arcfile @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_arcfile(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "ARCFILE"); } else { val = qfits_query_hdr(filename, "ARCFILE"); } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the origfile @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_origfile(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "ORIGFILE"); } else { val = qfits_query_hdr(filename, "ORIGFILE"); } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the date @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_date(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "DATE"); } else { val = qfits_query_hdr(filename, "DATE"); } val = qfits_pretty_string(val); return val ; } /*-------------------------------------------------------------------------*/ /** @brief find out the date of observation @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_date_obs(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "DATE-OBS"); } else { val = qfits_query_hdr(filename, "DATE-OBS"); } val = qfits_pretty_string(val); return val ; } /*-------------------------------------------------------------------------*/ /** @brief find out the template id @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_templateid(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "TPL.ID") ; } else { val = qfits_query_hdr(filename, "TPL.ID") ; } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief get the string describing the frame type @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*-------------------------------------------------------------------------*/ char *isaac_get_detector_frame_type(char * filename) { char *val ; if ((val = qfits_query_hdr(filename, "DET.FRAME.TYPE")) == NULL) { /* New keyword (July 2001) */ if ((val = qfits_query_hdr(filename, "DET.FRAM.TYPE")) == NULL) { return NULL ; } } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief get the frame id @param filename ISAAC FITS file name @return the frame id */ /*-------------------------------------------------------------------------*/ int isaac_get_frame_type(char * filename) { char * value ; if ((value = isaac_get_detector_frame_type(filename)) == NULL) { return ISAAC_UNRECOGNIZED ; } if (!strcmp(value, "HALF-CYCLE1")) return ISAAC_HALF_CYCLE_1 ; /* New keyword value (2001) ; */ else if (!strcmp(value, "HCYCLE1")) return ISAAC_HALF_CYCLE_1 ; else if (!strcmp(value, "HALF-CYCLE2")) return ISAAC_HALF_CYCLE_2 ; /* New keyword value (2001) ; */ else if (!strcmp(value, "HCYCLE2")) return ISAAC_HALF_CYCLE_2 ; else if (!strcmp(value, "INT")) return ISAAC_INT ; else return ISAAC_UNRECOGNIZED ; } /*-------------------------------------------------------------------------*/ /** @brief Get the read out mode name. @param filename ISAAC FITS file name @return pointer to statically allocated char string, or NULL. */ /*-------------------------------------------------------------------------*/ char * isaac_get_detector_readout_mode(char * filename) { char * val; val = qfits_query_hdr(filename, "DET.MODE.NAME") ; return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the first dispersion coefficient in HISTORY fields @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_hist_disp1(char * filename) { char * val ; val = qfits_query_hdr(filename, "HISTORY DISPCOE1") ; return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the second dispersion coefficient in HISTORY fields @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_hist_disp2(char * filename) { char * val ; val = qfits_query_hdr(filename, "HISTORY DISPCOE2") ; return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the current exposure number @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char *isaac_get_current_exp_nb(char * filename) { char * val ; val = qfits_query_hdr(filename, "TPL.EXPNO") ; return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the number of expositions @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_numbexp(char * filename) { char * val ; val = qfits_query_hdr(filename, "TPL.NEXP") ; return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the working mode @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_mode(char * filename) { char * val ; val = qfits_query_hdr(filename, "INS.MODE") ; return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the mjd-obs keyword @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_mjdobs(char * filename) { char * val ; val = qfits_query_hdr(filename, "MJD-OBS"); return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the OBS TARG NAME keyword @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_obs_targ_name(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "STAR.NAME") ; if (val == NULL) { val = paf_query(filename, "QC.STDNAME") ; } } else { val = qfits_query_hdr(filename, "OBS.TARG.NAME"); } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the name of the readout-mode used for a frame. @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_romode_name(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "DET.MODE.NAME") ; } else { val = qfits_query_hdr(filename, "DET.MODE.NAME"); } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the ID of the readout-mode used for a frame. @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_romode_id(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "DET.NCORRS") ; } else { val = qfits_query_hdr(filename, "DET.NCORRS"); } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out the OBS ID keyword @param filename ISAAC FITS file name @return pointer to statically allocated character string */ /*--------------------------------------------------------------------------*/ char * isaac_get_obs_id(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "OBS.ID") ; } else { val = qfits_query_hdr(filename, "OBS.ID"); } return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief find out which wave band is active in long wavelength @param filename ISAAC FITS file name @return pointer to statically allocated character string Similar to isaac_get_filter, but checks FILT3,4 instead of FILT1,2 */ /*--------------------------------------------------------------------------*/ char * isaac_get_filter_lw(char * filename) { char * val ; val = qfits_query_hdr(filename, "INS.FILT3.ID"); if (val==NULL) return NULL ; val = qfits_pretty_string(val); /* If FILT3 is not open, return its value */ if (strcmp(val, "open")) { return val ; } /* FILT3 is open, return value from FILT4 */ val = qfits_query_hdr(filename, "INS.FILT4.ID"); if (val==NULL) return NULL; val = qfits_pretty_string(val); if (strcmp(val, "open")) { return val ; } return NULL ; } /*-------------------------------------------------------------------------*/ /** @brief find out which wave band is active in short wavelength @param filename ISAAC FITS file name @return pointer to statically allocated character string Similar to isaac_get_filter_lw, but checks FILT1,2 instead of FILT3,4 */ /*--------------------------------------------------------------------------*/ char * isaac_get_filter_sw(char * filename) { char * val ; val = qfits_query_hdr(filename, "INS.FILT1.ID"); if (val==NULL) return NULL ; val = qfits_pretty_string(val); /* If FILT1 is not open, return its value */ if (strcmp(val, "open")) { return val ; } /* FILT1 is open, return value from FILT2 */ val = qfits_query_hdr(filename, "INS.FILT2.ID"); if (val==NULL) return NULL; val = qfits_pretty_string(val); if (strcmp(val, "open")) { return val ; } return NULL ; } /*-------------------------------------------------------------------------*/ /** @brief find out which wave band is active @param filename ISAAC FITS file name @return pointer to statically allocated character string Detects which wave length mode is active (SW/LW) and checks relevant instrument filters accordingly */ /*--------------------------------------------------------------------------*/ char * isaac_get_filter(char * filename) { char * val ; if (is_paf_file(filename)) { val = paf_query(filename, "INS.FILTER.ID") ; if (val == NULL) val = paf_query(filename, "QC.FILTER.OBS") ; return val ; } switch (isaac_get_wavelength_mode(filename)) { case ISAAC_LW_MODE: return isaac_get_filter_lw(filename); case ISAAC_SW_MODE: default: return isaac_get_filter_sw(filename); } } /*-------------------------------------------------------------------------*/ /** @brief return an associated broad band filter @param filter ISAAC filter name as found in the header. @return pointer to statically allocated character string This function associates a broadband filter to an ISAAC filter, to allow e.g. zero point computations with the right star magnitude. The current list of associations is implemented: \begin{tabular}{ll} ISAAC filter & Broad band \\ \\ NB_1.06 & J \\ NB_1.08 & J \\ NB_1.19 & J \\ NB_1.21 & J \\ NB_1.26 & J \\ NB_1.28 & J \\ Z & J \\ SZ & J \\ Js & J \\ J & J \\ NB_1.64 & H \\ NB_1.71 & H \\ SH & H \\ H & H \\ SK & K \\ K & K \\ Ks & Ks \\ NB_2.07 & Ks \\ NB_2.09 & Ks \\ NB_2.13 & Ks \\ NB_2.17 & Ks \\ NB_2.19 & Ks \\ NB_2.25 & Ks \\ NB_2.29 & Ks \\ NB_2.34 & Ks \\ NB_3.21 & L \\ NB_3.28 & L \\ NB_3.80 & L \\ NB_4.07 & L \\ SL & L \\ L & L \\ M_NB & M \\ M & M \end{tabular} */ /*--------------------------------------------------------------------------*/ #define streq(s1,s2) (!strcmp((s1),(s2))) char * isaac_get_broadband_filter(char * filter) { static char ret_filter[40] ; strcpy(ret_filter, filter); if ( /* Narrow band filters in J */ streq(filter, "NB_1.06") || streq(filter, "NB_1.08") || streq(filter, "NB_1.19") || streq(filter, "NB_1.21") || streq(filter, "NB_1.26") || streq(filter, "NB_1.28") || /* Broad band filters associated to J */ streq(filter, "Z") || streq(filter, "SZ") || streq(filter, "Js") || streq(filter, "J") ) { strcpy(ret_filter, "J"); } else if ( /* Narrow band filters in H */ streq(filter, "NB_1.64") || streq(filter, "NB_1.71") || /* Broad band filters associated to H */ streq(filter, "SH") || streq(filter, "H") ) { strcpy(ret_filter, "H"); } else if ( /* Narrow band filters associated to Ks */ streq(filter, "NB_2.07") || streq(filter, "NB_2.09") || streq(filter, "NB_2.13") || streq(filter, "NB_2.17") || streq(filter, "NB_2.19") || streq(filter, "NB_2.25") || streq(filter, "NB_2.29") || streq(filter, "NB_2.34") || /* Broad band filters associated to Ks */ streq(filter, "Ks") ) { strcpy(ret_filter, "Ks"); } else if ( /* No narrow band associated to K, only broadband */ streq(filter, "SK") || streq(filter, "K") ) { strcpy(ret_filter, "K"); } else if ( /* Narrow band filters associated to L */ streq(filter, "NB_3.21") || streq(filter, "NB_3.28") || streq(filter, "NB_3.80") || streq(filter, "NB_4.07") || /* Broad band filters associated to L */ streq(filter, "SL") || streq(filter, "L") ) { strcpy(ret_filter, "L"); } else if ( /* No narrow band associated to M, only broadband */ streq(filter, "M_NB") || streq(filter, "M") ) { strcpy(ret_filter, "M"); } else { e_error("unknown ISAAC filter: [%s]", filter); return NULL ; } return &(ret_filter[0]); } #undef streq /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the RA keyword in an ISAAC header @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_ra(char * filename) { /* So far, only one convention used for RA */ return qfits_query_hdr(filename, "RA"); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the DEC keyword in an ISAAC header @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_dec(char * filename) { /* So far, only one convention used for Dec */ return qfits_query_hdr(filename, "DEC"); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the DIT keyword in an ISAAC header @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_dit(char * filename) { /* So far, only one convention used for DIT */ return qfits_query_hdr(filename, "DET.DIT"); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the NDIT keyword in an ISAAC header @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_ndit(char * filename) { /* So far, only one convention used for NDIT */ return qfits_query_hdr(filename, "DET.NDIT"); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the CUMOFFSETX keyword in an ISAAC header @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_cumoffsetx(char * filename) { /* So far, only one convention used for CUMOFFSETX */ return qfits_query_hdr(filename, "SEQ.CUMOFFSETX"); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the CUMOFFSETY keyword in an ISAAC header @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_cumoffsety(char * filename) { /* So far, only one convention used for CUMOFFSETY */ return qfits_query_hdr(filename, "SEQ.CUMOFFSETY"); } /*-------------------------------------------------------------------------*/ /** @brief Find out all header offsets for a frame list. @param filename Name of the ASCII list to parse. @return 1 newly allocated double3 array. This function calls iteratively get_cumoffsetx and get_cumoffsety on each file name in the input ASCII frame list, and stores the results into a newly allocated double3 array. If an error occurs, this function returns NULL. The returned list must be deallocated using double3_del(). */ /*--------------------------------------------------------------------------*/ double3 * isaac_get_offsets(char * filename) { double3 * offs ; int i ; framelist * flist ; char * sval ; if (filename==NULL) return NULL; flist = framelist_load(filename); if (flist==NULL) { e_error("reading frame list: %s", filename); return NULL ; } offs = double3_new(flist->n); for (i=0 ; in ; i++) { /* Get X offset */ sval = isaac_get_cumoffsetx(flist->name[i]); if (sval==NULL) { e_error("getting X offset from frame %s", flist->name[i]); double3_del(offs); return NULL ; } offs->x[i] = (double)atof(sval); /* Get Y offset */ sval = isaac_get_cumoffsety(flist->name[i]); if (sval==NULL) { e_error("getting Y offset from frame %s", flist->name[i]); double3_del(offs); return NULL ; } offs->y[i] = (double)atof(sval); /* Set z field to zero */ offs->z[i] = 0.0 ; } framelist_del(flist); return offs ; } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the PIXSCALE keyword in an ISAAC header @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_pixscale(char * filename) { /* So far, only one convention used for PIXSCALE */ return qfits_query_hdr(filename, "INS.PIXSCALE"); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated with the ISAAC default keyword used to store the central wavelength in spectroscopic modes @param filename ISAAC FITS file name @return central wavelength in angstroms, -1 in error case History support for various conventions Returned wavelength is in angstroms, is stored in microns in the header. */ /*--------------------------------------------------------------------------*/ double isaac_get_central_wavelength(char * filename) { char * wlen_s ; double wlen ; wlen=-1 ; /* So far, only one convention used for central wavelength */ if (is_paf_file(filename)) { wlen_s = paf_query(filename, "INS.GRAT.WLEN"); if (wlen_s!=NULL) { wlen = (double)atof(wlen_s); } } else { wlen_s = qfits_query_hdr(filename, "INS.GRAT.WLEN"); if (wlen_s!=NULL) { /* Factor 10000.0 due to conversion microns->angstroms */ wlen = 10000.0 * (double)atof(wlen_s); } } return wlen ; } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the objective name @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_objective(char * filename) { char * mode ; char * obj ; mode = isaac_get_mode(filename) ; /* The keyword used to store the objective is different for LW and SW */ if (mode[0] == 'S') { obj = qfits_query_hdr(filename, "INS.OPTI2.NAME") ; } else if (mode[0] == 'L') { obj = qfits_query_hdr(filename, "INS.OPTI3.NAME") ; } else { e_warning("unrecognized mode") ; return NULL ; } return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the optical ID @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_optical_id(char * filename) { char * obj ; /* So far, only one convention used for optical id name */ if (is_paf_file(filename)) { obj = paf_query(filename, "INS.OPTI1.ID") ; } else { obj = qfits_query_hdr(filename, "INS.OPTI1.ID") ; } return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the instrument @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_instrument(char * filename) { char * obj ; /* So far, only one convention used for resolution name */ obj = qfits_query_hdr(filename, "INSTRUME"); return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store order. @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_order(char * filename) { char * obj ; /* So far, only one convention used for order */ obj = qfits_query_hdr(filename, "INS.GRAT.ORDER"); return qfits_pretty_string(obj) ; } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the resolution name. Should be 'MR' or 'LR' @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_resolution(char * filename) { char * obj ; /* So far, only one convention used for resolution name */ if (is_paf_file(filename)) { obj = paf_query(filename, "INS.GRAT.NAME") ; } else { obj = qfits_query_hdr(filename, "INS.GRAT.NAME"); } return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the first lamp status. @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_lamp1_status(char * filename) { char * obj ; /* So far, only one convention used for resolution name */ obj = qfits_query_hdr(filename, "INS.LAMP1.ST"); return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the first lamp name. @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_lamp1_name(char * filename) { char * obj ; /* So far, only one convention used for resolution name */ obj = qfits_query_hdr(filename, "INS.LAMP1.NAME"); return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the second lamp status. @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_lamp2_status(char * filename) { char * obj ; /* So far, only one convention used for resolution name */ obj = qfits_query_hdr(filename, "INS.LAMP2.ST"); return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the second lamp name. @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_lamp2_name(char * filename) { char * obj ; /* So far, only one convention used for resolution name */ obj = qfits_query_hdr(filename, "INS.LAMP2.NAME"); return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out the character string associated to the ISAAC default keyword used to store the third lamp intensity. @param filename ISAAC FITS file name @return pointer to statically allocated character string History support for various conventions The returned string is statically allocated, no need to free() it! */ /*--------------------------------------------------------------------------*/ char * isaac_get_lamp3_intensity(char * filename) { char * obj ; /* So far, only one convention used for lamp intensity */ obj = qfits_query_hdr(filename, "INS.LAMP3.SET") ; return qfits_pretty_string(obj); } /*-------------------------------------------------------------------------*/ /** @brief find out for a given ISAAC file, if the Argon lamp was active @param filename ISAAC FITS file name @return 1 if the lamp is active, 0 if not, -1 in error case Based on the status of keyword INS.LAMP1.ST */ /*--------------------------------------------------------------------------*/ int isaac_is_argon_lamp_active(char * filename) { char * status ; char * sval ; /* So far, only one convention used for first lamp status */ status = qfits_query_hdr(filename, "INS.LAMP1.ST"); if (status == NULL) return -1 ; status = qfits_pretty_string(status); if (toupper(status[0])=='T') { /* Still has to verify that shutter is open */ sval = qfits_query_hdr(filename, "INS.CALSHUT.ST") ; if (sval == NULL) return 1 ; sval = qfits_pretty_string(sval) ; if (toupper(sval[0]) == 'T') return 1 ; } return 0 ; } /*-------------------------------------------------------------------------*/ /** @brief find out for a given ISAAC file, if the Xenon lamp was active @param filename ISAAC FITS file name @return 1 if the lamp is active, 0 if not, -1 in error case Based on the status of keyword INS.LAMP2.ST */ /*--------------------------------------------------------------------------*/ int isaac_is_xenon_lamp_active(char * filename) { char * status ; char * sval ; /* So far, only one convention used for second lamp status */ status = qfits_query_hdr(filename, "INS.LAMP2.ST"); if (status == NULL) return -1 ; status = qfits_pretty_string(status); if (toupper(status[0])=='T') { /* Still has to verify that shutter != 0 */ sval = qfits_query_hdr(filename, "INS.CALSHUT.ST") ; if (sval == NULL) return 1 ; sval = qfits_pretty_string(sval) ; if (toupper(sval[0]) == 'T') return 1 ; } return 0 ; } /*-------------------------------------------------------------------------*/ /** @brief get airmass start or end from an ISAAC FITS file @param filename source FITS file @param when 0 to get start, 1 to get end @return Char string containing what was found in header, NULL if error. */ /*--------------------------------------------------------------------------*/ char * isaac_get_airmass(char * filename, int when) { char * am ; /* So far, only one convention used for AIRMASS START/END */ if (when==AIRMASS_START) { /* Get airmass start */ if (is_paf_file(filename)) { am = paf_query(filename, "TEL.AIRM.START") ; } else { am = qfits_query_hdr(filename, "TEL.AIRM.START"); } } else if (when==AIRMASS_END) { if (is_paf_file(filename)) { am = paf_query(filename, "TEL.AIRM.END") ; } else { am = qfits_query_hdr(filename, "TEL.AIRM.END"); } } else { am = NULL ; } return qfits_pretty_string(am); } /*-------------------------------------------------------------------------*/ /** @brief find out the ambient humidity level as defined in the relevant ambient monitor dictionary @param filename source FITS file @return statically allocated char string, no need to free() it returns NULL if keyword cannot be found */ /*--------------------------------------------------------------------------*/ char * isaac_get_humidity_level(char * filename) { /* So far only one definition for this parameter */ return qfits_query_hdr(filename, "TEL.AMBI.RHUM"); } /*-------------------------------------------------------------------------*/ /** @brief find out the data category as defined by the DataFlow @param filename source FITS file @return statically allocated char string, no need to free() it returns NULL if error occurred */ /*--------------------------------------------------------------------------*/ char * isaac_get_dpr_catg(char * filename) { char * s ; if (is_paf_file(filename)) { s = paf_query(filename, "DPR.CATG") ; } else { s = qfits_query_hdr(filename, "DPR.CATG"); } return qfits_pretty_string(s); } /*-------------------------------------------------------------------------*/ /** @brief find out the data type as defined by the DataFlow @param filename source FITS file @return statically allocated char string, no need to free() it returns NULL if error occurred */ /*--------------------------------------------------------------------------*/ char * isaac_get_dpr_type(char * filename) { char * s ; if (is_paf_file(filename)) { s = paf_query(filename, "DPR.TYPE") ; } else { s = qfits_query_hdr(filename, "DPR.TYPE"); } return qfits_pretty_string(s); } /*-------------------------------------------------------------------------*/ /** @brief find out the data tech as defined by the DataFlow @param filename source FITS file @return statically allocated char string, no need to free() it returns NULL if error occurred */ /*--------------------------------------------------------------------------*/ char * isaac_get_dpr_tech(char * filename) { char * s ; if (is_paf_file(filename)) { s = paf_query(filename, "DPR.TECH") ; } else { s = qfits_query_hdr(filename, "DPR.TECH"); } return qfits_pretty_string(s); } /*-------------------------------------------------------------------------*/ /** @brief find out the pro catg as defined by the DataFlow @param filename Name of a FITS or PAF file. @return statically allocated char string, no need to free() it returns NULL if error occurred */ /*--------------------------------------------------------------------------*/ char * isaac_get_pro_catg(char * filename) { char * s ; if (is_paf_file(filename)) { s = paf_query(filename, "PRO.CATG"); } else { s = qfits_query_hdr(filename, "PRO.CATG"); } return s ; } /*-------------------------------------------------------------------------*/ /** @brief find out the pro catalog as defined by the DataFlow @param filename source FITS file @return statically allocated char string, no need to free() it returns NULL if error occurred */ /*--------------------------------------------------------------------------*/ char * isaac_get_pro_catalog(char * filename) { char * s ; if (is_paf_file(filename)) { s = paf_query(filename, "QC.LAMP"); } else { s = qfits_query_hdr(filename, "PRO.CATALOG"); } return s ; } /*---------------------------------------------------------------------------*/ /** @brief Get chopping status @param filename Input FITS file. @return statically allocated char string, no need to free() it History support for various conventions. Returns NULL if error occurred. */ /*---------------------------------------------------------------------------*/ char *isaac_get_chopping_status(char * filename) { char * val; /* Get chop flag */ val= qfits_query_hdr(filename, "TEL.CHOP.ST"); return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief Get chopping throw. @param filename Name of the file to query. @return statically allocated char string, no need to free() it. History support for various conventions. Returns NULL if error occurred. */ /*--------------------------------------------------------------------------*/ char * isaac_get_chopping_throw(char * filename) { char * val ; val = qfits_query_hdr(filename, "TEL.CHOP.THROW"); return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief Get chopping cycle. @param filename Name of the file to query. @return statically allocated char string, no need to free() it. History support for various conventions. Returns NULL if error occurred. */ /*--------------------------------------------------------------------------*/ char * isaac_get_chopping_cycle(char * filename) { char * val ; val = qfits_query_hdr(filename, "DET.CHOP.NCYCLES"); return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief Get chopping frequency. @param filename Name of the file to query. @return statically allocated char string, no need to free() it. History support for various conventions. Returns NULL if error occurred. */ /*--------------------------------------------------------------------------*/ char * isaac_get_chopping_frequency(char * filename) { char * val ; val = qfits_query_hdr(filename, "TEL.CHOP.FREQ"); return qfits_pretty_string(val); } /*-------------------------------------------------------------------------*/ /** @brief Get instrument mode: SW or LW @param filename Name of the file to query @return int for wavelength mode. This function analyses a header and tries to identify whether the frame has been taken by the SW or LW arm. The symbol value is currently: \begin{itemize} \item -1 an error occurred while getting this information. \item 0 unknown mode \item ISAAC_SW_MODE SW \item ISAAC_LW_MODE LW \end{itemize} */ /*--------------------------------------------------------------------------*/ int isaac_get_wavelength_mode(char * filename) { char * val ; int wmode ; wmode = 0 ; val = isaac_get_templateid(filename); if (val!=NULL) { if (!strncmp(val, "ISAACSW", 7)) { wmode = ISAAC_SW_MODE ; } else if (!strncmp(val, "ISAACLW", 7)) { wmode = ISAAC_LW_MODE; } else { e_warning("cannot determine instrument mode from template id"); } } else { wmode = -1 ; } return wmode; }