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 #include <fors_photometry_impl.h>
00033 #include <fors_dfs.h>
00034 #include <fors_utils.h>
00035 #include <test_simulate.h>
00036 #include <test.h>
00037
00044 #undef cleanup
00045 #define cleanup \
00046 do { \
00047 cpl_frameset_delete(frames); \
00048 cpl_parameterlist_delete(parameters); \
00049 cpl_propertylist_delete(header); \
00050 } while(0)
00051
00054 static void
00055 test_photometry(void)
00056 {
00057 cpl_parameterlist *parameters = cpl_parameterlist_new();
00058 cpl_frameset *frames = cpl_frameset_new();
00059
00060 const char *filename[] = {"photometry_aligned0.fits",
00061 "photometry_aligned1.fits",
00062 "photometry_aligned2.fits",
00063 "photometry_aligned3.fits"};
00064 cpl_propertylist *header = cpl_propertylist_new();
00065 double exptime = 10.0;
00066 cpl_frameset_insert(frames, create_sky_flat("photometry_master_flat.fits",
00067 MASTER_SKY_FLAT_IMG,
00068 CPL_FRAME_GROUP_RAW,
00069 10.0));
00070
00071 cpl_frameset_insert(frames, create_phot_table("photometry_phot_table.fits",
00072 PHOT_TABLE,
00073 CPL_FRAME_GROUP_CALIB));
00074
00075 create_standard_keys(header, exptime);
00076 cpl_propertylist_update_double(header, "AIRMASS", 1.234);
00077
00078 {
00079 int i;
00080 for (i = 0; i < sizeof(filename)/sizeof(*filename); i++) {
00081
00082
00083
00084
00085 cpl_table *aligned = cpl_table_new(1);
00086
00087 cpl_frame *f = cpl_frame_new();
00088 cpl_frame_set_tag(f, ALIGNED_PHOT);
00089 cpl_frame_set_filename(f, filename[i]);
00090 cpl_frameset_insert(frames, f);
00091
00092 cpl_table_new_column(aligned, "INSTR_MAG", CPL_TYPE_DOUBLE);
00093 cpl_table_new_column(aligned, "DINSTR_MAG", CPL_TYPE_DOUBLE);
00094 cpl_table_new_column(aligned, "MAG", CPL_TYPE_DOUBLE);
00095 cpl_table_new_column(aligned, "DMAG", CPL_TYPE_DOUBLE);
00096 cpl_table_new_column(aligned, "CAT_MAG", CPL_TYPE_DOUBLE);
00097 cpl_table_new_column(aligned, "DCAT_MAG", CPL_TYPE_DOUBLE);
00098 cpl_table_new_column(aligned, "COLOR", CPL_TYPE_DOUBLE);
00099 cpl_table_new_column(aligned, "RA", CPL_TYPE_DOUBLE);
00100 cpl_table_new_column(aligned, "DEC", CPL_TYPE_DOUBLE);
00101 cpl_table_new_column(aligned, "X", CPL_TYPE_DOUBLE);
00102 cpl_table_new_column(aligned, "Y", CPL_TYPE_DOUBLE);
00103 cpl_table_new_column(aligned, "A", CPL_TYPE_DOUBLE);
00104 cpl_table_new_column(aligned, "B", CPL_TYPE_DOUBLE);
00105 cpl_table_new_column(aligned, "FWHM", CPL_TYPE_DOUBLE);
00106 cpl_table_new_column(aligned, "THETA", CPL_TYPE_DOUBLE);
00107 cpl_table_new_column(aligned, "CLASS_STAR", CPL_TYPE_DOUBLE);
00108 cpl_table_new_column(aligned, "OBJECT", CPL_TYPE_STRING);
00109 cpl_table_new_column(aligned, "USE_CAT", CPL_TYPE_INT);
00110
00111 cpl_table_set_double(aligned, "INSTR_MAG", 0, -13.8);
00112 cpl_table_set_double(aligned, "DINSTR_MAG", 0, 0.1);
00113 cpl_table_set_double(aligned, "MAG", 0, 14.4);
00114 cpl_table_set_double(aligned, "DMAG", 0, 0.004);
00115 cpl_table_set_double(aligned, "CAT_MAG", 0, 14.2);
00116 cpl_table_set_double(aligned, "DCAT_MAG", 0, 0.002);
00117 cpl_table_set_double(aligned, "COLOR", 0, 0.4);
00118
00119 cpl_table_set_double(aligned, "RA", 0, 100);
00120 cpl_table_set_double(aligned, "DEC", 0, 1);
00121
00122 cpl_table_set_double(aligned, "X", 0, 400);
00123 cpl_table_set_double(aligned, "Y", 0, 500);
00124 cpl_table_set_double(aligned, "A", 0, 2);
00125 cpl_table_set_double(aligned, "B", 0, 1);
00126 cpl_table_set_double(aligned, "FWHM", 0, 1.4);
00127 cpl_table_set_double(aligned, "THETA", 0, 0.1);
00128 cpl_table_set_double(aligned, "CLASS_STAR", 0, 0.1);
00129
00130 cpl_table_set_string(aligned, "OBJECT", 0, "MOBJEKT");
00131 cpl_table_set_int(aligned, "USE_CAT", 0, 1);
00132
00133 cpl_table_save(aligned, header, NULL, filename[i], CPL_IO_DEFAULT);
00134
00135 cpl_table_delete(aligned); aligned = NULL;
00136 }
00137 }
00138
00139 assure( !cpl_error_get_code(), return, NULL );
00140
00141 fors_photometry_define_parameters(parameters);
00142 cpl_parameter_set_int(cpl_parameterlist_find(parameters,
00143 "fors.fors_photometry.degreef1"),
00144 0);
00145
00146 fors_photometry(frames, parameters);
00147
00148 cleanup;
00149 return;
00150 }
00151
00152
00156 int main(void)
00157 {
00158 TEST_INIT;
00159
00160 test_photometry();
00161
00162 TEST_END;
00163 }
00164