HAWKI Pipeline Reference Manual  1.8.12
hawki_obj_det.c
1 /* $Id: hawki_obj_det.c,v 1.2 2009/09/29 09:13:00 cgarcia Exp $
2  *
3  * This file is part of the HAWKI Pipeline
4  * Copyright (C) 2002,2003 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 /*
22  * $Author: cgarcia $
23  * $Date: 2009/09/29 09:13:00 $
24  * $Revision: 1.2 $
25  * $Name: hawki-1_8_12 $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 /*-----------------------------------------------------------------------------
33  Includes
34  -----------------------------------------------------------------------------*/
35 
36 #include <float.h>
37 #include <string.h>
38 #include <math.h>
39 #include <cpl.h>
40 
41 #include "hawki_dfs.h"
42 #include "hawki_utils.h"
43 #include "hawki_pfits.h"
44 #include "hawki_obj_det.h"
45 
46 /*----------------------------------------------------------------------------*/
50 /*----------------------------------------------------------------------------*/
51 
54 /*----------------------------------------------------------------------------*/
68 (cpl_table ** objs_prop, cpl_propertylist ** objs_prop_stats)
69 {
70  cpl_errorstate prestate = cpl_errorstate_get();
71  int idet;
72 
73  /* Checking input */
74  if(objs_prop == NULL || objs_prop_stats == NULL)
75  {
76  cpl_msg_error(__func__, "The property list or the tel table is null");
77  return -1;
78  }
79 
80  /* Compute the statistics */
81  for(idet = 0; idet < HAWKI_NB_DETECTORS; ++idet)
82  {
83  cpl_propertylist_append_double
84  (objs_prop_stats[idet], "ESO QC OBJ ANGLE MEAN",
85  cpl_table_get_column_mean(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
86  cpl_propertylist_append_double
87  (objs_prop_stats[idet], "ESO QC OBJ ANGLE MED",
88  cpl_table_get_column_median(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
89  cpl_propertylist_append_double
90  (objs_prop_stats[idet], "ESO QC OBJ ANGLE MIN",
91  cpl_table_get_column_min(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
92  cpl_propertylist_append_double
93  (objs_prop_stats[idet], "ESO QC OBJ ANGLE MAX",
94  cpl_table_get_column_max(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
95  cpl_propertylist_append_double
96  (objs_prop_stats[idet], "ESO QC OBJ ANGLE STDEV",
97  cpl_table_get_column_stdev(objs_prop[idet], HAWKI_COL_OBJ_ANGLE));
98 
99  cpl_propertylist_append_double
100  (objs_prop_stats[idet], "ESO QC OBJ ELLIP MEAN",
101  cpl_table_get_column_mean(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
102  cpl_propertylist_append_double
103  (objs_prop_stats[idet], "ESO QC OBJ ELLIP MED",
104  cpl_table_get_column_median(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
105  cpl_propertylist_append_double
106  (objs_prop_stats[idet], "ESO QC OBJ ELLIP MIN",
107  cpl_table_get_column_min(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
108  cpl_propertylist_append_double
109  (objs_prop_stats[idet], "ESO QC OBJ ELLIP MAX",
110  cpl_table_get_column_max(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
111  cpl_propertylist_append_double
112  (objs_prop_stats[idet], "ESO QC OBJ ELLIP STDEV",
113  cpl_table_get_column_stdev(objs_prop[idet], HAWKI_COL_OBJ_ELLIP));
114  }
115 
116  if(!cpl_errorstate_is_equal(prestate))
117  return -1;
118  return 0;
119 }
120