32 #include "muse_geometry_z.h"
49 muse_geometry_qc_spots(cpl_table *aSpots, cpl_propertylist *aHeader)
51 if (!aSpots || !aHeader) {
54 cpl_msg_debug(__func__,
"Adding QC keywords to %s", MUSE_TAG_SPOTS_TABLE);
57 nexp1 = cpl_table_get_column_min(aSpots,
"image"),
58 nexp2 = cpl_table_get_column_max(aSpots,
"image");
59 for (nexp = nexp1; nexp <= nexp2; nexp++) {
60 cpl_table_unselect_all(aSpots);
61 cpl_table_or_selected_int(aSpots,
"image", CPL_EQUAL_TO, nexp);
62 cpl_table_and_selected_double(aSpots,
"xfwhm", CPL_GREATER_THAN, 0.);
63 cpl_table_and_selected_double(aSpots,
"yfwhm", CPL_GREATER_THAN, 0.);
64 cpl_table_and_selected_double(aSpots,
"flux", CPL_GREATER_THAN, 1000.);
65 cpl_table *table = cpl_table_extract_selected(aSpots);
67 cpl_table_duplicate_column(table,
"fwhm", table,
"xfwhm");
68 cpl_table_add_columns(table,
"fwhm",
"yfwhm");
69 cpl_table_multiply_scalar(table,
"fwhm", 0.5);
70 double mean = cpl_table_get_column_mean(table,
"fwhm"),
71 median = cpl_table_get_column_median(table,
"fwhm"),
72 stdev = cpl_table_get_column_stdev(table,
"fwhm");
73 cpl_table_delete(table);
75 char keyword[KEYWORD_LENGTH];
76 snprintf(keyword, KEYWORD_LENGTH, QC_GEO_EXPk_MEAN, nexp);
77 cpl_propertylist_update_float(aHeader, keyword, mean);
78 snprintf(keyword, KEYWORD_LENGTH, QC_GEO_EXPk_MEDIAN, nexp);
79 cpl_propertylist_update_float(aHeader, keyword, median);
80 snprintf(keyword, KEYWORD_LENGTH, QC_GEO_EXPk_STDEV, nexp);
81 cpl_propertylist_update_float(aHeader, keyword, stdev);
94 muse_geometry_qc_ifu(
muse_geo_table *aGeoInit, cpl_propertylist *aHeader,
95 const cpl_vector *aLambdas)
97 if (!aGeoInit || !aHeader || !aLambdas) {
100 cpl_table *gtinit = aGeoInit->
table;
101 const unsigned char ifu = cpl_table_get_int(gtinit, MUSE_GEOTABLE_FIELD, 0, NULL);
102 double angle = cpl_table_get_column_mean(gtinit, MUSE_GEOTABLE_ANGLE),
103 astdev = cpl_table_get_column_stdev(gtinit, MUSE_GEOTABLE_ANGLE),
104 amedian = cpl_table_get_column_median(gtinit, MUSE_GEOTABLE_ANGLE);
105 cpl_msg_debug(__func__,
"Adding QC keywords for IFU %hhu: angle = %.3f +/- %.3f "
106 "(%.3f) deg", ifu, angle, astdev, amedian);
107 char *keyword = cpl_sprintf(QC_GEO_IFUi_ANGLE, ifu);
108 cpl_propertylist_update_float(aHeader, keyword, amedian);
111 int i, n = cpl_vector_get_size(aLambdas);
112 for (i = 1; i <= n; i++) {
113 double lambda = cpl_vector_get(aLambdas, i - 1);
114 char *kw = cpl_sprintf(QC_GEO_IFUi_WLENj, ifu, i),
115 *kwmean = cpl_sprintf(QC_GEO_IFUi_MEANj, ifu, i),
116 *kwmedi = cpl_sprintf(QC_GEO_IFUi_MEDIANj, ifu, i),
117 *kwstdv = cpl_sprintf(QC_GEO_IFUi_STDEVj, ifu, i);
118 cpl_propertylist_update_float(aHeader, kw, lambda);
120 cpl_table_unselect_all(gtinit);
121 cpl_table_or_selected_double(gtinit,
"lambda", CPL_EQUAL_TO, lambda);
122 if (cpl_table_count_selected(gtinit) < 1) {
123 cpl_propertylist_update_float(aHeader, kwmean, i);
124 cpl_propertylist_update_float(aHeader, kwmedi, i);
125 cpl_propertylist_update_float(aHeader, kwstdv, i);
127 cpl_table *t = cpl_table_extract_selected(gtinit);
128 cpl_propertylist_update_float(aHeader, kwmean,
129 cpl_table_get_column_mean(t,
"flux"));
130 cpl_propertylist_update_float(aHeader, kwmedi,
131 cpl_table_get_column_median(t,
"flux"));
132 cpl_propertylist_update_float(aHeader, kwstdv,
133 cpl_table_get_column_stdev(t,
"flux"));
152 cpl_propertylist *aHeader)
154 if (!aGeoTable || !aHeader) {
157 double angle = cpl_table_get_column_mean(aGeoTable->
table, MUSE_GEOTABLE_ANGLE),
158 astdev = cpl_table_get_column_stdev(aGeoTable->
table, MUSE_GEOTABLE_ANGLE),
159 amedian = cpl_table_get_column_median(aGeoTable->
table, MUSE_GEOTABLE_ANGLE);
160 cpl_msg_debug(__func__,
"Adding global QC keywords: angle = %.3f +/- %.3f "
161 "(%.3f) deg", angle, astdev, amedian);
162 cpl_propertylist_update_float(aHeader, QC_GEO_MASK_ANGLE, amedian);
174 muse_geometry_load_images(
muse_processing *aProcessing,
unsigned short aIFU)
176 unsigned int skip = 0;
177 if (getenv(
"MUSE_GEOMETRY_SKIP") && atoi(getenv(
"MUSE_GEOMETRY_SKIP")) > 0) {
178 skip = atoi(getenv(
"MUSE_GEOMETRY_SKIP"));
186 MUSE_TAG_MASTER_BIAS, aIFU);
188 cpl_propertylist *hbias = cpl_propertylist_load(cpl_frame_get_filename(fbias), 0);
190 cpl_propertylist_delete(hbias);
196 unsigned int ifile, nfiles = 99;
198 cpl_msg_warning(__func__,
"Skipping spot measurements, only loading first"
199 " (reduced) file for IFU %02hu", aIFU);
202 cpl_msg_warning(__func__,
"Skipping raw image processing, loading all "
203 "reduced images directly");
205 for (ifile = 0; ifile < nfiles; ifile++) {
206 char *fn = cpl_sprintf(
"MASK_REDUCED_00%02u-%02hu.fits", ifile + 1, aIFU);
207 cpl_errorstate es = cpl_errorstate_get();
210 cpl_errorstate_set(es);
214 cpl_frame *frame = cpl_frame_new();
215 cpl_frame_set_filename(frame, fn);
216 cpl_frame_set_tag(frame,
"MASK");
218 cpl_msg_debug(__func__,
"file = %s", fn);
222 cpl_msg_debug(__func__,
"Read %u file%s", ifile, ifile == 1 ?
"" :
"s");
251 static cpl_error_code
255 double aLMin,
double aLMax)
257 cpl_ensure_code(aProcessing && aParams && aGeo && aGeo->
table,
258 CPL_ERROR_NULL_INPUT);
259 if (aLMin >= aLMax) {
260 cpl_msg_warning(__func__,
"Invalid wavelength range for reconstruction "
261 "(%.2f..%.2f), using 6800..7200 instead!", aLMin, aLMax);
265 unsigned int skip = 0;
266 if (getenv(
"MUSE_GEOMETRY_SKIP") && atoi(getenv(
"MUSE_GEOMETRY_SKIP")) > 0) {
267 skip = atoi(getenv(
"MUSE_GEOMETRY_SKIP"));
269 cpl_table *gt = aGeo->
table;
273 #pragma omp parallel for default(none) \
274 shared(gt, aParams, aProcessing, pts, skip)
275 for (nifu = (
unsigned)aParams->
ifu1; nifu <= (
unsigned)aParams->
ifu2; nifu++) {
276 cpl_table *trace =
muse_table_load(aProcessing, MUSE_TAG_TRACE_TABLE, nifu),
278 if (!trace || !wavecal) {
279 cpl_table_delete(trace);
280 cpl_table_delete(wavecal);
284 cpl_frame *cframe = NULL;
287 cframe = cpl_frame_new();
288 char *fn = cpl_sprintf(
"MASK_COMBINED-%02hhu.fits", nifu);
289 cpl_frame_set_filename(cframe, fn);
292 MUSE_TAG_MASK_COMBINED, nifu);
295 cpl_table_delete(trace);
296 cpl_table_delete(wavecal);
299 cpl_msg_debug(__func__,
"reconstructing IFU %2hhu using \"%s\"", nifu,
300 cpl_frame_get_filename(cframe));
302 cpl_frame_delete(cframe);
304 cpl_table_delete(trace);
305 cpl_table_delete(wavecal);
311 for (nifu = (
unsigned)aParams->
ifu1 + 1; nifu <= (
unsigned)aParams->
ifu2; nifu++) {
322 return cpl_error_set_message(__func__, CPL_ERROR_ILLEGAL_OUTPUT,
323 "After cutting to %.2f..%.2f in wavelength no "
324 "pixels for image reconstruction are left!",
337 cube->
recnames = cpl_array_new(1, CPL_TYPE_STRING);
339 cpl_array_set_string(cube->
recnames, 0,
"white");
344 return CPL_ERROR_NONE;
374 static cpl_error_code
379 cpl_ensure_code(aProcessing && aParams && aGeo && aGeo->
table,
380 CPL_ERROR_NULL_INPUT);
381 if (aLMin >= aLMax) {
382 cpl_msg_warning(__func__,
"Invalid wavelength range for reconstruction "
383 "(%.2f..%.2f), using 6800..7200 instead!", aLMin, aLMax);
391 cpl_frameset *usedoriginal = cpl_frameset_duplicate(aProcessing->
usedframes);
392 int iframe, nframes = cpl_frameset_get_size(aProcessing->
usedframes);
393 for (iframe = 0; iframe < nframes; iframe++) {
394 cpl_frame *frame = cpl_frameset_get_position(aProcessing->
usedframes, iframe);
395 if (cpl_frame_get_group(frame) == CPL_FRAME_GROUP_RAW) {
396 cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
400 cpl_table *gt = aGeo->
table;
402 "MASK_CHECK", 0, CPL_FALSE);
403 nframes = cpl_frameset_get_size(frames);
404 cpl_msg_info(__func__,
"Found %d datasets to reconstruct", nframes);
405 for (iframe = 0; iframe < nframes; iframe++) {
406 cpl_frame *frame = cpl_frameset_get_position(frames, iframe);
407 const char *fn = cpl_frame_get_filename(frame);
408 cpl_msg_info(__func__,
"Reconstructing image %d (from \"%s\"), using "
409 "wavelength range %.2f..%.2f", iframe + 1, fn, aLMin, aLMax);
412 #pragma omp parallel for default(none) \
413 shared(aParams, aProcessing, fn, frames, gt, pts)
414 for (nifu = (
unsigned)aParams->
ifu1; nifu <= (
unsigned)aParams->
ifu2; nifu++) {
415 cpl_table *trace =
muse_table_load(aProcessing, MUSE_TAG_TRACE_TABLE, nifu),
417 if (!trace || !wavecal) {
418 cpl_table_delete(trace);
419 cpl_table_delete(wavecal);
423 MUSE_TAG_MASTER_BIAS, nifu);
425 cpl_table_delete(trace);
426 cpl_table_delete(wavecal);
429 const char *bname = cpl_frame_get_filename(bframe);
430 cpl_errorstate es = cpl_errorstate_get();
433 cpl_errorstate_set(es);
436 cpl_frame_delete(bframe);
442 cpl_table_delete(trace);
443 cpl_table_delete(wavecal);
449 if (bpars && !strncmp(bpars->
overscan,
"vpoly", 5)) {
451 unsigned char ovscvorder = 3;
454 char *rest = strchr(bpars->
overscan,
':');
455 if (strlen(bpars->
overscan) > 6 && rest) {
456 ovscvorder = strtol(++rest, &rest, 10);
457 if (strlen(rest) > 0) {
458 frms = strtod(++rest, &rest);
459 if (strlen(rest) > 0) {
460 fchisq = strtod(++rest, &rest);
471 if (bpars && !strncmp(bpars->
overscan,
"offset", 6)) {
479 cpl_table_delete(trace);
480 cpl_table_delete(wavecal);
486 for (nifu = (
unsigned)aParams->
ifu1 + 1; nifu <= (
unsigned)aParams->
ifu2; nifu++) {
496 cpl_error_set_message(__func__, CPL_ERROR_ILLEGAL_OUTPUT,
497 "After cutting to %.2f..%.2f in wavelength no "
498 "pixels for image reconstruction of \"%s\" are "
499 "left!", aLMin, aLMax, fn);
509 rp->dlambda = 10000.;
517 cpl_frameset_insert(usedoriginal, cpl_frame_duplicate(frame));
518 cpl_propertylist *header = cpl_propertylist_load(fn, 0);
520 header,
"GEOMETRY_CHECK");
521 cpl_propertylist_delete(header);
524 cpl_frameset_delete(frames);
528 return CPL_ERROR_NONE;
545 if (aParams->
centroid == MUSE_GEOMETRY_PARAM_CENTROID_GAUSSIAN) {
547 }
else if (aParams->
centroid != MUSE_GEOMETRY_PARAM_CENTROID_BARYCENTER) {
548 cpl_msg_error(__func__,
"unknown centroiding method \"%s\"", aParams->
centroid_s);
553 cpl_table *linelist =
muse_table_load(aProcessing, MUSE_TAG_LINE_CATALOG, 0);
555 MUSE_TAG_LINE_CATALOG);
557 cpl_propertylist_delete(linehead);
559 cpl_table_delete(linelist);
560 if (!listvalid || !vlines) {
561 cpl_msg_error(__func__,
"%s could not be loaded/verified or enough suitable"
562 "lines are missing", MUSE_TAG_LINE_CATALOG);
563 cpl_vector_delete(vlines);
567 cpl_msg_info(__func__,
"Analyzing IFUs %d to %d", aParams->
ifu1, aParams->
ifu2);
568 cpl_error_code rc[kMuseNumIFUs];
569 cpl_table *mspots[kMuseNumIFUs],
570 *trace[kMuseNumIFUs],
571 *wavecal[kMuseNumIFUs];
572 cpl_propertylist *headfinal = NULL;
573 cpl_array *dy = cpl_array_new(0, CPL_TYPE_DOUBLE);
575 #pragma omp parallel for default(none) \
576 shared(aParams, aProcessing, centroid, dy, headfinal, mspots, rc, \
577 trace, vlines, wavecal)
578 for (nifu = (
unsigned)aParams->
ifu1; nifu <= (
unsigned)aParams->
ifu2; nifu++) {
579 rc[nifu - 1] = CPL_ERROR_NONE;
580 mspots[nifu - 1] = NULL;
584 trace[nifu - 1] =
muse_table_load(aProcessing, MUSE_TAG_TRACE_TABLE, nifu);
585 wavecal[nifu - 1] =
muse_table_load(aProcessing, MUSE_TAG_WAVECAL_TABLE, nifu);
586 if (!trace[nifu - 1] || !wavecal[nifu - 1]) {
587 cpl_msg_error(__func__,
"Calibration could not be loaded for IFU %hu: %s%s",
588 nifu, !trace[nifu - 1] ?
" "MUSE_TAG_TRACE_TABLE :
"",
589 !wavecal[nifu - 1] ?
" "MUSE_TAG_WAVECAL_TABLE :
"");
590 cpl_table_delete(trace[nifu - 1]);
591 cpl_table_delete(wavecal[nifu - 1]);
592 trace[nifu - 1] = NULL;
593 wavecal[nifu - 1] = NULL;
594 rc[nifu - 1] = CPL_ERROR_NULL_INPUT;
600 muse_imagelist *images = muse_geometry_load_images(aProcessing, nifu);
602 cpl_msg_error(__func__,
"Loading and basic processing of the raw input "
603 "images failed for IFU %hu!", nifu);
604 cpl_table_delete(trace[nifu - 1]);
605 cpl_table_delete(wavecal[nifu - 1]);
606 trace[nifu - 1] = NULL;
607 wavecal[nifu - 1] = NULL;
608 rc[nifu - 1] = cpl_error_get_code();
612 unsigned int skip = 0;
613 if (getenv(
"MUSE_GEOMETRY_SKIP") && atoi(getenv(
"MUSE_GEOMETRY_SKIP")) > 0) {
614 skip = atoi(getenv(
"MUSE_GEOMETRY_SKIP"));
616 cpl_propertylist *header;
618 char *fn = cpl_sprintf(
"SPOTS_TABLE-%02hu.fits", nifu);
619 cpl_msg_warning(__func__,
"Reading spot measurements from \"%s\"", fn);
620 mspots[nifu - 1] = cpl_table_load(fn, 1, 1);
628 wavecal[nifu - 1], vlines,
629 aParams->
sigma, centroid);
635 muse_geometry_qc_spots(mspots[nifu - 1], header);
638 cpl_propertylist_delete(header);
640 cpl_msg_info(__func__,
"measured %"CPL_SIZE_FORMAT
" spots in %u images",
642 cpl_table_delete(wavecal[nifu - 1]);
651 MUSE_TAG_MASK_REDUCED);
654 #pragma omp critical (muse_geo_header_construct)
663 cpl_propertylist_erase_regexp(headfinal,
664 "EXTNAME|ESO DET (CHIP|OUT)|ESO DET2", 0);
675 UNUSED_ARGUMENT(pinholedy);
676 cpl_array_delete(dy);
679 cpl_table *spots = NULL;
681 #pragma omp parallel for default(none) \
682 shared(aParams, geotable, headfinal, mspots, spots, trace, vlines)
683 for (nifu = (
unsigned)aParams->
ifu1; nifu <= (
unsigned)aParams->
ifu2; nifu++) {
687 cpl_table_delete(trace[nifu - 1]);
689 #pragma omp critical (muse_geo_header_construct)
690 muse_geometry_qc_ifu(geoinit, headfinal, vlines);
694 #pragma omp critical (muse_geo_table_insert)
699 if (fabs(geotable->
scale - geohori->
scale) > DBL_EPSILON) {
700 cpl_msg_warning(__func__,
"Combined and single geometry tables have "
701 "different scales (%f / %f)!", geotable->
scale,
704 cpl_table_insert(geotable->
table, geohori->
table,
705 cpl_table_get_nrow(geotable->
table));
709 #pragma omp critical (muse_spots_table_insert)
712 spots = mspots[nifu - 1];
714 cpl_table_insert(spots, mspots[nifu - 1], cpl_table_get_nrow(spots));
715 cpl_table_delete(mspots[nifu - 1]);
719 cpl_vector_delete(vlines);
720 cpl_error_code result = CPL_ERROR_NONE;
722 for (nifu = (
unsigned)aParams->
ifu1; nifu <= (
unsigned)aParams->
ifu2; nifu++) {
723 if (result < rc[nifu - 1]) {
724 result = rc[nifu - 1];
728 cpl_table_save(geotable, NULL, NULL,
"geocombined.fits", CPL_IO_CREATE);
729 cpl_table_save(spots, NULL, NULL,
"spotscombined.fits", CPL_IO_CREATE);
732 cpl_table_delete(spots);
737 if (result < rcfinal) {
740 muse_geometry_qc_global(geofinal, headfinal);
746 muse_geometry_reconstruct_combined(aProcessing, aParams, geofinal,
750 muse_geometry_reconstruct(aProcessing, aParams, geofinal,
753 cpl_propertylist_delete(headfinal);
755 return result != CPL_ERROR_NONE ? -1 : 0;
cpl_error_code muse_quadrants_overscan_correct(muse_image *aImage, muse_image *aRefImage)
Adapt bias level to reference image using overscan statistics.
int muse_processing_save_cimage(muse_processing *aProcessing, int aIFU, cpl_image *aImage, cpl_propertylist *aHeader, const char *aTag)
Save a computed FITS image to disk.
muse_imagelist * muse_basicproc_load(muse_processing *aProcessing, unsigned char aIFU, muse_basicproc_params *aBPars)
Load the raw input files from disk and do basic processing.
Structure definition of a MUSE datacube.
Structure definition for a collection of muse_images.
const char * centroid_s
Type of centroiding and FWHM determination to use for all spot measurements: simple barycenter method...
cpl_error_code muse_geo_refine_horizontal(muse_geo_table *aGeo, cpl_table *aSpots)
Refine relative horizontal positions of adjacent IFUs.
void muse_image_delete(muse_image *aImage)
Deallocate memory associated to a muse_image object.
int muse_utils_get_extension_for_ifu(const char *aFilename, unsigned char aIFU)
Return extension number that corresponds to this IFU/channel number.
muse_image * muse_image_load_from_raw(const char *aFilename, int aExtension)
Load raw image into the data extension of a MUSE image.
cpl_size muse_pixtable_get_nrow(const muse_pixtable *aPixtable)
get the number of rows within the pixel table
double sigma
Sigma detection level for spot detection, in terms of median deviation above the median.
double lambdamax
When passing any MASK_CHECK frames in the input, use this upper wavelength cut before reconstructing ...
int muse_image_subtract(muse_image *aImage, muse_image *aSubtract)
Subtract a muse_image from another with correct treatment of bad pixels and variance.
void muse_datacube_delete(muse_datacube *aCube)
Deallocate memory associated to a muse_datacube object.
double muse_geo_compute_pinhole_global_distance(cpl_array *aDY, double aWidth, double aMin, double aMax)
Use vertical pinhole distance measurements of all IFUs to compute the effective global value...
void muse_imagelist_delete(muse_imagelist *aList)
Free the memory of the MUSE image list.
double scale
The VLT focal plane scale factor of the data. output file.
muse_geo_table * muse_geo_determine_vertical(const muse_geo_table *aGeo)
Use all properties of the central spot and the horizontal properties in each slice to compute the ver...
muse_image * muse_datacube_collapse(muse_datacube *aCube, cpl_table *aFilter)
Integrate a FITS NAXIS=3 datacube along the wavelength direction.
Structure definition of MUSE three extension FITS file.
cpl_array * recnames
the reconstructed image filter names
cpl_error_code muse_quadrants_overscan_polyfit_vertical(muse_image *aImage, unsigned aIgnore, unsigned char aOrder, double aSigma, const double aFRMS, double aFChiSq)
Correct quadrants by polynomial representation of vertical overscan.
cpl_table * table
The pixel table.
void muse_basicproc_params_delete(muse_basicproc_params *aBPars)
Free a structure of basic processing parameters.
cpl_propertylist * header
the FITS header
muse_image * muse_combine_average_create(muse_imagelist *aImages)
Average a list of input images.
int muse_image_variance_create(muse_image *aImage, muse_image *aBias)
Create the photon noise-based variance in the stat extension.
unsigned int muse_imagelist_get_size(muse_imagelist *aList)
Return the number of stored images.
cpl_frameset * usedframes
muse_geo_table * muse_geo_determine_horizontal(const muse_geo_table *aGeo)
Use per-spot and per-wavelength partial geometry to determine the horizontal geometrical properties f...
cpl_error_code muse_geo_compute_pinhole_local_distance(cpl_array *aDY, cpl_table *aSpots)
Use spot measurements of one IFU to compute vertical pinhole distance.
cpl_error_code muse_pixtable_restrict_wavelength(muse_pixtable *aPixtable, double aLow, double aHigh)
Restrict a pixel table to a certain wavelength range.
cpl_table * muse_geo_measure_spots(muse_image *aImage, muse_imagelist *aList, const cpl_table *aTrace, const cpl_table *aWave, const cpl_vector *aLines, double aSigma, muse_geo_centroid_type aCentroid)
Detect spots on a combined image and measure them on the corresponding series of images.
Structure definition of MUSE pixel table.
muse_image * muse_imagelist_get(muse_imagelist *aList, unsigned int aIdx)
Get the muse_image of given list index.
cpl_table * table
The geometry table.
Structure definition of MUSE geometry table.
cpl_error_code muse_geo_finalize(muse_geo_table *aGeo)
Create a final version of a geometry table.
muse_resampling_params * muse_resampling_params_new(muse_resampling_type aMethod)
Create the resampling parameters structure.
muse_geo_centroid_type
Type of centroiding algorithm to use.
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_imagelist * data
the cube containing the actual data values
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.
muse_pixtable * muse_pixtable_create(muse_image *aImage, cpl_table *aTrace, cpl_table *aWave, cpl_table *aGeoTable)
Create the pixel table for one CCD.
void muse_geo_table_delete(muse_geo_table *aGeo)
Deallocate memory associated to a geometry table object.
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.
int centroid
Type of centroiding and FWHM determination to use for all spot measurements: simple barycenter method...
cpl_error_code muse_quadrants_overscan_stats(muse_image *aImage, const char *aRejection, unsigned int aIgnore)
Compute overscan statistics of all quadrants and save in 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.
int ifu2
Last IFU to analyze.
muse_image * muse_image_load(const char *aFilename)
Load the three extensions and the FITS headers of a MUSE image from a file.
cpl_error_code muse_image_reject_from_dq(muse_image *aImage)
Reject pixels of a muse_image depending on its DQ data.
muse_imagelist * muse_imagelist_new(void)
Create a new (empty) MUSE image list.
int ifu1
First IFU to analyze.
muse_basicproc_params * muse_basicproc_params_new_from_propertylist(const cpl_propertylist *aHeader)
Create a structure of basic processing parameters from a FITS header.
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
double lambdamin
When passing any MASK_CHECK frames in the input, use this lower wavelength cut before reconstructing ...
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.
Structure of basic processing parameters.
void muse_resampling_params_delete(muse_resampling_params *aParams)
Delete a resampling parameters structure.
cpl_propertylist * muse_propertylist_load(muse_processing *aProcessing, const char *aTag)
load a propertylist according to its tag
cpl_boolean muse_wave_lines_check(cpl_table *aTable, cpl_propertylist *aHeader)
Check that a LINE_CATALOG has the expected format.
cpl_error_code muse_image_adu_to_count(muse_image *aImage)
Convert the data units from raw adu to count (= electron) units.
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
cpl_vector * muse_geo_lines_get(const cpl_table *aLines)
Select lines suitable for geometrical calibration from a line list.
muse_image * muse_image_load_from_extensions(const char *aFilename, unsigned char aIFU)
Load the three extensions and the FITS headers of a MUSE image from extensions of a merged file...
void muse_pixtable_delete(muse_pixtable *aPixtable)
Deallocate memory associated to a pixel table object.
cpl_error_code muse_imagelist_set(muse_imagelist *aList, muse_image *aImage, unsigned int aIdx)
Set the muse_image of given list index.
muse_geo_table * muse_geo_determine_initial(cpl_table *aSpots, const cpl_table *aTrace)
Use spot measurements to compute initial geometrical properties.
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
muse_imagelist * recimages
the reconstructed image data
muse_image * muse_quadrants_trim_image(muse_image *aImage)
Trim the input image of pre- and over-scan regions of all quadrants.
Structure to hold the parameters of the muse_geometry recipe.