Commit 79aaf029 authored by Ole Streicher's avatar Ole Streicher

New upstream version 4.1.7

parent 110cbde7
Version 4.1.7
-------------
* Adapt to new data format written since February 2016.
* Allow reduction of now commissioned Aquarius Burst mode data.
* Updated Reflex tutorial.
* Fix too many open file issues on some platforms.
* Updated Reflex data association rules.
* Tune default Gasgano display columns to Aquarius data.
* A few usuability improvements for Reflex Imaging GUI.
2005-02-03: Ambiguous detection of INS setting with WLEN 12.2 micron, RESOL HRS
2005-02-03: Parameters of detector warp, RESOL HRG
......@@ -17,7 +17,7 @@ DBOBS_SERVER_URL=jdbc:sybase:Tds:
DBOBS_USERID=
DB_SERVER_URL=jdbc:sybase:Tds:
DB_USER_NAME=qc
DISPLAY_COLUMNS=CLASSIFICATION:INS.FILT1.NAME:DET.NDIT:SEQ.WEATHER:TEL.AIRM.START:SEQ.CHOPNOD.DIR:SEQ.TIME:TPL.ID:INS.GRAT1.WLEN:DET.DIT:INS.PFOV
DISPLAY_COLUMNS=CLASSIFICATION:INS.FILT1.NAME:DET.NDIT:TEL.AIRM.START:SEQ.CHOPNOD.DIR:SEQ.TIME:TPL.ID:TPL.START:INS.GRAT1.WLEN:DET.SEQ1.DIT:INS.PFOV
DISPLAY_COLUMNS_SIZE=0:0:0:0:0
FILTER_FILE=gasgano/filter.rul
FITS_TO_VIEWER=skycat
......@@ -42,7 +42,7 @@ PRINTER_NAME=lp
PRINT_FONT=Monospaced:16
PRINT_ORIENTATION=P
RADEC_CONVERSION=true
RECIPE_SET=visir_img_reduce=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.0/visir_img_reduce.so;visir_spc_reduce=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.0/visir_spc_reduce.so;visir_util_repack=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.0/visir_util_repack.so;visir_util_img_std_cat=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.0/visir_util_img_std_cat.so;visir_util_spc_std_cat=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.0/visir_util_spc_std_cat.so;visir_util_spc_txt2fits=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.0/visir_util_spc_txt2fits.so
RECIPE_SET=visir_img_reduce=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.7/visir_img_reduce.so;visir_spc_reduce=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.7/visir_spc_reduce.so;visir_util_repack=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.7/visir_util_repack.so;visir_util_img_std_cat=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.7/visir_util_img_std_cat.so;visir_util_spc_std_cat=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.7/visir_util_spc_std_cat.so;visir_util_spc_txt2fits=/home/quality/pipelines/visir/lib/esopipes-plugins/visir-4.1.7/visir_util_spc_txt2fits.so
SCRIPTS_DIR=gasgano/scripts
SHORTEN_FILES_PATH=true
SHORT_FILENAME=false
......
This diff is collapsed.
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for VISIR Instrument Pipeline 4.1.0.
# Generated by GNU Autoconf 2.69 for VISIR Instrument Pipeline 4.1.7.
#
# Report bugs to <llundin@eso.org>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='VISIR Instrument Pipeline'
PACKAGE_TARNAME='visir'
PACKAGE_VERSION='4.1.0'
PACKAGE_STRING='VISIR Instrument Pipeline 4.1.0'
PACKAGE_VERSION='4.1.7'
PACKAGE_STRING='VISIR Instrument Pipeline 4.1.7'
PACKAGE_BUGREPORT='llundin@eso.org'
PACKAGE_URL=''
......@@ -1378,7 +1378,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures VISIR Instrument Pipeline 4.1.0 to adapt to many kinds of systems.
\`configure' configures VISIR Instrument Pipeline 4.1.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1449,7 +1449,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of VISIR Instrument Pipeline 4.1.0:";;
short | recursive ) echo "Configuration of VISIR Instrument Pipeline 4.1.7:";;
esac
cat <<\_ACEOF
......@@ -1577,7 +1577,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
VISIR Instrument Pipeline configure 4.1.0
VISIR Instrument Pipeline configure 4.1.7
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2175,7 +2175,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by VISIR Instrument Pipeline $as_me 4.1.0, which was
It was created by VISIR Instrument Pipeline $as_me 4.1.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -3153,7 +3153,7 @@ fi
# Define the identity of the package.
PACKAGE='visir'
VERSION='4.1.0'
VERSION='4.1.7'
cat >>confdefs.h <<_ACEOF
......@@ -14559,7 +14559,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by VISIR Instrument Pipeline $as_me 4.1.0, which was
This file was extended by VISIR Instrument Pipeline $as_me 4.1.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -14625,7 +14625,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
VISIR Instrument Pipeline config.status 4.1.0
VISIR Instrument Pipeline config.status 4.1.7
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
# Process this file with autoconf to produce a configure script.
AC_INIT([VISIR Instrument Pipeline], [4.1.0], [llundin@eso.org], [visir])
AC_INIT([VISIR Instrument Pipeline], [4.1.7], [llundin@eso.org], [visir])
AC_PREREQ([2.59])
AC_CONFIG_SRCDIR([Makefile.am])
......
......@@ -389,6 +389,7 @@ static int visir_img_reduce(cpl_frameset * framelist,
cpl_recipe * phot = NULL;
cpl_pluginlist * plugins = cpl_pluginlist_new();
cpl_frameset * usedframes = cpl_frameset_new();
cpl_frame * meanfrm = NULL;
skip_if(check_swarp());
......@@ -418,7 +419,7 @@ static int visir_img_reduce(cpl_frameset * framelist,
}
skip_if(visir_run_recipe(repack, repackset, parlist,
&util_repack_set_parameters));
cpl_frame * meanfrm = cpl_frame_duplicate(cpl_frameset_find(repackset, "MEAN"));
meanfrm = cpl_frame_duplicate(cpl_frameset_find(repackset, "MEAN"));
cpl_frameset * shiftset = visir_prepare_frameset(repackset, NULL, 0,
......@@ -449,6 +450,8 @@ static int visir_img_reduce(cpl_frameset * framelist,
cpl_frameset * swarpset = visir_prepare_frameset(shiftset, swarptagmap,
ARRAY_LEN(swarptagmap),
CPL_FALSE);
cpl_frameset_delete(shiftset);
shiftset = NULL;
FOR_EACH_FRAMESET(frm, clipset) {
if (strcmp(cpl_frame_get_tag(frm), VISIR_UTIL_ERROR_MAP) != 0)
continue;
......@@ -456,6 +459,8 @@ static int visir_img_reduce(cpl_frameset * framelist,
cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(swarpset, frame);
}
cpl_frameset_delete(clipset);
clipset = NULL;
skip_if(visir_run_recipe(swarp, swarpset, parlist, &visir_copy_parameters));
irplib_framelist * swarpfl = irplib_framelist_cast(swarpset);
irplib_framelist * qcfl = irplib_framelist_cast(qcset);
......@@ -544,19 +549,21 @@ static int visir_img_reduce(cpl_frameset * framelist,
cpl_frameset_insert(framelist, cpl_frame_duplicate(frm));
cpl_frameset_delete(joinset);
cpl_frameset_insert(framelist, meanfrm);
meanfrm = NULL;
skip_if(0);
}
end_skip;
{
cpl_recipe * recipes[] = {repack, shift, clip, qc, swarp, phot};
cpl_recipe * recipes[] = {repack, shift, clip, qc, swarp, phot, join};
for (size_t i = 0; i < ARRAY_LEN(recipes); i++)
if (recipes[i])
cpl_plugin_delete(&(recipes[i]->interface));
}
cpl_pluginlist_delete(plugins);
cpl_frame_delete(meanfrm);
cpl_frameset_delete(photset);
cpl_frameset_delete(usedframes);
......
......@@ -223,6 +223,9 @@ propagate_qc_header(cpl_propertylist * qclist, const cpl_propertylist * ppqc)
s = cpl_propertylist_get_string(ppqc, "BUNIT");
cpl_propertylist_append_string(qclist, "BUNIT", s);
s = cpl_propertylist_get_string(ppqc, "ESO DRS CATG");
cpl_propertylist_append_string(qclist, "ESO DRS CATG", s);
d = cpl_propertylist_get_double(ppqc, "ESO QC BACKGD MEAN");
cpl_propertylist_append_double(qclist, "ESO QC BACKGD MEAN", d);
......@@ -1265,8 +1268,10 @@ static int visir_img_phot_flux_one(const cpl_image * combined,
* only the int cast is used later, so pixel precision of
* maxpos is ok */
cpl_size yp, xp;
cpl_image_get_maxpos_window(combined, x - 5, y - 5,
x + 5, y + 5, &xp, &yp);
cpl_image_get_maxpos_window(combined,
CX_MAX(1, x - 5), CX_MAX(1, y - 5),
CX_MIN(cpl_image_get_size_x(combined), x + 5),
CX_MIN(cpl_image_get_size_y(combined), y + 5), &xp, &yp);
x = xp;
y = yp;
}
......@@ -2124,6 +2129,10 @@ static cpl_error_code visir_get_filter_infos(
else if (!strcmp(f, "Q4")) { cwlen = 20.5;dwlen = 1.0;}
else if (!strcmp(f, "Q7")) { cwlen = 23.1;dwlen = 0.8;}
else if (!strcmp(f, "Q8")) { cwlen = 24.5;dwlen = 0.8;}
/* TODO missing bandwidth for coro filters not determined yet */
else if (!strcmp(f, "10_5_4QP")) { cwlen = 10.5;dwlen =0.1;}
else if (!strcmp(f, "11_3_4QP")) { cwlen = 11.3;dwlen =0.1;}
else if (!strcmp(f, "12_4_AGP")) { cwlen = 12.4;dwlen =0.1;}
else if (!strcmp(f, "N-SW-spec") || !strcmp(f, "N_SW_spec"))
{ cwlen = 8.85; dwlen = 2.7;}
else if (!strcmp(f, "H2S4-spec") || !strcmp(f, "H2S4_spec"))
......
......@@ -387,6 +387,9 @@ static int visir_spc_reduce(cpl_frameset * framelist,
if (cpl_frameset_find(repackset, VISIR_CALIB_STATIC_MASK)) {
nrep--;
}
if (cpl_frameset_find(repackset, VISIR_CALIB_STATIC_MASK_SPC)) {
nrep--;
}
if (cpl_frameset_count_tags(repackset, VISIR_SPC_OBS_ECH_RAW) == nrep) {
input_tag = VISIR_SPC_OBS_ECH_PP;
}
......
......@@ -623,13 +623,13 @@ static cpl_error_code visir_spc_obs_save(cpl_frameset * set,
bug_if (0);
/* THE TABLE */
cpl_propertylist_update_string(qclist, "EXTNAME", "TAB_SPECTRUM");
skip_if (irplib_dfs_save_table(set, parlist, set, table, NULL, RECIPE_SAVE_STRING,
tab_procatg,
qclist, NULL, visir_pipe_id,
RECIPE_SAVE_STRING "_tab" CPL_DFS_FITS));
/* save in single file with extensions for consistency with imaging */
cpl_propertylist * plist = cpl_propertylist_new();
cpl_propertylist_update_string(plist, "EXTNAME", "TAB_SPECTRUM");
skip_if (irplib_dfs_save_table(set, parlist, set, table, plist,
RECIPE_SAVE_STRING, tab_procatg,
qclist, NULL, visir_pipe_id,
RECIPE_SAVE_STRING "_tab" CPL_DFS_FITS));
/* save in single file with extensions for consistency with imaging */
cpl_propertylist_update_string(plist, "EXTNAME", "IMG_COMBINED");
skip_if(cpl_image_save(combined, RECIPE_SAVE_STRING "_tab" CPL_DFS_FITS,
CPL_TYPE_FLOAT, plist, CPL_IO_EXTEND));
......
......@@ -1239,8 +1239,16 @@ cpl_error_code visir_util_detect_shift_one(cpl_frameset * framelist,
skip_if(0);
}
if (!visir_str_par_is_empty(sbeampos))
if (!visir_str_par_is_empty(sbeampos)) {
beampos = parse_beampos_cmd(sbeampos);
/* adapt input beampos to unilluminated cut on aqu data */
if (is_aqu_data) {
FOR_EACH_T(beam_info * bi, beampos) {
bi->x -= cpl_image_get_size_x(av) == 1024 - 22 - (1024 - 878 - 1) ? 22 : 0;
bi->y -= cpl_image_get_size_y(av) == 1024 - 92 - (1024 - 948 - 1) ? 92 : 0;
}
}
}
else
beampos = get_beam_positions(av, parlist, mplist);
......@@ -1372,6 +1380,7 @@ OMP_PRAGMA(omp single)
skip_if(cpl_wcs_convert(wcs, from, &to, &status, CPL_WCS_PHYS2WORLD));
template->crval1 = cpl_matrix_get(to, 0, 0);
template->crval2 = cpl_matrix_get(to, 0, 1);
cpl_wcs_delete(wcs);
cpl_matrix_delete(from);
cpl_matrix_delete(to);
cpl_array_delete(status);
......
......@@ -129,7 +129,7 @@ static int visir_util_img_std_cat(cpl_frameset * framelist,
"PAH2_1", "SIV_2", "PAH2", "PAH2_2", "NEII_1", "NEII", "NEII_2",
"J7_9", "J8_9", "J9_8", "J12_1", "J12_2", "B8_7", "B9_7", "B10_7",
"B11_7", "B12_4", "Q0", "QH2", "Q1", "Q2", "Q3", "Q4", "Q7", "Q8",
"AGPM_12_4", "4QPM_10_5", "4QPM_11_3", "N_SW_spec",
"12_4_AGP", "10_5_4QP", "11_3_4QP", "N_SW_spec",
"H2S4_spec", "ARIII_spec", "NEII_2_spec", "H2S3_spec", "H2S1_spec",
};
const int nfilters = sizeof(filters) / sizeof(filters[0]);
......
......@@ -253,6 +253,7 @@ cpl_error_code visir_util_join_one(cpl_frameset * framelist,
cpl_image * img = NULL;
cpl_image * csum = NULL;
const char * bunit = NULL;
char * inpcatg = NULL;
cpl_image * bpm = NULL;
cpl_image * err = NULL;
......@@ -274,15 +275,6 @@ cpl_error_code visir_util_join_one(cpl_frameset * framelist,
frame = irplib_framelist_get_const(rawframes, i);
filename = cpl_frame_get_filename(frame);
if (!strcmp(cpl_frame_get_tag(frame), VISIR_IMG_PHOT_ONEBEAM_PROCATG))
procatg = VISIR_IMG_PHOT_ONEBEAM_PROCATG;
else if (!strcmp(cpl_frame_get_tag(frame), VISIR_IMG_PHOT_COMBINED_PROCATG))
procatg = VISIR_IMG_PHOT_COMBINED_PROCATG;
else if (!strcmp(cpl_frame_get_tag(frame), "COADDED_IMAGE_COMBINED"))
procatg = "IMG_OBJ_COMBINED";
else if (!strcmp(cpl_frame_get_tag(frame), "COADDED_IMAGE"))
procatg = "IMG_OBJ_ONEBEAM";
img_plist = cpl_propertylist_load(filename, 0);
skip_if(img_plist == NULL);
......@@ -292,18 +284,39 @@ cpl_error_code visir_util_join_one(cpl_frameset * framelist,
if (qcframes) {
frame = irplib_framelist_get_const(qcframes, qcshared ? 0 : i);
filename = cpl_frame_get_filename(frame);
qc_plist = cpl_propertylist_load_regexp(filename, 0, "ESO QC |BUNIT", CPL_FALSE);
qc_plist = cpl_propertylist_load_regexp(filename, 0,
"ESO QC |BUNIT|ESO DRS CATG", CPL_FALSE);
skip_if (qc_plist == NULL);
if (cpl_propertylist_has(qc_plist, "BUNIT")) {
bunit = cpl_propertylist_get_string(qc_plist, "BUNIT");
}
if (cpl_propertylist_has(qc_plist, "ESO DRS CATG")) {
inpcatg =
cpl_strdup(cpl_propertylist_get_string(qc_plist, "ESO DRS CATG"));
cpl_propertylist_erase(qc_plist, "ESO DRS CATG");
}
}
if (bunit == NULL && cpl_propertylist_has(img_plist, "BUNIT")) {
bunit = cpl_propertylist_get_string(img_plist, "BUNIT");
}
if (inpcatg == NULL && cpl_propertylist_has(img_plist, "ESO DRS CATG")) {
inpcatg =
cpl_strdup(cpl_propertylist_get_string(img_plist, "ESO DRS CATG"));
cpl_propertylist_erase(img_plist, "ESO DRS CATG");
}
cpl_propertylist_append(img_plist, qc_plist);
if (!strcmp(cpl_frame_get_tag(frame), VISIR_IMG_PHOT_ONEBEAM_PROCATG))
procatg = VISIR_IMG_PHOT_ONEBEAM_PROCATG;
else if (!strcmp(cpl_frame_get_tag(frame), VISIR_IMG_PHOT_COMBINED_PROCATG))
procatg = VISIR_IMG_PHOT_COMBINED_PROCATG;
else if (!strcmp(cpl_frame_get_tag(frame), "COADDED_IMAGE_COMBINED"))
procatg = VISIR_IMG_OBJ_COMBINED_PROCATG;
else if (!strcmp(cpl_frame_get_tag(frame), "COADDED_IMAGE"))
procatg = VISIR_IMG_OBJ_ONEBEAM_PROCATG;
procatg = visir_dfs_output_catg(inpcatg, procatg);
if (cpl_propertylist_has(img_plist, "ESO QC BEAMID")) {
const char * b = cpl_propertylist_get_string(img_plist,
......@@ -465,6 +478,69 @@ cpl_error_code visir_util_join_one(cpl_frameset * framelist,
}
skip_if(0);
/* try to compute gauss fwhm also for science images, may fail (PIPE-6158) */
if (!cpl_propertylist_has(img_plist, "ESO QC GAUSSFIT FWHM_MAX")) {
cpl_errorstate cleanstate = cpl_errorstate_get();
double fwhm_x = -1., fwhm_y = -1.,
peak = -1., peak_err = 0.,
major = -1., major_err = 0.,
minor = -1., minor_err = 0.,
angle = -1., angle_err = 0.;
cpl_size x_pos = cpl_propertylist_get_double(img_plist, "CRPIX1");
cpl_size y_pos = cpl_propertylist_get_double(img_plist, "CRPIX2");
cpl_image * lwgt = wgt;
/* Compute the FWHM */
cpl_image_get_fwhm(img, (int)x_pos, (int)y_pos, &fwhm_x, &fwhm_y);
if (lwgt == NULL) {
lwgt = cpl_image_new(cpl_image_get_size_x(img), cpl_image_get_size_y(img), CPL_TYPE_DOUBLE);
cpl_image_add_scalar(lwgt, 1);
}
if (fit_2d_gauss(img, lwgt, (cpl_size)x_pos, (cpl_size)y_pos,
fwhm_x, fwhm_y, &peak, &peak_err,
&major, &major_err, &minor, &minor_err,
&angle, &angle_err) == CPL_ERROR_NONE) {
cpl_msg_info(cpl_func, "Peak: %g +- %g, FWHM : %g +- %g major ; %g +- %g minor, "
"angle %g +- %g", peak, peak_err,
major, major_err, minor, minor_err,
angle * CPL_MATH_DEG_RAD,
angle_err * CPL_MATH_DEG_RAD);
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MAX",
major);
cpl_propertylist_set_comment(img_plist, "ESO QC GAUSSFIT FWHM_MAX",
"major axis [pix]");
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MAX_ERR",
major_err);
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MIN",
minor);
cpl_propertylist_set_comment(img_plist, "ESO QC GAUSSFIT FWHM_MIN",
"minor axis [pix]");
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MIN_ERR",
minor_err);
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT ANGLE",
angle * CPL_MATH_DEG_RAD);
cpl_propertylist_set_comment(img_plist, "ESO QC GAUSSFIT ANGLE",
"[deg]");
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT ANGLE_ERR",
angle_err * CPL_MATH_DEG_RAD);
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT PEAK",
peak);
cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT PEAK_ERR",
peak_err);
}
else {
cpl_msg_warning(cpl_func, "2D gauss fit failed, approximate FWHM : %g"
"in x ; %g in y ", fwhm_x, fwhm_y);
}
if (lwgt != wgt) {
cpl_image_delete(lwgt);
}
/* ignore all errors */
cpl_errorstate_set(cleanstate);
}
skip_if(irplib_dfs_save_image(products, parlist, usedframes,
img, CPL_TYPE_UNSPECIFIED,
RECIPE_STRING,
......@@ -520,6 +596,7 @@ cpl_error_code visir_util_join_one(cpl_frameset * framelist,
cpl_image_delete(bpm);
cpl_image_delete(csum);
cpl_free(proname);
cpl_free(inpcatg);
cpl_propertylist_delete(img_plist);
cpl_propertylist_delete(err_plist);
cpl_propertylist_delete(wgt_plist);
......
This diff is collapsed.
......@@ -597,7 +597,7 @@ cut_bad_edges(cpl_image ** img, cpl_image ** wgt, cpl_image ** ctr,
const cpl_size nx = cpl_image_get_size_x(*ctr);
const cpl_size ny = cpl_image_get_size_y(*ctr);
const cpl_size max_contrib = cpl_image_get_max(*ctr);
const double ctr_cutoff = 0.7;
const double ctr_cutoff = max_contrib == 2 ? 0.4 : 0.7;
cpl_size cutly = 0;
cpl_size cutuy = 0;
cpl_size cutlx = 0;
......@@ -645,14 +645,23 @@ cut_bad_edges(cpl_image ** img, cpl_image ** wgt, cpl_image ** ctr,
cpl_msg_info(cpl_func, "Cutting low contribution edges "
"llx: %lld, lly: %lld, urx: %lld, ury: %lld",
cutlx, cutly, cutux, cutuy);
cpl_propertylist_set_double(plist, "CRPIX1",
cpl_propertylist_get_double(plist, "CRPIX1") - cutlx);
cpl_propertylist_set_double(plist, "CRPIX2",
cpl_propertylist_get_double(plist, "CRPIX2") - cutly);
cpl_image * nimg = cpl_image_extract(*img, cutlx, cutly, cutux, cutuy);
cpl_image * nwgt = cpl_image_extract(*wgt, cutlx, cutly, cutux, cutuy);
cpl_image * nctr = cpl_image_extract(*ctr, cutlx, cutly, cutux, cutuy);
/* make sure to only cut if something remains */
cpl_image * nimg, * nwgt, * nctr;
if (cutlx < cutux && cutly < cutuy) {
cpl_propertylist_set_double(plist, "CRPIX1",
cpl_propertylist_get_double(plist, "CRPIX1") - cutlx);
cpl_propertylist_set_double(plist, "CRPIX2",
cpl_propertylist_get_double(plist, "CRPIX2") - cutly);
nimg = cpl_image_extract(*img, cutlx, cutly, cutux, cutuy);
nwgt = cpl_image_extract(*wgt, cutlx, cutly, cutux, cutuy);
nctr = cpl_image_extract(*ctr, cutlx, cutly, cutux, cutuy);
}
else {
nimg = cpl_image_duplicate(*img);
nwgt = cpl_image_duplicate(*wgt);
nctr = cpl_image_duplicate(*ctr);
}
cpl_image_delete(*img);
cpl_image_delete(*wgt);
cpl_image_delete(*ctr);
......
......@@ -504,6 +504,7 @@ static void update_exectime(const cpl_frame * frm, double * t_min_obsstart,
cpl_propertylist * plist = cpl_propertylist_load(cpl_frame_get_filename(frm), 0);
if (plist == NULL || !cpl_propertylist_has(plist, "ESO DRS DATE") ||
!cpl_propertylist_has(plist, "ESO DRS DATE-OBS")) {
cpl_propertylist_delete(plist);
return;
}
*t_max_filewrite =
......@@ -512,6 +513,7 @@ static void update_exectime(const cpl_frame * frm, double * t_min_obsstart,
*t_min_obsstart =
CX_MIN(cpl_propertylist_get_double(plist, "ESO DRS DATE-OBS"),
*t_min_obsstart);
cpl_propertylist_delete(plist);
}
/*----------------------------------------------------------------------------*/
......@@ -671,12 +673,14 @@ static int visir_util_undistort(cpl_frameset * framelist,
cpl_frame_set_group(frm, CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(usedframes, cpl_frame_duplicate(frm));
}
cx_list_destroy(on_frames, (visir_free)cpl_frame_delete);
FOR_EACH_T(cpl_frame * frm, off_frames) {
update_exectime(frm, &t_min_obsstart, &t_max_filewrite);
vimglist_append(aoff, load_images(frm, bpm));
cpl_frame_set_group(frm, CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(usedframes, cpl_frame_duplicate(frm));
}
cx_list_destroy(off_frames, (visir_free)cpl_frame_delete);
base = cpl_image_duplicate(visir_imglist_get_img(aoff, 0));
if (visir_data_is_aqu(data_type))
......@@ -699,12 +703,15 @@ static int visir_util_undistort(cpl_frameset * framelist,
cpl_frame_set_group(frm, CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(usedframes, cpl_frame_duplicate(frm));
}
cx_list_destroy(on_frames, (visir_free)cpl_frame_delete);
FOR_EACH_T(cpl_frame * frm, off_frames) {
update_exectime(frm, &t_min_obsstart, &t_max_filewrite);
vimglist_append(boff, load_images(frm, bpm));
cpl_frame_set_group(frm, CPL_FRAME_GROUP_RAW);
cpl_frameset_insert(usedframes, cpl_frame_duplicate(frm));
}
cx_list_destroy(off_frames, (visir_free)cpl_frame_delete);
if (base == NULL) {
base = cpl_image_duplicate(visir_imglist_get_img(boff, 0));
if (visir_data_is_aqu(data_type))
......
......@@ -339,15 +339,18 @@ class DataPlotterManager:
f.get(), x, y))
def report_pixel(self, plt, x, y):
xorig, yorig = x, y
if hasattr(plt, 'scale_coord'):
x, y = plt.scale_coord(x, y)
if numpy.array(plt.data).size and \
y > 0 and x > 0 and \
x < plt.data.shape[1] and y < plt.data.shape[0]:
return "x=%s y=%s value=%s" % (plt.ax.format_xdata(x),
plt.ax.format_ydata(y),
plt.ax.format_ydata(plt.data[y, x]))
return "x=%s y=%s value=%s" % (plt.ax.format_xdata(xorig),
plt.ax.format_ydata(yorig),
plt.ax.format_ydata(plt.data[int(y), int(x)]))
else:
return "x=%s y=%s" % (plt.ax.format_xdata(x),
plt.ax.format_ydata(y))
return "x=%s y=%s" % (plt.ax.format_xdata(xorig),
plt.ax.format_ydata(yorig))
def plotProductsGraphics(self, figure, canvas):
if len(self.fits['BEAM_DETECTED']) == 0:
......@@ -485,6 +488,17 @@ class DataPlotterManager:
scatterdisp.setLabels('X [pixel]', 'Y [pixel]')
scatterdisp.display(self.plt['shifts'].ax, title_scatter,
tooltip_scatter, scatx, scaty)
# add a histogram for many points
if (len(scatx) > 50):
self.plt['shifts'].data, binsx, binsy, aximg = \
self.plt['shifts'].ax.hist2d(scatx, scaty, bins=25, alpha=0.75)
aximg.set_cmap('gray')
def shift_scale(x, y):
# x, y transposed in data array
return ((y - binsy[0]) / numpy.diff(binsy[:2]),
(x - binsx[0]) / numpy.diff(binsx[:2]))
self.plt['shifts'].scale_coord = shift_scale
self.plt['shifts'].ax.format_coord = types.MethodType(self.report_pixel, self.plt['shifts'])
self.plt['shifts'].figure.canvas.draw()
def setInteractiveParameters(self):
......@@ -514,6 +528,15 @@ brightest: use the position of the brightest pixel"""),
]
return paramList
def verifyParameters(self, params):
if params['no-reject']['value'].upper() == 'TRUE':
if any((not params['max-mad']['isdefault'],
not params['min-correlation']['isdefault'],
not params['max-shift']['isdefault'])):
return 'Rejection parameters changed but "no-reject" is ' \
'still set. In order to reject frames this must be unset.'
return None
#This is the 'main' function
if __name__ == '__main__':
......
......@@ -146,10 +146,10 @@ A checked box represents a positive beam and an unchecked box a negative beam.
return idx
def check_sign(self, x, y, w, d):
lx = max(0, x - w / 3)
ly = max(0, y - w / 3)
hx = min(d.shape[1], x + w / 3)
hy = min(d.shape[0], y + w / 3)
lx = int(max(0, x - w / 3))
ly = int(max(0, y - w / 3))
hx = int(min(d.shape[1], x + w / 3))
hy = int(min(d.shape[0], y + w / 3))
dc = d[ly:hy, lx:hx] - np.median(d[ly:hy, lx:hx])
if abs(dc.sum()) < dc.std() * np.sqrt(dc.size) * 2:
while True:
......@@ -206,6 +206,7 @@ class ParamWidget:
style=(wx.TE_PROCESS_ENTER |
wx.TE_RIGHT))
self.set_value(param.value)
self.default = self.get_value()
if param.description:
self.paramCtrl.SetToolTipString(param.description)
......@@ -216,6 +217,9 @@ class ParamWidget:
v = self.paramCtrl.GetPath()
return self.param.to_string(self.param.type, v)
def is_default(self):
return self.get_value() == self.default
def set_value(self, value):
try:
self.paramCtrl.SetValue(value)
......@@ -233,8 +237,11 @@ class ReflexBaseGui(wx.App):
def OnInit(self):
respath = os.path.join(os.path.dirname(__file__), 'reflexgui.xrc')
# the same but copied to avoid breakage
#respath = os.path.join(os.path.dirname(reflex.__file__),
# 'reflex_interactive_gui.xrc')
self.res = xrc.XmlResource(respath)
self.frame = self.res.LoadFrame(None, 'ReflexGui')
self.frame = self.res.LoadFrame(None, 'ReflexInteractiveWxApp')
if not self.frame:
raise Exception("Frame not found")
......@@ -242,6 +249,9 @@ class ReflexBaseGui(wx.App):
self.frame.SetTitle(self.dm.setWindowTitle())
self.plotPanel = xrc.XRCCTRL(self.frame, 'plotPanel')
self.ctrlPanel = xrc.XRCCTRL(self.frame, 'ctrlPanel')
self.ctrlPanel.SetScrollbars(0, 1, 0, 1)
self.ctrlPanel.SetAutoLayout(1)
self.statusBar = xrc.XRCCTRL(self.frame, 'statusBar')
self.parameterNotebook = xrc.XRCCTRL(self.frame, 'parameterNotebook')
self.setDisableCheck = xrc.XRCCTRL(self.frame, 'setDisableCheck')
......@@ -250,9 +260,21 @@ class ReflexBaseGui(wx.App):
self.Bind(wx.EVT_BUTTON, self.onRepeat, id=xrc.XRCID('repeatBtn'))
self.Bind(wx.EVT_BUTTON, self.onHelp, id=xrc.XRCID('helpBtn'))
self.Bind(wx.EVT_CHECKBOX, self.onSetDisable, self.setDisableCheck)
self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.onFileInfoPaneChanged)
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onItemSelected)
self.dm.readFitsData(self.io.inputs.in_sof.files +
self.io.inputs.in_sof_rec_orig.files)
self.datasetInfoText = xrc.XRCCTRL(self.frame, 'datasetInfoText')
self.datasetInfoText.SetLabel("This data belongs to dataset:\n%s" %
self.io.inputs.in_sof.datasetName)
self.filesInfo = xrc.XRCCTRL(self.frame, 'filesInfo')
self.filesList = xrc.XRCCTRL(self.frame, 'filesList')
self.setInitSopCheck = xrc.XRCCTRL(self.frame, 'setInitSopCheck')
if(not self.io.is_init_sop_enable()):
self.setInitSopCheck.Hide()
self.setFilesInfo()
self.setupParameters()
self.createPlots()
self.frame.Show()
......@@ -314,9 +336,37 @@ class ReflexBaseGui(wx.App):
self.needs_resize = False
wx.WakeUpIdle()
def onFileInfoPaneChanged(self, event):
self.ctrlPanel.FitInside()
def onItemSelected(self, event):
clipData = wx.TextDataObject()
clipData.SetText(self.all_fitsFiles[self.filesList.GetFocusedItem()].name)
wx.TheClipboard.Open()
wx.TheClipboard.SetData(clipData)
wx.TheClipboard.Close()
def setFilesInfo(self):
self.filesInfo.Collapse()
self.filesList.InsertColumn(0, "Category")
self.filesList.InsertColumn(1, "File Name")
self.all_fitsFiles = self.io.inputs.in_sof.files + \
self.io.inputs.in_sof_rec_orig.files
for file in self.all_fitsFiles:
self.filesList.Append([file.category, file.name])
self.filesList.SetColumnWidth(0, wx.LIST_AUTOSIZE)
self.filesList.SetColumnWidth(1, wx.LIST_AUTOSIZE)
self.filesList.SetToolTipString("List of files that have been an"
"input of this window. If you click on a particular file, you"
" can double click or press Ctrl-C to copy the full path name"
" onto the clipboard.")
def setupParameters(self):
parTab = xrc.XRCCTRL(self.frame, 'parameterTab')
parGrid = parTab.GetSizer()
parTab = xrc.XRCCTRL(self.frame, 'parameterPanel')
parTab.SetMinSize((170, 340))
parGrid = wx.FlexGridSizer(cols=2, vgap=0, hgap=0)
parGrid.AddGrowableCol(1)
parTab.SetSizer(parGrid, 1)
sop_params = dict()
for p in self.io.inputs.in_sop:
......@@ -340,6 +390,24 @@ class ReflexBaseGui(wx.App):
self.dm.parWidgets = self.paramWidgets
def onCont(self, event):
changed = []
for p in self.paramWidgets.values():
if not p.is_default():
changed.append(p.param.name)
if changed:
if len(changed) > 1:
s = 'Parameters "%s" have been changed.' % ','.join(changed)
else:
s = 'Parameter" %s" has been changed.' % changed[0]
dlg = wx.MessageDialog(self.frame,
"%s To take effect the recipe must be rerun. "
"Discard changes and continue?" % s,
"Confirm",
wx.OK | wx.CANCEL)
result = dlg.ShowModal()