|
X-shooter Pipeline Reference Manual 3.8.15
|
#include <xsh_utils.h>#include <xsh_dfs.h>#include <xsh_pfits.h>#include <xsh_pfits_qc.h>#include <xsh_data_spectrum.h>#include <cpl.h>#include <cpl_test.h>#include <errno.h>Go to the source code of this file.
Functions | |
| static int | getlen (const char *str) |
| static int | create_dummy_raw_frame (cpl_frameset *frames) |
| Creates an input FITS file representing a dummy raw data file. | |
| static int | create_input_product_frame (cpl_frameset *frames, const cpl_parameterlist *params, xsh_instrument *instrument) |
| Creates a 1D spectrum product FITS file in X-Shooter native format. | |
| static int | check_output_file (cpl_boolean expect_uncalib) |
| Checks that the generated output file is valid. | |
| int | main (void) |
| Unit tests of the Science Data Product DFS functions. | |
| #define BITPIX_KEYWORD "BITPIX" |
Definition at line 127 of file test-xsh_dfs_sdp.c.
| #define BUINT_VALUE "ADU" |
Definition at line 74 of file test-xsh_dfs_sdp.c.
| #define CHECKSUM_KEYWORD "CHECKSUM" |
Definition at line 130 of file test-xsh_dfs_sdp.c.
| #define CONAD_VALUE 4.0 |
Definition at line 71 of file test-xsh_dfs_sdp.c.
| #define CSYER1_VALUE 1.2 |
Definition at line 73 of file test-xsh_dfs_sdp.c.
| #define DATASUM_KEYWORD "DATASUM" |
Definition at line 131 of file test-xsh_dfs_sdp.c.
| #define DATE_KEYWORD "DATE" |
Definition at line 129 of file test-xsh_dfs_sdp.c.
| #define DATEOBS_VALUE "2014-01-01T00:00:00.000" |
Definition at line 57 of file test-xsh_dfs_sdp.c.
| #define DEC_VALUE -70.27194 |
Definition at line 59 of file test-xsh_dfs_sdp.c.
| #define EQUINOX_KEYWORD "EQUINOX" |
Definition at line 121 of file test-xsh_dfs_sdp.c.
| #define EQUINOX_VALUE 2000 |
Definition at line 62 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_APERTURE 0.9/3600. |
Definition at line 107 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_DEC DEC_VALUE |
Definition at line 86 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_DETRON RON_VALUE |
Definition at line 102 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_DISPELEM "VIS" |
Definition at line 79 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_EFFRON RON_VALUE |
Definition at line 103 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_EQUINOX EQUINOX_VALUE |
Definition at line 84 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_EXPTIME EXPTIME_VALUE |
Definition at line 87 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_EXTNAME "SPECTRUM" |
Definition at line 117 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_FLUXCAL "UNCALIBRATED" |
Definition at line 95 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_FLUXERR -2 |
Definition at line 100 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_INHERIT CPL_TRUE |
Definition at line 118 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_MJDEND MJDOBS_VALUE + EXPTIME_VALUE/86400. |
Definition at line 89 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_MJDOBS MJDOBS_VALUE |
Definition at line 88 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_NCOMBINE 1 |
Definition at line 105 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_NELEM 11 |
Definition at line 116 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_OBJECT TARGET_NAME |
Definition at line 80 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_OBS_ID OBS_ID_VALUE |
Definition at line 91 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_OBSTECH PRO_TECH_VALUE |
Definition at line 92 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_ORIGIN ORIGIN_VALUE |
Definition at line 78 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_PRODCATG OUTPUT_FRAME_TAG |
Definition at line 93 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_PRODLVL 2 |
Definition at line 94 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_PROG_ID PROG_ID_VALUE |
Definition at line 90 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_PROV1 RAW_FILE_NAME |
Definition at line 104 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_RA RA_VALUE |
Definition at line 85 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_SNR SNR_VALUE |
Definition at line 101 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_SPEC_BIN 10. |
Definition at line 98 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_SPEC_BW 100. |
Definition at line 111 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_SPEC_VAL 550. |
Definition at line 110 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TDMAX1 EXPECTED_WAVELMAX |
Definition at line 113 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TDMIN1 EXPECTED_WAVELMIN |
Definition at line 112 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TELAPSE EXPTIME_VALUE |
Definition at line 108 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TFIELDS 5 |
Definition at line 114 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TFIELDS_UNCAL 7 |
Definition at line 115 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TITLE "SUN,centre_123_2014-01-01T00:00:00.000" |
Definition at line 106 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TMID MJDOBS_VALUE + EXPTIME_VALUE/(2.0 * 86400.) |
Definition at line 109 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_TOT_FLUX CPL_FALSE |
Definition at line 99 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_WAVELMAX 600. |
Definition at line 97 of file test-xsh_dfs_sdp.c.
| #define EXPECTED_WAVELMIN 500. |
Definition at line 96 of file test-xsh_dfs_sdp.c.
| #define EXPTIME_VALUE 15. |
Definition at line 67 of file test-xsh_dfs_sdp.c.
| #define EXTEND_KEYWORD "EXTEND" |
Definition at line 128 of file test-xsh_dfs_sdp.c.
| #define INSTRUME_KEYWORD "INSTRUME" |
Definition at line 125 of file test-xsh_dfs_sdp.c.
| #define INSTRUME_VALUE "XSHOOTER" |
Definition at line 66 of file test-xsh_dfs_sdp.c.
| #define MJDOBS_VALUE 10.1 |
Definition at line 56 of file test-xsh_dfs_sdp.c.
| #define OBJECT_VALUE "STD,TELLURIC" |
Definition at line 54 of file test-xsh_dfs_sdp.c.
| #define OBS_ID_VALUE 123 |
Definition at line 69 of file test-xsh_dfs_sdp.c.
| #define ORIGIN_VALUE "ESO" |
Definition at line 60 of file test-xsh_dfs_sdp.c.
| #define OUTPUT_FILE_NAME "SDP_"PRODUCT_FILE_NAME |
Definition at line 50 of file test-xsh_dfs_sdp.c.
| #define OUTPUT_FRAME_TAG "SCIENCE.SPECTRUM" |
Definition at line 51 of file test-xsh_dfs_sdp.c.
| #define PRO_TECH_VALUE "ECHELLE,SLIT,STARE" |
Definition at line 70 of file test-xsh_dfs_sdp.c.
| #define PRODUCT_FILE_NAME "OBJECT_SLIT_STARE_VIS.fits" |
Definition at line 48 of file test-xsh_dfs_sdp.c.
| #define PRODUCT_FRAME_TAG XSH_OBJECT_SLIT_STARE_VIS |
Definition at line 49 of file test-xsh_dfs_sdp.c.
| #define PROG_ID_VALUE "abc" |
Definition at line 68 of file test-xsh_dfs_sdp.c.
| #define RA_VALUE 60.605358 |
Definition at line 58 of file test-xsh_dfs_sdp.c.
| #define RAW_FILE_NAME "input_raw_file.fits" |
Definition at line 46 of file test-xsh_dfs_sdp.c.
| #define RAW_FRAME_TAG XSH_WAVE_VIS |
Definition at line 47 of file test-xsh_dfs_sdp.c.
| #define RECIPE_ID "test_recipe" |
Definition at line 45 of file test-xsh_dfs_sdp.c.
| #define RON_VALUE 2.6 |
Definition at line 72 of file test-xsh_dfs_sdp.c.
| #define SIMPLE_KEYWORD "SIMPLE" |
Definition at line 126 of file test-xsh_dfs_sdp.c.
| #define SLIT_STRING_VALUE "0.9x11" |
Definition at line 55 of file test-xsh_dfs_sdp.c.
| #define SNR_VALUE 3.5 |
Definition at line 52 of file test-xsh_dfs_sdp.c.
| #define TARGET_NAME "SUN,centre,P2" |
Definition at line 53 of file test-xsh_dfs_sdp.c.
| #define TELESCOP_VALUE "ESO-VLT-U2" |
Definition at line 61 of file test-xsh_dfs_sdp.c.
| #define TEST_NAME "Test-XSH_DFS_SDP" |
Definition at line 42 of file test-xsh_dfs_sdp.c.
| #define test_success | ( | expr | ) | cpl_test_assert((expr) == EXIT_SUCCESS) |
Definition at line 134 of file test-xsh_dfs_sdp.c.
| #define TFIELDS_KEYWORD "TFIELDS" |
Definition at line 132 of file test-xsh_dfs_sdp.c.
|
static |
Checks that the generated output file is valid.
| expect_uncalib | Boolean value indicating if columns for the uncalibrated spectrum are expected and should be checked. |
EXIT_SUCCESS if the test can continue and EXIT_FAILURE otherwise. Definition at line 464 of file test-xsh_dfs_sdp.c.
References BITPIX_KEYWORD, CHECKSUM_KEYWORD, DATASUM_KEYWORD, DATE_KEYWORD, EQUINOX_KEYWORD, EXPECTED_APERTURE, EXPECTED_DEC, EXPECTED_DETRON, EXPECTED_DISPELEM, EXPECTED_EFFRON, EXPECTED_EQUINOX, EXPECTED_EXPTIME, EXPECTED_EXTNAME, EXPECTED_FLUXCAL, EXPECTED_FLUXERR, EXPECTED_INHERIT, EXPECTED_MJDEND, EXPECTED_MJDOBS, EXPECTED_NCOMBINE, EXPECTED_NELEM, EXPECTED_OBJECT, EXPECTED_OBS_ID, EXPECTED_OBSTECH, EXPECTED_ORIGIN, EXPECTED_PRODCATG, EXPECTED_PRODLVL, EXPECTED_PROG_ID, EXPECTED_PROV1, EXPECTED_RA, EXPECTED_SNR, EXPECTED_SPEC_BIN, EXPECTED_SPEC_BW, EXPECTED_SPEC_VAL, EXPECTED_TDMAX1, EXPECTED_TDMIN1, EXPECTED_TELAPSE, EXPECTED_TFIELDS, EXPECTED_TFIELDS_UNCAL, EXPECTED_TITLE, EXPECTED_TMID, EXPECTED_TOT_FLUX, EXPECTED_WAVELMAX, EXPECTED_WAVELMIN, EXTEND_KEYWORD, getlen(), INSTRUME_KEYWORD, OUTPUT_FILE_NAME, SIMPLE_KEYWORD, TFIELDS_KEYWORD, XSH_DEC, XSH_EXPTIME, XSH_EXTNAME, XSH_MJDEND, XSH_MJDOBS, XSH_NAXIS, XSH_RA, XSH_SDP_COLUMN_ERR, XSH_SDP_COLUMN_ERR_REDUCED, XSH_SDP_COLUMN_FLUX, XSH_SDP_COLUMN_FLUX_REDUCED, XSH_SDP_COLUMN_QUAL, XSH_SDP_COLUMN_SNR, XSH_SDP_COLUMN_WAVE, XSH_SDP_KEYWORD_APERTURE, XSH_SDP_KEYWORD_CONTNORM, XSH_SDP_KEYWORD_DETRON, XSH_SDP_KEYWORD_DISPELEM, XSH_SDP_KEYWORD_EFFRON, XSH_SDP_KEYWORD_FLUXCAL, XSH_SDP_KEYWORD_FLUXERR, XSH_SDP_KEYWORD_INHERIT, XSH_SDP_KEYWORD_LAMNLIN, XSH_SDP_KEYWORD_LAMRMS, XSH_SDP_KEYWORD_M_EPOCH, XSH_SDP_KEYWORD_NCOMBINE, XSH_SDP_KEYWORD_NELEM, XSH_SDP_KEYWORD_OBID1, XSH_SDP_KEYWORD_OBJECT, XSH_SDP_KEYWORD_OBSTECH, XSH_SDP_KEYWORD_ORIGIN, XSH_SDP_KEYWORD_PROCSOFT, XSH_SDP_KEYWORD_PRODCATG, XSH_SDP_KEYWORD_PRODLVL, XSH_SDP_KEYWORD_PROG_ID, XSH_SDP_KEYWORD_PROV, XSH_SDP_KEYWORD_REFERENC, XSH_SDP_KEYWORD_SPEC_BIN, XSH_SDP_KEYWORD_SPEC_BW, XSH_SDP_KEYWORD_SPEC_ERR, XSH_SDP_KEYWORD_SPEC_RES, XSH_SDP_KEYWORD_SPEC_SYE, XSH_SDP_KEYWORD_SPEC_VAL, XSH_SDP_KEYWORD_SPECSYS, XSH_SDP_KEYWORD_TDMAX, XSH_SDP_KEYWORD_TDMIN, XSH_SDP_KEYWORD_TELAPSE, XSH_SDP_KEYWORD_TITLE, XSH_SDP_KEYWORD_TMID, XSH_SDP_KEYWORD_TOT_FLUX, XSH_SDP_KEYWORD_WAVELMAX, XSH_SDP_KEYWORD_WAVELMIN, XSH_SNR, and XSH_TELESCOP.
Referenced by main().
|
static |
Creates an input FITS file representing a dummy raw data file.
A dummy raw input file is created and an appropriate frame is added to the output frame set.
| [out] | frames | The frame set that will be updated with the newly created frame. |
EXIT_SUCCESS if the file and frame were created successfully and testing can continue. If there was an error and testing cannot continue then EXIT_FAILURE is returned. Definition at line 277 of file test-xsh_dfs_sdp.c.
References CONAD_VALUE, DATEOBS_VALUE, DEC_VALUE, EQUINOX_KEYWORD, EQUINOX_VALUE, EXPTIME_VALUE, INSTRUME_KEYWORD, INSTRUME_VALUE, MJDOBS_VALUE, OBJECT_VALUE, OBS_ID_VALUE, ORIGIN_VALUE, PRO_TECH_VALUE, PROG_ID_VALUE, RA_VALUE, RAW_FILE_NAME, RAW_FRAME_TAG, RON_VALUE, SLIT_STRING_VALUE, TARGET_NAME, TELESCOP_VALUE, XSH_CONAD, XSH_DATE_OBS, XSH_DEC, XSH_DPR_TYPE, XSH_EXPTIME, XSH_MJDOBS, XSH_OBS_ID, XSH_OBS_PROG_ID, XSH_OBS_TARG_NAME, XSH_PRO_TECH, XSH_RA, XSH_RON, XSH_SDP_KEYWORD_OBJECT, XSH_SDP_KEYWORD_ORIGIN, XSH_SLIT_VIS, and XSH_TELESCOP.
Referenced by main().
|
static |
Creates a 1D spectrum product FITS file in X-Shooter native format.
A file containing a 1D spectrum in X-Shooter native format is created. In addition an appropriate frame is added to the output frame set for the newly created file.
| [out] | frames | The output frame set to which we add the new frame. |
| [in] | params | List of recipe parameters. |
| [in] | instrument | The X-Shooter instrument structure describing various parameters of the instrument. |
EXIT_SUCCESS if the file and frame were created successfully and testing can continue. If there was an error and testing cannot continue then EXIT_FAILURE is returned. Definition at line 385 of file test-xsh_dfs_sdp.c.
References BUINT_VALUE, CSYER1_VALUE, xsh_spectrum::errs, xsh_spectrum::errs_header, EXPTIME_VALUE, xsh_spectrum::flux, xsh_spectrum::flux_header, instrument, PRO_TECH_VALUE, PRODUCT_FILE_NAME, PRODUCT_FRAME_TAG, xsh_spectrum::qual, RECIPE_ID, SNR_VALUE, xsh_add_product_spectrum(), XSH_BUNIT, XSH_CSYER1, XSH_EXPTIME, XSH_PRO_TECH, XSH_QC_FLUX_SN, xsh_spectrum_1D_create(), xsh_spectrum_free(), and xsh_spectrum_save().
Referenced by main().
|
static |
| str | Null terminated string. The pointer can be NULL. |
Definition at line 449 of file test-xsh_dfs_sdp.c.
Referenced by check_output_file().
| int main | ( | void | ) |
Unit tests of the Science Data Product DFS functions.
Definition at line 163 of file test-xsh_dfs_sdp.c.
References check_output_file(), create_dummy_raw_frame(), create_input_product_frame(), instrument, OUTPUT_FILE_NAME, PRODUCT_FILE_NAME, PRODUCT_FRAME_TAG, RAW_FILE_NAME, RECIPE_ID, TEST_NAME, test_success, xsh_add_sdp_product_spectrum(), XSH_ARM_VIS, xsh_free_product_files(), xsh_free_temporary_files(), xsh_instrument_free(), xsh_instrument_new(), xsh_instrument_set_arm(), xsh_instrument_set_lamp(), xsh_instrument_set_mode(), xsh_instrument_set_recipe_id(), XSH_LAMP_QTH, and XSH_MODE_SLIT.