vircam_imcore.c

00001 /* $Id: vircam_imcore.c,v 1.21 2007/05/02 09:13:57 jim Exp $
00002  *
00003  * This file is part of the VIRCAM Pipeline
00004  * Copyright (C) 2005 Cambridge Astronomy Survey Unit
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: jim $
00023  * $Date: 2007/05/02 09:13:57 $
00024  * $Revision: 1.21 $
00025  * $Name:  $
00026  */
00027 
00028 /* Includes */
00029 
00030 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033 
00034 #include "vircam_mods.h"
00035 #include "vircam_utils.h"
00036 #include "vircam_fits.h"
00037 #include "catalogue/imcore.h"
00038 
00041 /*---------------------------------------------------------------------------*/
00129 /*---------------------------------------------------------------------------*/
00130 
00131 extern int vircam_imcore(vir_fits *infile, vir_fits *conf, int ipix,
00132                          float threshold, int icrowd, float rcore, int nbsize,
00133                          int cattyp, float filtfwhm, vir_tfits **outtab, 
00134                          int *status) {
00135     int retval;
00136     const char *fctid = "vircam_imcore";
00137     cpl_propertylist *plist;
00138     vir_fits *in,*c;
00139 
00140     /* Inherited status */
00141 
00142     *outtab = NULL;
00143     if (*status != VIR_OK)
00144         return(*status);
00145 
00146     /* Copy the input */
00147 
00148     cattype = cattyp;
00149     in = vircam_fits_duplicate(infile);
00150     c = vircam_fits_duplicate(conf);
00151 
00152     /* Call the main processing routine and get the catalogue */
00153 
00154     retval = imcore_conf(in,c,ipix,threshold,icrowd,rcore,nbsize,cattype,
00155                          filtfwhm,outtab);
00156     vircam_fits_delete(in);
00157     vircam_fits_delete(c);
00158     if (retval != VIR_OK)
00159         FATAL_ERROR;
00160     if (cpl_table_get_nrow(vircam_tfits_get_table(*outtab)) == 0) {
00161         cpl_msg_warning(fctid,"No objects found in %s",
00162                         vircam_fits_get_fullname(infile));
00163         freetfits(*outtab);
00164         WARN_RETURN
00165     }
00166 
00167     /* Get the property list from the input frame */
00168 
00169     plist = vircam_fits_get_phu(infile);
00170     if (plist == NULL) {
00171         cpl_msg_error(fctid,"Unable to open propertylist %s",
00172                       vircam_fits_get_filename(infile));
00173         FATAL_ERROR
00174     }
00175 
00176     /* Do the classification */
00177 
00178     retval = classify(*outtab,plist,cattype);
00179     if (retval != VIR_OK) 
00180         WARN_RETURN
00181 
00182     GOOD_STATUS
00183 }
00184 
00187 /*
00188 
00189 $Log: vircam_imcore.c,v $
00190 Revision 1.21  2007/05/02 09:13:57  jim
00191 Changed api so that outtab is now a vir_tfits structure
00192 
00193 Revision 1.20  2007/03/29 12:19:39  jim
00194 Little changes to improve documentation
00195 
00196 Revision 1.19  2007/03/01 12:42:41  jim
00197 Modified slightly after code checking
00198 
00199 Revision 1.18  2006/11/27 12:06:27  jim
00200 Tarted up some docs
00201 
00202 Revision 1.17  2006/08/07 14:20:31  jim
00203 Now duplicates input so that imcore doesn't write over it
00204 
00205 Revision 1.16  2006/08/01 11:27:53  jim
00206 Modifications to imcore background estimation and to add ability to
00207 specify the smoothing kernel width
00208 
00209 Revision 1.15  2006/07/11 14:52:47  jim
00210 Fixed possible memory leak
00211 
00212 Revision 1.14  2006/06/08 14:49:35  jim
00213 If the imcore_conf call generates a table with no rows, then it proceeds
00214 no further
00215 
00216 Revision 1.13  2006/06/08 09:03:49  jim
00217 Initialise outtab and extra to be NULL
00218 
00219 Revision 1.12  2006/03/23 21:18:49  jim
00220 Minor changes mainly to comment headers
00221 
00222 Revision 1.11  2006/03/22 13:58:32  jim
00223 Cosmetic fixes to keep lint happy
00224 
00225 Revision 1.10  2006/03/01 10:31:28  jim
00226 Now uses new vir_fits objects
00227 
00228 Revision 1.9  2006/02/22 10:08:58  jim
00229 Added status variable to call
00230 
00231 Revision 1.8  2006/02/18 11:48:55  jim
00232 *** empty log message ***
00233 
00234 Revision 1.7  2006/01/23 10:30:49  jim
00235 Mainly documentation mods
00236 
00237 Revision 1.6  2005/12/14 22:17:33  jim
00238 Updated docs
00239 
00240 Revision 1.5  2005/11/25 09:56:15  jim
00241 Tidied up some more documentation
00242 
00243 Revision 1.4  2005/11/03 15:16:28  jim
00244 Lots of changes mainly to strengthen error reporting
00245 
00246 Revision 1.3  2005/11/03 13:28:49  jim
00247 All sorts of changes to tighten up error handling
00248 
00249 Revision 1.2  2005/09/22 08:40:41  jim
00250 Fixed some bugs in imcore and added classification Removed some unnecessary
00251 files
00252 
00253 
00254 */

Generated on Wed Apr 10 04:01:56 2013 for VIRCAM Pipeline by  doxygen 1.5.1