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_data.h>
00033 #include <fors_dfs.h>
00034
00035 #include <test_simulate.h>
00036 #include <test.h>
00037
00038 #include <cpl.h>
00039 #include <math.h>
00040
00048 #undef cleanup
00049 #define cleanup \
00050 do { \
00051 cpl_frameset_delete(cat_frames); \
00052 cpl_frame_delete(raw_frame); \
00053 cpl_frame_delete(phot_table); \
00054 fors_std_star_list_delete(&cat, fors_std_star_delete); \
00055 fors_setting_delete(&setting); \
00056 } while (0)
00057
00061 static void
00062 test_new(void)
00063 {
00064 cpl_frameset *cat_frames = NULL;
00065 cpl_frame *phot_table = NULL;
00066 const char *filename = "std_cat.fits";
00067 fors_std_star_list *cat = NULL;
00068 fors_setting *setting = NULL;
00069 double color_term, dcolor_term;
00070 double ext_coeff, dext_coeff;
00071 double expected_zeropoint, dexpected_zeropoint;
00072
00073
00074 cpl_frame *raw_frame = create_standard("std_cat_raw.fits",
00075 STANDARD_IMG, CPL_FRAME_GROUP_RAW);
00076
00077 phot_table = create_phot_table("std_cat_phot_table.fits",
00078 PHOT_TABLE, CPL_FRAME_GROUP_CALIB);
00079
00080 cat_frames = cpl_frameset_new();
00081 cpl_frameset_insert(cat_frames,
00082 create_std_cat(filename,
00083 FLX_STD_IMG, CPL_FRAME_GROUP_CALIB));
00084
00085 setting = fors_setting_new(raw_frame);
00086
00087 fors_phot_table_load(phot_table, setting,
00088 &color_term, &dcolor_term,
00089 &ext_coeff, &dext_coeff,
00090 &expected_zeropoint, &dexpected_zeropoint);
00091
00092
00093 cat = fors_std_cat_load(cat_frames, raw_frame, setting,
00094 color_term, dcolor_term);
00095
00096
00097
00098 fors_std_star_print_list(CPL_MSG_DEBUG, cat);
00099 fors_std_star_print_list(CPL_MSG_INFO, cat);
00100
00101 cleanup;
00102 return;
00103 }
00104
00105
00106 static void
00107 test_dist(void)
00108 {
00109 double ra = 34.5;
00110 double dec = -0.4;
00111 double mag = 15;
00112 double dmag = 0.51;
00113 double cmag = 15.2;
00114 double dcmag = 0.21;
00115 double color = 0.2;
00116
00117 double shift_arcsecs;
00118
00119 for (shift_arcsecs = 0.1; shift_arcsecs <= 100; shift_arcsecs *= 2) {
00120
00121 fors_std_star *s = fors_std_star_new(ra, dec, mag, dmag,
00122 cmag, dcmag,
00123 color, "some");
00124 fors_std_star *t = fors_std_star_new(ra + shift_arcsecs/3600,
00125 dec + shift_arcsecs/3600,
00126 mag, dmag,
00127 cmag, dcmag,
00128 color, "star");
00129
00130
00131
00132
00133
00134 test_rel( fors_std_star_dist_arcsec(s, t), sqrt(2)*shift_arcsecs, 0.01 );
00135
00136 fors_std_star_delete(&s);
00137 fors_std_star_delete(&t);
00138 }
00139
00140 return;
00141 }
00142
00146 int main(void)
00147 {
00148 TEST_INIT;
00149
00150
00151 test_new();
00152
00153 test_new();
00154
00155
00156 test_dist();
00157
00158 TEST_END;
00159 }
00160