31 #include "muse_postproc.h"
32 #include "muse_instrument.h"
34 #include "muse_astro.h"
36 #include "muse_flux.h"
37 #include "muse_imagelist.h"
38 #include "muse_pfits.h"
39 #include "muse_utils.h"
70 case MUSE_POSTPROC_SCIPOST:
71 case MUSE_POSTPROC_STANDARD:
72 case MUSE_POSTPROC_ASTROMETRY:
76 cpl_msg_error(__func__,
"No such setup known: %d", aType);
77 cpl_error_set(__func__, CPL_ERROR_ILLEGAL_INPUT);
101 cpl_propertylist_delete(aProp->
wcs);
129 if (!strncmp(aResampleString,
"nearest", 8)) {
132 if (!strncmp(aResampleString,
"linear", 7)) {
135 if (!strncmp(aResampleString,
"quadratic", 10)) {
138 if (!strncmp(aResampleString,
"renka", 6)) {
141 if (!strncmp(aResampleString,
"drizzle", 8)) {
144 if (!strncmp(aResampleString,
"lanczos", 8)) {
170 if (!strncmp(aCRTypeString,
"iraf", 5)) {
173 if (!strncmp(aCRTypeString,
"mean", 5)) {
176 if (!strncmp(aCRTypeString,
"median", 7)) {
201 if (!strncmp(aFormatString,
"Cube", 5)) {
204 if (!strncmp(aFormatString,
"Euro3D", 7)) {
207 if (!strncmp(aFormatString,
"xCube", 6)) {
210 if (!strncmp(aFormatString,
"xEuro3D", 8)) {
235 if (!strncmp(aWeightString,
"exptime", 8)) {
238 if (!strncmp(aWeightString,
"fwhm", 5)) {
267 const cpl_frame *aFrame,
float aWarnLimit)
269 cpl_ensure(aHeader && aFrame, CPL_ERROR_NULL_INPUT, NULL);
270 cpl_errorstate state = cpl_errorstate_get();
273 cpl_ensure(cpl_errorstate_is_equal(state), CPL_ERROR_DATA_NOT_FOUND, NULL);
274 cpl_msg_debug(__func__,
"reference coordinates: RA = %e deg, DEC =%e deg",
277 const char *fn = cpl_frame_get_filename(aFrame);
278 cpl_propertylist *header;
279 double dmin = FLT_MAX;
280 int iext, inearest = -1, next = cpl_fits_count_extensions(fn);
281 for (iext = 1; iext <= next; iext++) {
282 header = cpl_propertylist_load(fn, iext);
283 const char *extname = cpl_propertylist_get_string(header,
"EXTNAME");
287 cpl_msg_debug(__func__,
"extension %d [%s]: RA = %e deg, DEC = %e deg --> "
288 "d = %e deg", iext, extname, ra, dec, d);
293 cpl_propertylist_delete(header);
296 if (dmin * 3600. > aWarnLimit) {
297 cpl_msg_warning(__func__,
"Distance of nearest reference table to observed "
298 "position is %.2f arcmin!", dmin * 60.);
300 header = cpl_propertylist_load(fn, inearest);
301 const char *extname = cpl_propertylist_get_string(header,
"EXTNAME");
302 cpl_msg_info(__func__,
"Loading \"%s[%s]\" (distance %.1f arcsec)", fn,
303 extname, dmin * 3600.);
304 cpl_propertylist_delete(header);
305 cpl_table *table = cpl_table_load(fn, inearest, 1);
352 cpl_ensure(aProp && aProp->
exposures, CPL_ERROR_NULL_INPUT, NULL);
353 cpl_ensure((
int)aIndex < cpl_table_get_nrow(aProp->
exposures),
354 CPL_ERROR_ILLEGAL_INPUT, NULL);
355 cpl_msg_info(__func__,
"Starting to process exposure %d (DATE-OBS=%s)",
356 aIndex + 1, cpl_table_get_string(aProp->
exposures,
"DATE-OBS",
358 cpl_ensure(aProp->
exposures, CPL_ERROR_NULL_INPUT, NULL);
360 cpl_table *exposure = cpl_table_extract(aProp->
exposures, aIndex, 1);
364 cpl_table_delete(exposure);
369 cpl_propertylist_erase_regexp(pt->
header,
"ESO QC ", 0);
372 cpl_error_code rc = CPL_ERROR_NONE;
373 if (aProp->
type != MUSE_POSTPROC_STANDARD) {
377 cpl_msg_debug(__func__,
"Flux calibration returned rc=%d: %s", rc,
378 rc != CPL_ERROR_NONE ? cpl_error_get_message_default(rc) :
"");
380 cpl_msg_info(__func__,
"Skipping flux calibration (no %s curve)",
381 MUSE_TAG_STD_RESPONSE);
385 if (aProp->
skymethod == MUSE_POSTPROC_SKYMETHOD_MODEL && aProp->
sky) {
389 cpl_table_select_all(sky_pt->
table);
393 cpl_msg_info(__func__,
"Intermediate resampling to produce white-light image"
394 " for sky-spectrum creation:");
395 cpl_msg_indent_more();
402 cpl_msg_indent_less();
407 cpl_table_select_all(sky_pt->
table);
413 double lambda_low = cpl_array_get_min(lambda);
414 double lambda_high = cpl_array_get_max(lambda);
420 cpl_errorstate prestate = cpl_errorstate_get();
422 if (!cpl_errorstate_is_equal(prestate)) {
423 cpl_errorstate_dump(prestate, CPL_FALSE, NULL);
424 cpl_errorstate_set(prestate);
427 cpl_table_delete(aProp->
sky->
lines);
429 master->
lines = NULL;
437 cpl_table_name_column(aProp->
sky->
continuum,
"data",
"flux");
441 cpl_array_unwrap(lambda);
442 cpl_array_unwrap(data);
443 cpl_array_unwrap(stat);
445 cpl_table_delete(spectrum);
448 cpl_table_delete(fwhite);
453 if (((aProp->
skymethod == MUSE_POSTPROC_SKYMETHOD_NONE) ||
454 (aProp->
skymethod == MUSE_POSTPROC_SKYMETHOD_MODEL)) &&
456 cpl_msg_debug(__func__,
"doing sky subtraction by spectrum modeling");
459 if (aProp->
skymethod == MUSE_POSTPROC_SKYMETHOD_ROWBYROW) {
461 cpl_msg_debug(__func__,
"doing sky subtraction using row-by-row fitting");
465 #pragma omp parallel for default(none) \
466 shared(aProp, list, n)
467 for (k = 0; k < n; k++) {
478 cpl_boolean labdata = CPL_FALSE;
479 cpl_errorstate prestate = cpl_errorstate_get();
483 if (!cpl_errorstate_is_equal(prestate) || airmass < 1.) {
484 cpl_msg_warning(__func__,
"This seems to be lab data (RA=%f DEC=%f, "
485 "airmass=%f), not doing any DAR correction!", ra, dec,
487 cpl_errorstate_dump(prestate, CPL_FALSE, NULL);
488 cpl_errorstate_set(prestate);
492 cpl_msg_debug(__func__,
"WFM detected: starting DAR correction");
494 cpl_msg_debug(__func__,
"DAR correction returned rc=%d: %s", rc,
495 rc != CPL_ERROR_NONE ? cpl_error_get_message() :
"");
497 if (aProp->
darcheck != MUSE_POSTPROC_DARCHECK_NONE) {
498 cpl_boolean dorefine = aProp->
darcheck == MUSE_POSTPROC_DARCHECK_CORRECT;
499 cpl_msg_info(__func__,
"Carrying out DAR %s", dorefine ?
"correction" :
"check");
502 if (rc != CPL_ERROR_NONE) {
503 cpl_msg_warning(__func__,
"Maximum detected shift %f\'\' (rc = %d: %s)",
504 maxshift, rc, cpl_error_get_message());
506 cpl_msg_info(__func__,
"Maximum detected shift %f\'\'", maxshift);
512 if (aProp->
type == MUSE_POSTPROC_STANDARD) {
516 cpl_msg_error(__func__,
"Required input %s could not be loaded!",
517 MUSE_TAG_STD_FLUX_TABLE);
521 cpl_msg_error(__func__,
"%s does not have a recognized format!",
522 MUSE_TAG_STD_FLUX_TABLE);
526 prestate = cpl_errorstate_get();
529 if (flux->intimage) {
530 cpl_msg_debug(__func__,
"Flux integration found %"CPL_SIZE_FORMAT
" stars",
531 cpl_image_get_size_y(flux->intimage->
data));
535 cpl_msg_warning(__func__,
"Invalid airmass derived (%.3e), resetting to "
541 cpl_table_delete(reftable);
545 if (!cpl_errorstate_is_equal(prestate)) {
546 cpl_msg_warning(__func__,
"The following errors happened while computing "
547 "the flux calibration (rc = %d/%s):", rc,
548 cpl_error_get_message_default(rc));
555 if (aProp->
type == MUSE_POSTPROC_ASTROMETRY) {
558 prestate = cpl_errorstate_get();
561 wcs->crpix1 = aProp->crpix1;
562 wcs->crpix2 = aProp->
crpix2;
566 cpl_table_delete(reftable);
567 cpl_msg_debug(__func__,
"Solving astrometry (initial radius %.1f pix, "
568 "initial relative accuracy %.1f, %d iterations with rejection"
569 " sigma %.2f) returned rc=%d: %s", aProp->
radius,
571 rc, rc != CPL_ERROR_NONE ? cpl_error_get_message() :
"");
574 if (!cpl_errorstate_is_equal(prestate)) {
575 cpl_msg_warning(__func__,
"The following errors happened while computing "
576 "the astrometric solution (rc = %d/%s):", rc,
577 cpl_error_get_message());
584 cpl_msg_debug(__func__,
"Astrometry correction returned rc=%d: %s", rc,
585 rc != CPL_ERROR_NONE ? cpl_error_get_message() :
"");
612 cpl_ensure(aProcessing, CPL_ERROR_NULL_INPUT, NULL);
615 MUSE_TAG_OUTPUT_WCS, 0, CPL_FALSE);
616 if (!fwcs || cpl_frameset_get_size(fwcs) <= 0) {
618 cpl_frameset_delete(fwcs);
621 cpl_frame *frame = cpl_frameset_get_position(fwcs, 0);
622 const char *fn = cpl_frame_get_filename(frame);
623 cpl_propertylist *header = NULL;
624 int iext, next = cpl_fits_count_extensions(fn);
625 for (iext = 0; iext <= next; iext++) {
626 header = cpl_propertylist_load(fn, iext);
627 cpl_errorstate es = cpl_errorstate_get();
628 cpl_wcs *wcs = cpl_wcs_new_from_propertylist(header);
629 if (!cpl_errorstate_is_equal(es)) {
630 cpl_errorstate_set(es);
633 cpl_propertylist_delete(header);
638 int naxis = cpl_wcs_get_image_naxis(wcs);
639 cpl_boolean valid = naxis == 2 || naxis == 3;
641 const cpl_array *ctypes = cpl_wcs_get_ctype(wcs);
642 if (valid && cpl_array_get_string(ctypes, 0)) {
643 valid = valid && !strncmp(cpl_array_get_string(ctypes, 0),
"RA---TAN", 9);
645 if (valid && cpl_array_get_string(ctypes, 1)) {
646 valid = valid && !strncmp(cpl_array_get_string(ctypes, 1),
"DEC--TAN", 9);
649 if (valid && cpl_array_get_string(ctypes, 2)) {
650 const char *ctype3 = cpl_array_get_string(ctypes, 2);
652 && (!strncmp(ctype3,
"AWAV", 5) || !strncmp(ctype3,
"AWAV-LOG", 9));
656 cpl_propertylist *pc = cpl_propertylist_new();
657 cpl_propertylist_copy_property_regexp(pc, header,
"^PC[0-9]+_[0-9]+", 0);
658 valid = cpl_propertylist_get_size(pc) == 0;
659 cpl_propertylist_delete(pc);
663 cpl_msg_debug(__func__,
"Apparently valid header %s found in extension %d"
664 " of \"%s\"", MUSE_TAG_OUTPUT_WCS, iext, fn);
668 cpl_propertylist_delete(header);
672 cpl_msg_warning(__func__,
"No valid headers for %s found in \"%s\"",
673 MUSE_TAG_OUTPUT_WCS, fn);
675 cpl_frameset_delete(fwcs);
705 cpl_ensure_code(aProcessing && aPixtable && aParams, CPL_ERROR_NULL_INPUT);
715 cpl_msg_info(__func__,
"Resampling to final cube follows, output format "
717 cpl_msg_indent_more();
719 cpl_msg_indent_less();
720 cpl_ensure_code(e3d, cpl_error_get_code());
723 cpl_msg_info(__func__,
"Resampling to final cube follows, output format "
725 cpl_msg_indent_more();
727 cpl_msg_indent_less();
728 cpl_ensure_code(fits, cpl_error_get_code());
734 int i, ipos = 0, nfilters = cpl_array_get_size(filters);
735 for (i = 0; i < nfilters; i++) {
738 cpl_array_get_string(filters, i));
748 if (getenv(
"MUSE_COLLAPSE_PIXTABLE") &&
749 atoi(getenv(
"MUSE_COLLAPSE_PIXTABLE")) > 0) {
758 cpl_table_delete(filter);
764 ((
muse_datacube *)cube)->recnames = cpl_array_new(0, CPL_TYPE_STRING);
769 cpl_array_set_size(((
muse_datacube *)cube)->recnames, ipos+1);
770 cpl_array_set_string(((
muse_datacube *)cube)->recnames, ipos,
771 cpl_array_get_string(filters, i));
775 cpl_array_get_string(filters, i));
776 cpl_propertylist_update_string(fov->
header, MUSE_HDR_FILTER,
777 cpl_array_get_string(filters, i));
783 cpl_array_delete(filters);
786 cpl_error_code rc = CPL_ERROR_NONE;
830 cpl_ensure_code(aProcessing && aCube, CPL_ERROR_NULL_INPUT);
833 char prefix[KEYWORD_LENGTH] =
"";
834 if (!strncmp(aProcessing->
recipeName,
"muse_scipost", 13)) {
835 strncpy(prefix, QC_POST_PREFIX_SCIPOST, KEYWORD_LENGTH);
836 }
else if (!strncmp(aProcessing->
recipeName,
"muse_exp_combine", 17)) {
837 strncpy(prefix, QC_POST_PREFIX_EXPCOMBINE, KEYWORD_LENGTH);
838 }
else if (!strncmp(aProcessing->
recipeName,
"muse_standard", 14)) {
839 strncpy(prefix, QC_POST_PREFIX_STANDARD, KEYWORD_LENGTH);
840 }
else if (!strncmp(aProcessing->
recipeName,
"muse_astrometry", 16)) {
841 strncpy(prefix, QC_POST_PREFIX_ASTROMETRY, KEYWORD_LENGTH);
843 cpl_msg_info(__func__,
"Recipe \"%s\" found, not generating QC1 keywords",
845 return CPL_ERROR_NONE;
850 int plane = cpl_imagelist_get_size(aCube->
data) / 2;
851 cpl_image *cim = cpl_imagelist_get(aCube->
data, plane);
852 double dsigmas[] = { 5., 4., 3. };
853 int ndsigmas =
sizeof(dsigmas) /
sizeof(
double);
854 cpl_vector *vsigmas = cpl_vector_wrap(ndsigmas, dsigmas);
855 cpl_size isigma = -1;
856 cpl_errorstate prestate = cpl_errorstate_get();
857 cpl_apertures *apertures = cpl_apertures_extract(cim, vsigmas, &isigma);
858 cpl_vector_unwrap(vsigmas);
859 if (!apertures || !cpl_errorstate_is_equal(prestate)) {
861 char keyword[KEYWORD_LENGTH];
862 snprintf(keyword, KEYWORD_LENGTH, QC_POST_POSX, prefix, 0);
863 cpl_propertylist_update_float(aCube->
header, keyword, -1.);
864 snprintf(keyword, KEYWORD_LENGTH, QC_POST_POSY, prefix, 0);
865 cpl_propertylist_update_float(aCube->
header, keyword, -1.);
866 snprintf(keyword, KEYWORD_LENGTH, QC_POST_FWHMX, prefix, 0);
867 cpl_propertylist_update_float(aCube->
header, keyword, -1.);
868 snprintf(keyword, KEYWORD_LENGTH, QC_POST_FWHMY, prefix, 0);
869 cpl_propertylist_update_float(aCube->
header, keyword, -1.);
871 cpl_errorstate_set(prestate);
872 cpl_msg_warning(__func__,
"No sources found for FWHM measurement down to "
873 "%.1f sigma limit on plane %d, QC parameters will not "
874 "contain useful information", dsigmas[ndsigmas-1], plane+1);
875 return CPL_ERROR_DATA_NOT_FOUND;
877 int ndet = cpl_apertures_get_size(apertures);
878 cpl_msg_info(__func__,
"Computing FWHM QC parameters for %d source%s found "
879 "down to the %.1f sigma threshold on plane %d", ndet,
880 ndet == 1 ?
"" :
"s", dsigmas[isigma], plane + 1);
884 double cd11 = kMuseSpaxelSizeX_WFM, cd12 = 0., cd21 = 0.,
885 cd22 = kMuseSpaxelSizeY_WFM;
886 cpl_errorstate es = cpl_errorstate_get();
887 cpl_wcs *wcs = cpl_wcs_new_from_propertylist(aCube->
header);
888 if (!cpl_errorstate_is_equal(es)) {
889 cpl_errorstate_set(es);
892 !strncasecmp(cpl_propertylist_get_string(aCube->
header,
"CTYPE1"),
894 cpl_msg_debug(__func__,
"QC1 FWHM parameter estimation (%d sources): "
895 "simple conversion to arcsec (CTYPE=%s/%s)!", ndet,
896 cpl_propertylist_get_string(aCube->
header,
"CTYPE1"),
897 cpl_propertylist_get_string(aCube->
header,
"CTYPE2"));
899 cd11 = kMuseSpaxelSizeX_WFM;
900 cd22 = kMuseSpaxelSizeY_WFM;
903 const cpl_matrix *cd = cpl_wcs_get_cd(wcs);
905 cd11 = fabs(cpl_matrix_get(cd, 0, 0)) * 3600.,
906 cd12 = fabs(cpl_matrix_get(cd, 0, 1)) * 3600.,
907 cd21 = fabs(cpl_matrix_get(cd, 1, 0)) * 3600.,
908 cd22 = fabs(cpl_matrix_get(cd, 1, 1)) * 3600.;
909 cpl_msg_debug(__func__,
"QC1 FWHM parameter estimation (%d sources): "
910 "full conversion to arcsec (CD=%f,%f,%f,%f)", ndet,
911 cd11, cd12, cd21, cd22);
917 printf(
"index RA_FWHM DEC_FWHM\n");
920 for (n = 1; n <= ndet; n++) {
921 cpl_size xcen = lround(cpl_apertures_get_centroid_x(apertures, n)),
922 ycen = lround(cpl_apertures_get_centroid_y(apertures, n));
924 cpl_image_get_fwhm(cim, xcen, ycen, &x, &y);
927 x = cd11 * x + cd12 * y;
928 y = cd22 * y + cd21 * x;
930 printf(
"%4d %f %f\n", n, x, y);
934 char keyword[KEYWORD_LENGTH];
935 snprintf(keyword, KEYWORD_LENGTH, QC_POST_POSX, prefix, n);
936 cpl_propertylist_update_float(aCube->
header, keyword, xcen);
937 snprintf(keyword, KEYWORD_LENGTH, QC_POST_POSY, prefix, n);
938 cpl_propertylist_update_float(aCube->
header, keyword, ycen);
939 snprintf(keyword, KEYWORD_LENGTH, QC_POST_FWHMX, prefix, n);
940 cpl_propertylist_update_float(aCube->
header, keyword, x);
941 snprintf(keyword, KEYWORD_LENGTH, QC_POST_FWHMY, prefix, n);
942 cpl_propertylist_update_float(aCube->
header, keyword, y);
947 cpl_apertures_delete(apertures);
949 return CPL_ERROR_NONE;
Structure definition of a MUSE datacube.
cpl_propertylist * muse_postproc_cube_load_output_wcs(muse_processing *aProcessing)
Find a file with a usable output WCS in the input frameset.
Structure definition for a collection of muse_images.
muse_postproc_properties * muse_postproc_properties_new(muse_postproc_type aType)
Create a post-processing properties object.
void muse_image_delete(muse_image *aImage)
Deallocate memory associated to a muse_image object.
muse_pixtable * muse_pixtable_duplicate(muse_pixtable *aPixtable)
Make a copy of the pixtanle.
muse_wcs_centroid_type centroid
double muse_pfits_get_ra(const cpl_propertylist *aHeaders)
find out the right ascension
cpl_image * data
the data extension
muse_xcombine_types muse_postproc_get_weight_type(const char *aWeightString)
Select correct weighting type for weight string.
cpl_error_code muse_dar_correct(muse_pixtable *aPixtable, double aLambdaRef)
Correct the pixel coordinates of all pixels of a given pixel table for differential atmospheric refra...
cpl_error_code muse_pixtable_and_selected_mask(muse_pixtable *aPixtable, muse_mask *aMask)
Select all pixels where the (x,y) positions are enabled in the given mask.
Structure to hold the MASTER SKY result.
muse_resampling_crstats_type muse_postproc_get_cr_type(const char *aCRTypeString)
Select correct cosmic ray rejection type for crtype string.
cpl_error_code muse_sky_subtract_rowbyrow(muse_image *, cpl_table *, float, unsigned int)
Subtract the sky row-by-row from a CCD-based image.
void muse_datacube_delete(muse_datacube *aCube)
Deallocate memory associated to a muse_datacube object.
void muse_imagelist_delete(muse_imagelist *aList)
Free the memory of the MUSE image list.
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_dar_check(muse_pixtable *aPixtable, double *aMaxShift, cpl_boolean aCorrect, muse_datacube **aCube)
check that the continuum of objects in the frame is well-aligned perpendicular to the spatial axis...
cpl_table * muse_postproc_load_nearest(const cpl_propertylist *aHeader, const cpl_frame *aFrame, float aWarnLimit)
Load the calibration from a multi-table FITS file that is nearest on the sky.
cpl_error_code muse_flux_reference_table_check(cpl_table *aTable)
Check and/or adapt the standard flux reference table format.
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.
muse_mask * muse_sky_create_skymask(muse_image *, double)
Select spaxels to be considered as sky.
WCS object to store data needed while computing the astrometric solution.
Structure definition of MUSE three extension FITS file.
muse_flux_object * muse_flux_object_new(void)
Allocate memory for a new muse_flux_object object.
cpl_error_code muse_postproc_cube_resample_and_collapse(muse_processing *aProcessing, muse_pixtable *aPixtable, muse_cube_type aFormat, muse_resampling_params *aParams, const char *aFilter)
High level function to resample to a datacube and collapse that to an image of the field of view and ...
cpl_table * table
The pixel table.
muse_flux_profile_type profile
muse_postproc_skymethod skymethod
cpl_propertylist * header
the FITS header
cpl_table * muse_table_load_filter(muse_processing *aProcessing, const char *aFilterName)
Load a table for a given filter name.
unsigned int muse_imagelist_get_size(muse_imagelist *aList)
Return the number of stored images.
muse_imagelist * muse_pixtable_to_imagelist(muse_pixtable *aPixtable)
Project a pixel table with data from one IFU back onto its image.
cpl_error_code muse_wcs_project_tan(muse_pixtable *aPixtable, const cpl_propertylist *aWCS)
Carry out a gnomonic projection of a pixel table into native spherical coordinates.
muse_resampling_crstats_type crtype
cpl_error_code muse_flux_get_telluric_table(muse_flux_object *aFluxObj)
Get the table of the telluric correction.
cpl_array * muse_cplarray_new_from_delimited_string(const char *aString, const char *aDelim)
Convert a delimited string into an array of strings.
cpl_error_code muse_flux_get_response_table(muse_flux_object *aFluxObj)
Get the table of the standard star response function.
Structure definition of MUSE pixel table.
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.
muse_cube_type muse_postproc_get_cube_format(const char *aFormatString)
Select correct cube format for format string.
muse_image * muse_imagelist_get(muse_imagelist *aList, unsigned int aIdx)
Get the muse_image of given list index.
cpl_array * muse_cpltable_extract_column(cpl_table *aTable, const char *aColumn)
Create an array from a section of a column.
cpl_table * lines
Table of Atmospheric emission lines and their intensities.
muse_resampling_crstats_type
Cosmic ray rejection statistics type.
muse_resampling_params * muse_resampling_params_new(muse_resampling_type aMethod)
Create the resampling parameters structure.
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.
cpl_error_code muse_wcs_solve(muse_wcs_object *aWCSObj, cpl_table *aReference, float aRadius, float aFAccuracy, int aIter, float aThresh)
Find the world coordinate solution for a given field using coordinates of detected sources and coordi...
muse_wcs_object * muse_wcs_object_new(void)
Allocate memory for a new muse_wcs_object object.
Structure definition of the post-processing properties.
void muse_cplerrorstate_dump_some(unsigned aCurrent, unsigned aFirst, unsigned aLast)
Dump some CPL errors.
void muse_euro3dcube_delete(muse_euro3dcube *aEuro3D)
Deallocate memory associated to a muse_euro3dcube object.
void muse_postproc_properties_delete(muse_postproc_properties *aProp)
Free memory taken by a post-processing properties object and all its components.
cpl_error_code muse_flux_calibrate(muse_pixtable *aPixtable, const cpl_table *aResponse, const cpl_table *aExtinction, const cpl_table *aTelluric)
Convert the input pixel table from counts to fluxes.
cpl_imagelist * data
the cube containing the actual data values
cpl_error_code muse_sky_lines_set_range(cpl_table *, double, double)
Limit the lines in the table to a wavelength range.
Structure definition of a Euro3D datacube.
double muse_pfits_get_dec(const cpl_propertylist *aHeaders)
find out the declination
void muse_processing_append_used(muse_processing *aProcessing, cpl_frame *aFrame, cpl_frame_group aGroup, int aDuplicate)
Add a frame to the set of used frames.
void muse_sky_master_delete(muse_sky_master *)
Delete a MASTER SKY structure.
muse_datacube * muse_resampling_cube(muse_pixtable *aPixtable, muse_resampling_params *aParams, muse_pixgrid **aPixgrid)
Resample a pixel table onto a regular grid structure representing a FITS NAXIS=3 datacube.
muse_sky_master * muse_sky_master_fit(const cpl_array *, const cpl_array *, const cpl_array *, const cpl_table *)
Fit all entries of the pixel table to the master sky.
muse_image * muse_resampling_collapse_pixgrid(muse_pixtable *aPixtable, muse_pixgrid *aPixgrid, muse_datacube *aCube, cpl_table *aFilter, muse_resampling_params *aParams)
Integrate a pixel table / pixel grid along the wavelength direction.
void muse_pixgrid_delete(muse_pixgrid *aPixels)
Delete a pixgrid and remove its memory.
muse_postproc_type
Type of per-exposure processing to run.
cpl_error_code muse_flux_integrate_std(muse_pixtable *aPixtable, muse_flux_profile_type aProfile, muse_flux_object *aFluxObj)
Integrate the flux of the standard star(s) in the field over all wavelengths.
cpl_propertylist * header
the FITS header
int muse_processing_save_image(muse_processing *aProcessing, int aIFU, muse_image *aImage, const char *aTag)
Save a computed MUSE image to disk.
muse_pixtable * muse_pixtable_load_merge_channels(cpl_table *aExposureList, double aLambdaMin, double aLambdaMax)
Load and merge the pixel tables of the 24 MUSE sub-fields.
cpl_error_code muse_flux_response_compute(muse_flux_object *aFluxObj, double aAirmass, const cpl_table *aReference, const cpl_table *aTellBands, const cpl_table *aExtinct)
Compare measured flux distribution over wavelength with calibrated stellar fluxes and derive instrume...
muse_resampling_type muse_postproc_get_resampling_type(const char *aResampleString)
Select correct resampling type for resample string.
muse_image * muse_euro3dcube_collapse(muse_euro3dcube *aEuro3D, cpl_table *aFilter)
Integrate a Euro3D datacube along the wavelength direction.
cpl_error_code muse_pixtable_from_imagelist(muse_pixtable *aPixtable, muse_imagelist *aList)
Get pixel table values back from a per-IFU imagelist.
Handling of "mask" files.
muse_imagelist * muse_imagelist_new(void)
Create a new (empty) MUSE image list.
muse_resampling_type
Resampling types.
cpl_error_code muse_sky_subtract_rowbyrow_mask(muse_image *, cpl_table *)
Prepare an (object) mask for the sky row-by-row fitting.
muse_euro3dcube * muse_resampling_euro3d(muse_pixtable *aPixtable, muse_resampling_params *aParams)
Resample a pixel table onto a regular grid structure representing a Euro3D format file...
void muse_resampling_params_delete(muse_resampling_params *aParams)
Delete a resampling parameters structure.
void muse_mask_delete(muse_mask *aMask)
Deallocate memory associated to a muse_mask object.
void * muse_postproc_process_exposure(muse_postproc_properties *aProp, unsigned int aIndex)
Merge and process pixel tables from one exposure.
cpl_table * continuum
Continuum flux table
cpl_table * muse_resampling_spectrum(muse_pixtable *aPixtable, double aBinwidth)
Resample the selected pixels of a pixel table into a spectrum.
cpl_frameset * muse_frameset_find(const cpl_frameset *aFrames, const char *aTag, unsigned char aIFU, cpl_boolean aInvert)
return frameset containing data from an IFU/channel with a certain tag
muse_sky_params skymodel_params
cpl_frameset * inputFrames
void muse_pixtable_delete(muse_pixtable *aPixtable)
Deallocate memory associated to a pixel table object.
muse_postproc_darcheck darcheck
muse_xcombine_types
Xposure combination types.
cpl_error_code muse_imagelist_set(muse_imagelist *aList, muse_image *aImage, unsigned int aIdx)
Set the muse_image of given list index.
cpl_error_code muse_sky_subtract_pixtable(muse_pixtable *a, muse_sky_master *, muse_lsf_params **)
Subtract the sky spectrum from the "data" column of a pixel table.
double muse_astro_angular_distance(double aRA1, double aDEC1, double aRA2, double aDEC2)
Compute angular distance in the sky between two positions.
muse_lsf_params ** lsf
LSF parameter for the resampled spectrum.
muse_ins_mode muse_pfits_get_mode(const cpl_propertylist *aHeaders)
find out the observation mode
cpl_error_code muse_utils_copy_modified_header(cpl_propertylist *aH1, cpl_propertylist *aH2, const char *aKeyword, const char *aString)
Copy a modified header keyword from one header to another.
cpl_error_code muse_wcs_locate_sources(muse_pixtable *aPixtable, float aSigma, muse_wcs_centroid_type aCentroid, muse_wcs_object *aWCSObj)
Determine the centers of stars on an astrometric exposure.
double muse_astro_airmass(cpl_propertylist *aHeader)
Derive the effective airmass of an observation from information in a FITS header. ...
cpl_propertylist * header
The FITS header.