Commit ba8575b2 authored by Ole Streicher's avatar Ole Streicher

New upstream version 2.9.0+dfsg

parent cd74f762
2.9.0 03/03/2016 April release 2016: added INSTRUME in reflex wkf oca rules key check PIPE-6495
2.8.0 15/02/2016 April release 2016 (with cleaned documentation)
2.8.0b2 08/02/2016 Candidate release (removed check for CEX library in configure.ac)
2.8.0b1 04/02/2016 Candidate release
2.7.5 04/02/2016 Fixed compiler problems
2.7.4 28/01/2016 Fixed defult parameter stack-sub_raw_sky to true in reflex workflow PIPE-6428
2.7.3 26/01/2016 Cleaned version for PSO commissioning
2.7.2 21/12/2016 Update id before Andrea goes to Paranal for SINFONI commissioning, and tag version
2.7.1 29/12/2015 Candidate release
2.7.0 24/10/2015 Updated reflex wkf top level picture id, included Valentin's comments in tutorial, fixed some valgring error on unit tests
2.6.9 02/10/2015 Addressed PIPE-6121 (due to wavcal failure due to wrong addition of FITS keywords)
07/10/2015 Addressed PIPE-6223 (due to wavecal & jitter failures related to addition of wcs)
......
......@@ -41,7 +41,7 @@ PRINTER_NAME=lp
PRINT_FONT=Monospaced:16
PRINT_ORIENTATION=P
RADEC_CONVERSION=true
RECIPE_SET=sinfo_rec_detlin=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_rec_detlin.so;sinfo_rec_distortion=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_rec_distortion.so;sinfo_rec_jitter=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_rec_jitter.so;sinfo_rec_mdark=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_rec_mdark.so;sinfo_rec_mflat=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_rec_mflat.so;sinfo_rec_pupil=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_rec_pupil.so;sinfo_rec_wavecal=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_rec_wavecal.so;sinfo_utl_bp_mask_add=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_bp_mask_add.so;sinfo_utl_cube2ima=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_cube2ima.so;sinfo_utl_cube_combine=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_cube_combine.so;sinfo_utl_cube2spectrum=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_cube2spectrum.so;sinfo_utl_cube_arith=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_cube_arith.so;sinfo_utl_ima_arith=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_ima_arith.so;sinfo_utl_skycor=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_skycor.so;sinfo_utl_skymap=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_skymap.so;sinfo_utl_spectrum_divide_by_blackbody=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_spectrum_divide_by_blackbody.so;sinfo_utl_spectrum_wavelength_shift=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.7.0/sinfo_utl_spectrum_wavelength_shift.so
RECIPE_SET=sinfo_rec_detlin=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_rec_detlin.so;sinfo_rec_distortion=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_rec_distortion.so;sinfo_rec_jitter=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_rec_jitter.so;sinfo_rec_mdark=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_rec_mdark.so;sinfo_rec_mflat=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_rec_mflat.so;sinfo_rec_pupil=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_rec_pupil.so;sinfo_rec_wavecal=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_rec_wavecal.so;sinfo_utl_bp_mask_add=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_bp_mask_add.so;sinfo_utl_cube2ima=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_cube2ima.so;sinfo_utl_cube_combine=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_cube_combine.so;sinfo_utl_cube2spectrum=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_cube2spectrum.so;sinfo_utl_cube_arith=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_cube_arith.so;sinfo_utl_ima_arith=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_ima_arith.so;sinfo_utl_skycor=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_skycor.so;sinfo_utl_skymap=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_skymap.so;sinfo_utl_spectrum_divide_by_blackbody=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_spectrum_divide_by_blackbody.so;sinfo_utl_spectrum_wavelength_shift=/home/quality/pipelines/sinfo/lib/esopipes-plugins/sinfo-2.9.0/sinfo_utl_spectrum_wavelength_shift.so
SCRIPTS_DIR=/home/astro4/gasgano/scripts/gas-scripts
SHORTEN_FILES_PATH=false
SHORT_FILENAME=true
......
This diff is collapsed.
# Process this file with autoconf to produce a configure script.
AC_INIT([SINFONI Instrument Pipeline], [2.7.0], [usd-help@eso.org], [sinfo])
AC_INIT([SINFONI Instrument Pipeline], [2.9.0], [usd-help@eso.org], [sinfo])
AC_PREREQ([2.59])
......@@ -44,6 +44,8 @@ ESO_ENABLE_DEBUG(no)
ESO_ENABLE_STRICT(no)
ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"])
ESO_PROG_CC_FLAG([std=c99], [CFLAGS="$CFLAGS -std=c99"])
ESO_PROG_CC_FLAG([Werror=implicit-function-declaration],
[CFLAGS="-Werror=implicit-function-declaration $CFLAGS"])
ESO_CHECK_DOCTOOLS
AC_ENABLE_STATIC(no)
......@@ -71,7 +73,6 @@ AC_CHECK_FUNCS([sin cos floor pow sqrt])
ESO_FUNC_STRDUP
# Check for CPL/Qfits presence and usability
CPL_CHECK_CEXT
CPL_CHECK_LIBS
# Check for Purify
......
......@@ -208,6 +208,9 @@ cpl_table * irplib_slitpos_analysis(const cpl_image * imslit,
cpl_msg_error(cpl_func, "cannot find the edges of the [%d]th line",
i+1);
cpl_image_delete(thin_im);
cpl_free(slit_y);
cpl_free(slit_x_l);
cpl_free(slit_x_r);
return NULL;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -74,8 +74,6 @@ static double matrix1[NPAR][NPAR] ; /* original matrix */
static double matrix2[NPAR][NPAR] ; /* inverse of matrix1 */
static int nfree ; /* number of free parameters */
static int parptr[NPAR] ; /* parameter pointer */
static float slopewidth ; /* initial value for fit parameter 5:
width of linear slope */
/*----------------------------------------------------------------------------
* Functions private to this module
......@@ -1565,6 +1563,8 @@ sinfo_new_fit_slits_edge_with_estimate ( cpl_image * lineImage,
int ilx=0;
int ily=0;
float* pidata=NULL;
sinfo_msg("input parameters: box_length=%d y_box=% g diff_tol=%g low_pos=%d high_pos=%d",
box_length, y_box, diff_tol, low_pos, high_pos );
/* slit_length = SLITLENGTH ; this is too high: 64 */
slit_length = N_SLITLETS ; /* this is better: 32 */
......
......@@ -852,7 +852,7 @@ int sinfo_new_fit_slits_boltz ( cpl_image * lineImage,
pos_row = (int*) cpl_calloc( 3*slit_length, sizeof(int) ) ;
pos_rowclean = (int*) cpl_calloc( slit_length, sizeof(int) ) ;
//cpl_image_save(lineImage,"line_image.fits",CPL_BPP_IEEE_FLOAT,NULL,CPL_IO_DEFAULT);
/* -----------------------------------------------------------------------
* go through the first image columns and the fit parameters and find the
line with the highest intensity
......@@ -881,7 +881,7 @@ int sinfo_new_fit_slits_boltz ( cpl_image * lineImage,
}
}
}
sinfo_msg("max intensity=%g",max_intensity);
/* --------------------------------------------------------------------
* check if the found line is usable and if the neighbouring line
* have intensity on near rows in neighbouring slitlets
......@@ -921,7 +921,7 @@ int sinfo_new_fit_slits_boltz ( cpl_image * lineImage,
}
}
sinfo_msg("agreed=%d",agreed);
if ( agreed == -1 )
{
......@@ -944,14 +944,14 @@ int sinfo_new_fit_slits_boltz ( cpl_image * lineImage,
position=cpl_calloc(ilx,sizeof(float)) ;
/* was for ( col = 0 ; col < ilx - slit_length/2 ; col++ ) */
sinfo_msg("slit_length=%d col_min=%d col_max=%d",
slit_length,slit_length/2,ilx-slit_length/2);
for ( col = slit_length/2 ; col < ilx - slit_length/2 ; col++ )
{
for ( i = 0 ; i < par[0]->n_params ; i++ )
{
/*
printf("p1=%f p2=%f p3=%f\n",
par[i]->fit_par[0],par[i]->fit_par[1],par[i]->fit_par[2]);
*/
if ( par[i]->column == col && par[i]->line == line )
{
if ( par[i]->fit_par[0] > 0. &&
......@@ -960,10 +960,17 @@ int sinfo_new_fit_slits_boltz ( cpl_image * lineImage,
{
position[n] = par[i]->fit_par[2] ;
old_pos=position[n];
if ( n > 0 &&
fabs(position[n] - position[n-1]) > y_box &&
(col-old_col) > (slit_length-SLIT_POS_ERR) )
if ( n > 0 && fabs(position[n] - position[n-1]) > y_box &&
( (old_col == 0) ||
(col-old_col) > (slit_length-SLIT_POS_ERR) ) )
{
/*
sinfo_msg("Found Slit Edge n=%d col=%d check1=%g test1=%g",
n, col,fabs(position[n] - position[n-1]),y_box);
sinfo_msg("check2=%g test2=%g",(col-old_col),(slit_length-SLIT_POS_ERR));
*/
old_col=col;
sinfo_edge[ed] = col ;
......
......@@ -52,10 +52,6 @@
#include "sinfo_local_types.h"
#include "sinfo_fft_base.h"
static int
sinfo_sort_slitlets(const int kslit);
static int
sinfo_sort_slitlets_array(const int slit, int* row_index);
......@@ -667,130 +663,6 @@ sinfo_north_south_test( cpl_image * ns_image,
}
/**
@name sinfo_sort_slitlets()
@brief sort the slitlets in the right spiffi specific way
@param kslit slit number
@return spiffi slit index or -1
*/
static int
sinfo_sort_slitlets(const int kslit)
{
int slit_index=0;
switch (kslit)
{
case 0:
slit_index = 8 ;
break ;
case 1:
slit_index = 7 ;
break ;
case 2:
slit_index = 9 ;
break ;
case 3:
slit_index = 6 ;
break ;
case 4:
slit_index = 10 ;
break ;
case 5:
slit_index = 5 ;
break ;
case 6:
slit_index = 11 ;
break ;
case 7:
slit_index = 4 ;
break ;
case 8:
slit_index = 12 ;
break ;
case 9:
slit_index = 3 ;
break ;
case 10:
slit_index = 13 ;
break ;
case 11:
slit_index = 2 ;
break ;
case 12:
slit_index = 14 ;
break ;
case 13:
slit_index = 1 ;
break ;
case 14:
slit_index = 15 ;
break ;
case 15:
slit_index = 0 ;
break ;
case 16:
slit_index = 31 ;
break ;
case 17:
slit_index = 16 ;
break ;
case 18:
slit_index = 30 ;
break ;
case 19:
slit_index = 17 ;
break ;
case 20:
slit_index = 29 ;
break ;
case 21:
slit_index = 18 ;
break ;
case 22:
slit_index = 28 ;
break ;
case 23:
slit_index = 19 ;
break ;
case 24:
slit_index = 27 ;
break ;
case 25:
slit_index = 20 ;
break ;
case 26:
slit_index = 26 ;
break ;
case 27:
slit_index = 21 ;
break ;
case 28:
slit_index = 25 ;
break ;
case 29:
slit_index = 22 ;
break ;
case 30:
slit_index = 24 ;
break ;
case 31:
slit_index = 23 ;
break ;
default:
sinfo_msg_error("wrong slitlet index: couldn't be a "
"spiffi image, there must be 32 slitlets!") ;
return -1 ;
}
return slit_index;
}
/**
@name sinfo_sord_slitlets_array()
......
......@@ -735,16 +735,28 @@ int sinfo_compare_tags(
int sinfo_get_ins_set(char* band,int* ins_set){
if (strcmp(band,"H") == 0) {
if ( strcmp(band,"H") == 0 ||
strcmp(band,"Hn") == 0 ||
strcmp(band,"H_old") == 0 ||
strcmp(band,"H_new") == 0 ) {
*ins_set = 0;
}
else if (strcmp(band,"H+K") == 0) {
else if (strcmp(band,"H+K") == 0 ||
strcmp(band,"H+Kn") == 0 ||
strcmp(band,"H+K_old") == 0 ||
strcmp(band,"H+K_new") == 0 ) {
*ins_set = 1;
}
else if (strcmp(band,"K") == 0) {
else if ( strcmp(band,"K") == 0 ||
strcmp(band,"Kn") == 0 ||
strcmp(band,"K_old") == 0 ||
strcmp(band,"K_new") == 0 ) {
*ins_set = 2;
}
else if (strcmp(band,"J") == 0) {
else if ( strcmp(band,"J") == 0 ||
strcmp(band,"Jn") == 0 ||
strcmp(band,"J_old") == 0 ||
strcmp(band,"J_new") == 0 ) {
*ins_set = 3;
}
return 0;
......@@ -2856,7 +2868,9 @@ int sinfo_frame_is_dither(cpl_frame * frame)
int dith_status=1;
int len=0;
/* TODO: Note that this piece of code is wrong as set dith_status to 0
* unless the band ID is wrong. The check on dither status is useless
*/
cknull(frame,"Null input frame. Exit!");
cknull_nomsg(strcpy(file,cpl_frame_get_filename(frame)));
......@@ -2885,13 +2899,32 @@ int sinfo_frame_is_dither(cpl_frame * frame)
}
sinfo_free_propertylist(&plist) ;
//sinfo_msg_warning("band: >%s<",band);
if (strcmp(band,"H") == 0) {
if( abs(grat_encoder - GRAT_VAL2_H) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
} else if (strcmp(band,"Hn") == 0) {
if( abs(grat_encoder - GRAT_VAL2_H) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
} else if (strcmp(band,"H_new") == 0) {
if( abs(grat_encoder - GRAT_VAL2_H) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"H_old") == 0) {
if( abs(grat_encoder - GRAT_VAL2_H) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"H+K") == 0) {
if( abs(grat_encoder - GRAT_VAL2_HK) <= GRAT_VAL_TOL ) {
......@@ -2900,6 +2933,27 @@ int sinfo_frame_is_dither(cpl_frame * frame)
dith_status = 0;
}
}
else if (strcmp(band,"H+Kn") == 0) {
if( abs(grat_encoder - GRAT_VAL2_HK) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"H+K_new") == 0) {
if( abs(grat_encoder - GRAT_VAL2_HK) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"H+K_old") == 0) {
if( abs(grat_encoder - GRAT_VAL2_HK) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"K") == 0) {
if( abs(grat_encoder - GRAT_VAL2_K) <= GRAT_VAL_TOL ) {
dith_status = 0;
......@@ -2907,6 +2961,27 @@ int sinfo_frame_is_dither(cpl_frame * frame)
dith_status = 0;
}
}
else if (strcmp(band,"Kn") == 0) {
if( abs(grat_encoder - GRAT_VAL2_K) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"K_new") == 0) {
if( abs(grat_encoder - GRAT_VAL2_K) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"K_old") == 0) {
if( abs(grat_encoder - GRAT_VAL2_K) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"J") == 0) {
if( abs(grat_encoder - GRAT_VAL2_J) <= GRAT_VAL_TOL ) {
dith_status = 0;
......@@ -2914,6 +2989,29 @@ int sinfo_frame_is_dither(cpl_frame * frame)
dith_status = 0;
}
}
else if (strcmp(band,"Jn") == 0) {
if( abs(grat_encoder - GRAT_VAL2_J) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"J_new") == 0) {
if( abs(grat_encoder - GRAT_VAL2_J) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
}
else if (strcmp(band,"J_old") == 0) {
if( abs(grat_encoder - GRAT_VAL2_J) <= GRAT_VAL_TOL ) {
dith_status = 0;
} else {
dith_status = 0;
}
} else {
sinfo_msg_warning("band: >%s< not recognised! Treated like dither!",band);
}
cleanup:
sinfo_free_propertylist(&plist) ;
......
......@@ -76,9 +76,6 @@ static cpl_apertures *
sinfo_distortion_detect_arcs_new(cpl_image* ,cpl_image **,
int,int,double,int,int,int,int,double,int);
static
cpl_apertures * sinfo_distortion_detect_arcs(cpl_image *,
cpl_image **, int, int, int, int, int, int) ;
static int
sinfo_distortion_fill_badzones(cpl_image *, int, int, int, int, double) ;
static int
......@@ -576,155 +573,6 @@ static cpl_apertures * sinfo_distortion_detect_arcs_new(
/**@}*/
/*---------------------------------------------------------------------------*/
/**
@brief Detect the vertical arcs in an image
@param im the input image
@param label_im the output label image
@param arc_sat Saturation threshold for the arcs
@param max_arc_width Maximum arc width allowed
@param xmin
@param ymin Define the zone to take into account
@param xmax
@param ymax
@return The arcs or NULL in error case
The arcs are expected to be vertical.
*/
/*---------------------------------------------------------------------------*/
static cpl_apertures * sinfo_distortion_detect_arcs(
cpl_image * im,
cpl_image ** label_im,
int arc_sat,
int max_arc_width,
int xmin,
int ymin,
int xmax,
int ymax)
{
cpl_image * filt_im ;
cpl_matrix * filter ;
cpl_image * collapsed ;
cpl_mask * bin_im ;
double threshold, fillval, median_val, sigma ;
int min_arclen = 0 ;
cpl_apertures * det ;
cpl_size nobj ;
int ngoodpix ;
int ny ;
ny = cpl_image_get_size_y(im) ;
/* Default values for output parameters */
*label_im = NULL ;
/* Clear zones to be ignored (to avoid false detections) */
median_val = cpl_image_get_median_dev(im, &sigma) ;
fillval = median_val-sigma/2.0 ;
if (sinfo_distortion_fill_badzones(im, xmin, ymin, xmax, ymax,
fillval) == -1) {
cpl_msg_error(cpl_func, "cannot fill bad zones") ;
return NULL ;
}
/* Median vertical filter */
filter = cpl_matrix_new(3, 1) ;
cpl_matrix_fill(filter, 1.0) ;
/* filt_im = cpl_image_filter_median(im, filter) ; */
filt_im = cpl_image_duplicate(im) ;
cpl_matrix_delete(filter) ;
/* Subtract a low-pass */
if (sinfo_distortion_sub_hor_lowpass(filt_im, ARC_WINDOWSIZE) == -1) {
cpl_image_delete(filt_im) ;
return NULL ;
}
/* Get relevant stats for thresholding */
median_val = cpl_image_get_median_dev(filt_im, &sigma) ;
/* Correct median_val and sigma if necessary */
if (median_val < TRESH_MEDIAN_MIN) median_val = TRESH_MEDIAN_MIN ;
if (sigma > TRESH_SIGMA_MAX) sigma = TRESH_SIGMA_MAX ;
/* Set the threshold */
threshold = median_val + sigma * ARC_THRESHFACT ;
/* Collapse the image */
collapsed = cpl_image_collapse_median_create(filt_im, 0, 0, 0) ;
/* Threshold to keep only the arcs - use of the collapsed image */
if (sinfo_distortion_threshold1d(filt_im, median_val,
collapsed, 0.0)==-1) {
cpl_msg_error(cpl_func, "cannot threshold the filtered image") ;
cpl_image_delete(filt_im) ;
cpl_image_delete(collapsed) ;
return NULL ;
}
cpl_image_delete(collapsed) ;
/* Binarize the image */
bin_im = cpl_mask_threshold_image_create(filt_im, threshold,
SINFO_DBL_MAX);
cpl_image_delete(filt_im) ;
if (bin_im == NULL) {
cpl_msg_error(cpl_func, "cannot binarise the image") ;
return NULL ;
}
/* Test if there are enough good pixels */
ngoodpix = cpl_mask_count(bin_im) ;
if (ngoodpix < ARC_MINGOODPIX) {
cpl_msg_error(cpl_func, "Too few (%d) white pixels", ngoodpix) ;
cpl_mask_delete(bin_im) ;
return NULL ;
}
/* Apply a morphological closing to clean the isolated pixels */
filter = cpl_matrix_new(3, 3) ;
cpl_matrix_fill(filter, 1.0) ;
cpl_mask_closing(bin_im, filter) ;
cpl_matrix_delete(filter) ;
/* Labelize pixel map to a label image */
*label_im = cpl_image_labelise_mask_create(bin_im, &nobj) ;
cpl_mask_delete(bin_im) ;
/* Compute statistics on objects */
if ((det = cpl_apertures_new_from_image(im, *label_im)) == NULL) {
cpl_msg_error(cpl_func, "Cannot compute arcs stats") ;
cpl_image_delete(*label_im) ;
*label_im = NULL ;
return NULL ;
}
/* Set min_arclen */
min_arclen = (int)(ny / ARC_MINARCLENFACT) ;
/* Purge non-relevant arcs */
if (sinfo_distortion_purge_arcs(im, &det, label_im, min_arclen,
max_arc_width, arc_sat) == -1) {
cpl_msg_error(cpl_func, "Cannot purge the arcs") ;
cpl_image_delete(*label_im) ;
*label_im = NULL ;
cpl_apertures_delete(det) ;
return NULL ;
}
if (cpl_apertures_get_size(det) < ARC_MINNBARCS) {
cpl_msg_error(cpl_func, "Not enough valid arcs (%"
CPL_SIZE_FORMAT " < %d)",
cpl_apertures_get_size(det), ARC_MINNBARCS) ;
cpl_image_delete(*label_im) ;
*label_im = NULL ;
cpl_apertures_delete(det) ;
return NULL ;
}
/* Return */
return det ;
}
static int sinfo_distortion_fill_badzones(
cpl_image * im,
int xmin,
......
......@@ -216,6 +216,9 @@ parse_section_frames(flat_config * cfg,
/* If the frame has a tag we process it. Else it is an object */
//tag= (char*) cpl_frame_get_tag(frame);
/* sinfo_msg("frame %s tag =%s \n",name,tag); */
sinfo_msg("frame is on %d frame is sky %d",
sinfo_frame_is_on(frame),
sinfo_frame_is_sky(frame));
if((sinfo_frame_is_on(frame) == 0) ||
(sinfo_frame_is_sky(frame) == 1) )
{
......@@ -269,10 +272,10 @@ parse_section_frames(flat_config * cfg,
/* sinfo_msg("frame=%s\n",cfg->framelist[i]); */
}
/*
/* AMO */
sinfo_msg("Noff= %d Nobj= %d Nditheroff= %d Nditherobj= %d",
noff,nobj,nditheroff,nditherobj);
*/
if((nobj<1) && (nditherobj< 1)) {
......
......@@ -899,6 +899,7 @@ sinfo_new_fit_2d_gaussian ( cpl_image * image,
return -1 ;
}
/* -------------------------------------------------------------------
* find the initial estimates for the free parameters
*/
......@@ -1154,15 +1155,20 @@ sinfo_new_fit_2d_gaussian ( cpl_image * image,
if ( fit_par[2] <= 0. || fit_par[4] < 0. || fit_par[5] < 0. )
{
sinfo_msg_error("sorry, some impossible negative fit results!") ;
sinfo_msg_error("amplitude=%g, background=%g, Mxx/denom =%g",
fit_par[2],fit_par[4],fit_par[5]);
return -1 ;
}
fit_par[0] += llx ;
fit_par[1] += lly ;
if ( fit_par[0] < llx || fit_par[0] >= llx + 2*halfbox_x ||
fit_par[1] < lly || fit_par[1] >= lly + 2*halfbox_y )
{
sinfo_msg_error("sorry, centroid after the fit "
"outside the fitting box") ;
sinfo_msg_error("sorry, 2D-Gaussian (x,y)=(%g,%g) position is outside "
"the fitting box (llx,lly,urx,ury)=(%d,%d,%d,%d)",
fit_par[0],fit_par[1],llx,lly,
llx + 2*halfbox_x,lly + 2*halfbox_y) ;
return -1 ;
}
......
......@@ -63,12 +63,24 @@
#define GRAT_VAL1_HK 3997330
#define GRAT_VAL2_HK 3997339
#define GRAT_VAL3_HK 3888888 //SPIFFI upgrade
#define GRAT_VAL1_H 2948723
#define GRAT_VAL2_H 2948733
#define GRAT_VAL3_H 2888888 //SPIFFI upgrade
#define GRAT_VAL1_K 1893844
#define GRAT_VAL2_K 1893854
#define GRAT_VAL3_K 1888888 //SPIFFI upgrade
#define GRAT_VAL1_J 849618
#define GRAT_VAL2_J 849628
#define GRAT_VAL3_J 888888 //SPIFFI upgrade
#define GRAT_VAL_TOL 4
#define SKY_FLUX 0
......
......@@ -1581,12 +1581,22 @@ sinfo_new_average_cube_to_image(cpl_imagelist * cube)
float* podata=NULL;
cpl_image* i_img=NULL;
cpl_error_ensure(cube != NULL, CPL_ERROR_NULL_INPUT, return NULL,
"null input cube!");
if ( cube == NULL )
{
sinfo_msg_error ("null cube") ;
return NULL ;
}
inp=cpl_imagelist_get_size(cube);
if ( inp <= 0 )
{
sinfo_msg_error ("input cube of size 0!") ;
}
cpl_error_ensure(inp > 0, CPL_ERROR_ILLEGAL_INPUT, return NULL,
"input cube of size 0!");
i_img=cpl_imagelist_get(cube,0);
ilx=cpl_image_get_size_x(i_img);
ily=cpl_image_get_size_y(i_img);
......
......@@ -251,6 +251,9 @@ sinfo_new_find_distortions(const char* plugin_id,
/* find the emission lines in each image column */
sinfo_new_intarray_set_value(sum_pointer, 0, 0);
//cpl_image_save(im, "pippo.fits", CPL_BPP_IEEE_FLOAT, NULL, CPL_IO_DEFAULT);
sinfo_msg("minDiff=%f halfWidth=%d sigma=%f",