35 #include "girvcorrection.h"
36 #include "giastrometry.h"
82 cxdouble exptime = 0.;
84 cxdouble equinox = 2000.;
85 cxdouble longitude = 0.;
86 cxdouble latitude = 0.;
87 cxdouble elevation = 0.;
89 cxdouble tel_dec = 0.;
91 const cpl_propertylist* properties = NULL;
93 cpl_table* _fibers = NULL;
96 if ((fibers == NULL) || (spectra == NULL)) {
101 cx_assert(properties != NULL);
108 if (cpl_propertylist_has(properties, GIALIAS_EXPTIME) == FALSE) {
112 exptime = cpl_propertylist_get_double(properties, GIALIAS_EXPTIME);
115 if (cpl_propertylist_has(properties, GIALIAS_MJDOBS) == FALSE) {
125 jd = cpl_propertylist_get_double(properties, GIALIAS_MJDOBS);
126 jd += 2400000.5 + 0.5 * exptime / (24. * 3600.);
130 if (cpl_propertylist_has(properties, GIALIAS_EQUINOX) == FALSE) {
134 equinox = cpl_propertylist_get_double(properties, GIALIAS_EQUINOX);
142 if (cpl_propertylist_has(properties, GIALIAS_TEL_LON) == FALSE) {
152 longitude = -cpl_propertylist_get_double(properties, GIALIAS_TEL_LON);
156 if (cpl_propertylist_has(properties, GIALIAS_TEL_LAT) == FALSE) {
160 latitude = cpl_propertylist_get_double(properties, GIALIAS_TEL_LAT);
163 if (cpl_propertylist_has(properties, GIALIAS_TEL_ELEV) == FALSE) {
167 elevation = cpl_propertylist_get_double(properties, GIALIAS_TEL_ELEV);
175 if (cpl_propertylist_has(properties, GIALIAS_RADEG) == FALSE) {
179 tel_ra = cpl_propertylist_get_double(properties, GIALIAS_RADEG);
182 if (cpl_propertylist_has(properties, GIALIAS_DECDEG) == FALSE) {
186 tel_dec = cpl_propertylist_get_double(properties, GIALIAS_DECDEG);
198 if ((cpl_table_has_column(_fibers,
"RA") == FALSE) ||
199 (cpl_table_has_column(_fibers,
"DEC") == FALSE)) {
203 if (cpl_table_has_column(_fibers,
"RP") == FALSE) {
208 giraffe_error_push();
210 if (cpl_table_has_column(_fibers,
"GCORR") == FALSE) {
211 cpl_table_new_column(_fibers,
"GCORR", CPL_TYPE_DOUBLE);
214 if (cpl_table_has_column(_fibers,
"HCORR") == FALSE) {
215 cpl_table_new_column(_fibers,
"HCORR", CPL_TYPE_DOUBLE);
218 if (cpl_table_has_column(_fibers,
"BCORR") == FALSE) {
219 cpl_table_new_column(_fibers,
"BCORR", CPL_TYPE_DOUBLE);
222 if (cpl_error_get_code() != CPL_ERROR_NONE) {
229 nr = cpl_table_get_nrow(_fibers);
231 for (fiber = 0; fiber < nr; ++fiber) {
233 cxint rp = cpl_table_get_int(_fibers,
"RP", fiber, NULL);
235 GiRvCorrection rv = {0., 0., 0.};
240 register cxdouble ra = 0.;
241 register cxdouble dec = 0.;
258 ra = cpl_table_get_double(_fibers,
"RA", fiber, NULL);
259 dec = cpl_table_get_double(_fibers,
"DEC", fiber, NULL);
271 elevation, ra, dec, equinox);
276 cpl_table_set_double(_fibers,
"GCORR", fiber, rv.gc);
277 cpl_table_set_double(_fibers,
"HCORR", fiber, rv.hc);
278 cpl_table_set_double(_fibers,
"BCORR", fiber, rv.bc);