00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025
00026
00027
00028
00029 #include <muse.h>
00030 #include "muse_scipost_apply_astrometry_z.h"
00031
00032
00033
00034
00035
00036
00045
00046 int
00047 muse_scipost_apply_astrometry_compute(muse_processing *aProcessing,
00048 muse_scipost_apply_astrometry_params_t *aParams)
00049 {
00050 UNUSED_ARGUMENT(aParams);
00051
00052 cpl_propertylist *wcs = muse_propertylist_load(aProcessing,
00053 MUSE_TAG_ASTROMETRY_WCS);
00054
00055 cpl_frameset *inframes = muse_frameset_find_tags(aProcessing->inframes,
00056 aProcessing->intags, 0,
00057 CPL_FALSE);
00058 cpl_error_code rc = CPL_ERROR_NONE;
00059 cpl_size iframe, nframes = cpl_frameset_get_size(inframes);
00060 for (iframe = 0; iframe < nframes; iframe++) {
00061 cpl_frame *frame = cpl_frameset_get_position(inframes, iframe);
00062 const char *fn = cpl_frame_get_filename(frame);
00063 muse_pixtable *pixtable = muse_pixtable_load_restricted_wavelength(fn,
00064 aParams->lambdamin,
00065 aParams->lambdamax);
00066 if (pixtable == NULL) {
00067 cpl_msg_error(__func__, "NULL pixel table for %s", fn);
00068 rc = CPL_ERROR_NULL_INPUT;
00069 break;
00070 }
00071
00072 cpl_propertylist_erase_regexp(pixtable->header, "ESO QC ", 0);
00073 rc = muse_wcs_project_tan(pixtable, wcs);
00074 if (rc != CPL_ERROR_NONE) {
00075 cpl_msg_error(__func__, "while muse_wcs_project_tan(%s)",
00076 cpl_frame_get_filename(frame));
00077 muse_pixtable_delete(pixtable);
00078 break;
00079 }
00080 muse_processing_save_table(aProcessing, 0, pixtable, NULL,
00081 MUSE_TAG_PIXTABLE_REDUCED,
00082 MUSE_TABLE_TYPE_PIXTABLE);
00083 muse_pixtable_delete(pixtable);
00084 }
00085 cpl_frameset_delete(inframes);
00086 cpl_propertylist_delete(wcs);
00087
00088 return rc;
00089 }