32 #include "muse_standard_z.h"
61 prop->
darcheck = MUSE_POSTPROC_DARCHECK_NONE;
62 if (aParams->
darcheck == MUSE_STANDARD_PARAM_DARCHECK_CHECK) {
63 prop->
darcheck = MUSE_POSTPROC_DARCHECK_CHECK;
64 }
else if (aParams->
darcheck == MUSE_STANDARD_PARAM_DARCHECK_CORRECT) {
65 prop->
darcheck = MUSE_POSTPROC_DARCHECK_CORRECT;
69 if (aParams->
profile == MUSE_STANDARD_PARAM_PROFILE_MOFFAT) {
71 }
else if (aParams->
profile == MUSE_STANDARD_PARAM_PROFILE_CIRCLE) {
73 }
else if (aParams->
profile == MUSE_STANDARD_PARAM_PROFILE_SQUARE) {
75 }
else if (aParams->
profile != MUSE_STANDARD_PARAM_PROFILE_GAUSSIAN) {
76 cpl_msg_error(__func__,
"unknown profile \"%s\"", aParams->
profile_s);
82 MUSE_TAG_STD_FLUX_TABLE, 0);
84 cpl_msg_error(__func__,
"Required input %s not found in input files",
85 MUSE_TAG_STD_FLUX_TABLE);
86 cpl_error_set_message(__func__, CPL_ERROR_NULL_INPUT,
87 MUSE_TAG_STD_FLUX_TABLE
" missing");
92 if (aParams->
select == MUSE_STANDARD_PARAM_SELECT_DISTANCE) {
94 }
else if (aParams->
select != MUSE_STANDARD_PARAM_SELECT_FLUX) {
95 cpl_msg_error(__func__,
"unknown selection \"%s\"", aParams->
select_s);
100 if (aParams->
smooth == MUSE_STANDARD_PARAM_SMOOTH_MEDIAN) {
102 }
else if (aParams->
smooth == MUSE_STANDARD_PARAM_SMOOTH_NONE) {
104 }
else if (aParams->
smooth != MUSE_STANDARD_PARAM_SMOOTH_PPOLY) {
105 cpl_msg_error(__func__,
"unknown smoothing \"%s\"", aParams->
smooth_s);
113 cpl_msg_debug(__func__,
"%s could not be found or loaded, using defaults",
120 cpl_msg_error(__func__,
"No standard star exposures found in input!");
124 int nexposures = cpl_table_get_nrow(prop->
exposures);
129 for (i = 0; i < nexposures; i++) {
133 for (i2 = 0; i2 <= i; i2++) {
145 cpl_error_code rc = CPL_ERROR_NONE;
148 for (i = 0; i < nexposures; i++) {
149 int ifilt, ipos = 0, nfilt = cpl_array_get_size(filters);
150 for (ifilt = 0; ifilt < nfilt; ifilt++) {
153 cpl_array_get_string(filters, ifilt));
158 if (!fluxobjs[i]->cube->recimages) {
160 fluxobjs[i]->
cube->
recnames = cpl_array_new(0, CPL_TYPE_STRING);
163 cpl_array_set_size(fluxobjs[i]->cube->recnames, ipos+1);
164 cpl_array_set_string(fluxobjs[i]->cube->recnames, ipos,
165 cpl_array_get_string(filters, ifilt));
166 cpl_table_delete(filter);
175 MUSE_TAG_STD_INTIMAGE);
178 cpl_propertylist *header = cpl_propertylist_duplicate(fluxobjs[i]->cube->header);
179 cpl_propertylist_erase_regexp(header,
"^NAXIS|^EXPTIME$|"MUSE_WCS_KEYS, 0);
180 char *objorig = cpl_strdup(cpl_propertylist_get_string(header,
"OBJECT"));
181 char *
object = cpl_sprintf(
"Response curve (%s)", objorig);
182 cpl_propertylist_update_string(header,
"OBJECT",
object);
186 if (rc != CPL_ERROR_NONE) {
188 cpl_propertylist_delete(header);
189 for ( ; i < nexposures; i++) {
194 object = cpl_sprintf(
"Telluric correction (%s)", objorig);
195 cpl_propertylist_update_string(header,
"OBJECT",
object);
200 cpl_propertylist_delete(header);
202 if (rc != CPL_ERROR_NONE) {
203 for ( ; i < nexposures; i++) {
209 cpl_array_delete(filters);
212 return rc == CPL_ERROR_NONE ? 0 : -1;
muse_postproc_properties * muse_postproc_properties_new(muse_postproc_type aType)
Create a post-processing properties object.
muse_flux_selection_type select
int profile
Type of flux integration to use. "gaussian" and "moffat" use 2D profile fitting, circle and square ar...
muse_image * muse_datacube_collapse(muse_datacube *aCube, cpl_table *aFilter)
Integrate a FITS NAXIS=3 datacube along the wavelength direction.
cpl_error_code muse_postproc_qc_fwhm(muse_processing *aProcessing, muse_datacube *aCube)
Compute QC1 parameters for datacubes and save them in the FITS header.
int select
How to select the star for flux integration, "flux" uses the brightest star in the field...
void * muse_postproc_process_exposure(muse_postproc_properties *aProp, unsigned int aIndex, muse_postproc_sky_outputs *aSkyOut)
Merge and process pixel tables from one exposure.
int smooth
How to smooth the response curve before writing it to disk. "none" does not do any kind of smoothing ...
const char * profile_s
Type of flux integration to use. "gaussian" and "moffat" use 2D profile fitting, circle and square ar...
Structure definition of MUSE three extension FITS file.
const char * select_s
How to select the star for flux integration, "flux" uses the brightest star in the field...
cpl_array * recnames
the reconstructed image filter names
muse_flux_profile_type profile
cpl_table * muse_table_load_filter(muse_processing *aProcessing, const char *aFilterName)
Load a table for a given filter name.
cpl_array * muse_cplarray_new_from_delimited_string(const char *aString, const char *aDelim)
Convert a delimited string into an array of strings.
Flux object to store data needed while computing the flux calibration.
cpl_error_code muse_datacube_convert_dq(muse_datacube *aCube)
Convert the DQ extension of a datacube to NANs in DATA and STAT.
double lambdamin
Cut off the data below this wavelength after loading the pixel table(s).
cpl_error_code muse_processing_save_cube(muse_processing *aProcessing, int aIFU, void *aCube, const char *aTag, muse_cube_type aType)
Save a MUSE datacube to disk.
muse_flux_smooth_type smooth
Structure definition of the post-processing properties.
void muse_postproc_properties_delete(muse_postproc_properties *aProp)
Free memory taken by a post-processing properties object and all its components.
double lambdaref
Reference wavelength used for correction of differential atmospheric refraction. The R-band (peak wav...
double lambdamax
Cut off the data above this wavelength after loading the pixel table(s).
int muse_processing_save_image(muse_processing *aProcessing, int aIFU, muse_image *aImage, const char *aTag)
Save a computed MUSE image to disk.
Structure to hold the parameters of the muse_standard recipe.
muse_imagelist * muse_imagelist_new(void)
Create a new (empty) MUSE image list.
cpl_table * muse_table_load(muse_processing *aProcessing, const char *aTag, unsigned char aIFU)
load a table according to its tag and IFU/channel number
cpl_error_code muse_processing_save_table(muse_processing *aProcessing, int aIFU, void *aTable, cpl_propertylist *aHeader, const char *aTag, muse_table_type aType)
Save a computed table to disk.
int darcheck
Carry out a check of the theoretical DAR correction using source centroiding. If "correct" it will al...
cpl_table * muse_processing_sort_exposures(muse_processing *aProcessing)
Sort input frames (containing lists of pixel table filenames) into different exposures.
muse_postproc_darcheck darcheck
cpl_error_code muse_imagelist_set(muse_imagelist *aList, muse_image *aImage, unsigned int aIdx)
Set the muse_image of given list index.
cpl_frame * muse_frameset_find_master(const cpl_frameset *aFrames, const char *aTag, unsigned char aIFU)
find the master frame according to its CCD number and tag
const char * filter
The filter name(s) to be used for the output field-of-view image. Each name has to correspond to an E...
void muse_flux_object_delete(muse_flux_object *aFluxObj)
Deallocate memory associated to a muse_flux_object.
muse_imagelist * recimages
the reconstructed image data
const char * smooth_s
How to smooth the response curve before writing it to disk. "none" does not do any kind of smoothing ...