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 <string.h>
00030 #include <muse.h>
00031 #include "muse_scipost_correct_rv_z.h"
00032
00033
00034
00035
00036
00037
00046
00047 int
00048 muse_scipost_correct_rv_compute(muse_processing *aProcessing,
00049 muse_scipost_correct_rv_params_t *aParams)
00050 {
00051 muse_rvcorrect_type rvtype = muse_rvcorrect_select_type(aParams->rvcorr_s);
00052 cpl_frameset *inframes = muse_frameset_find_tags(aProcessing->inframes,
00053 aProcessing->intags, 0,
00054 CPL_FALSE);
00055 cpl_error_code rc = CPL_ERROR_NONE;
00056 cpl_size iframe, nframes = cpl_frameset_get_size(inframes);
00057 for (iframe = 0; iframe < nframes; iframe++) {
00058 cpl_frame *frame = cpl_frameset_get_position(inframes, iframe);
00059 const char *fn = cpl_frame_get_filename(frame);
00060 muse_pixtable *pixtable = muse_pixtable_load_restricted_wavelength(fn,
00061 aParams->lambdamin,
00062 aParams->lambdamax);
00063 if (!pixtable) {
00064 cpl_msg_error(__func__, "No pixel table loaded for \"%s\"", fn);
00065 rc = CPL_ERROR_NULL_INPUT;
00066 break;
00067 }
00068 muse_processing_append_used(aProcessing, frame, CPL_FRAME_GROUP_RAW, 1);
00069
00070
00071 cpl_propertylist_erase_regexp(pixtable->header, "ESO QC ", 0);
00072 rc = muse_rvcorrect(pixtable, rvtype);
00073 if (rc != CPL_ERROR_NONE) {
00074 cpl_msg_error(__func__, "Failure while correcting radial-velocities for "
00075 "\"%s\"!", fn);
00076 muse_pixtable_delete(pixtable);
00077 break;
00078 }
00079 muse_processing_save_table(aProcessing, 0, pixtable, NULL,
00080 MUSE_TAG_PIXTABLE_REDUCED,
00081 MUSE_TABLE_TYPE_PIXTABLE);
00082 muse_pixtable_delete(pixtable);
00083 }
00084 cpl_frameset_delete(inframes);
00085
00086 return rc;
00087 }