VIRCAM Pipeline  2.3.10
imcore_opm-test.c
1 /* $Id: imcore_opm-test.c,v 1.1 2015/10/15 11:19:55 jim Exp $
2  *
3  * This file is part of the CASU Pipeline utilities
4  * Copyright (C) 2015 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: jim $
23  * $Date: 2015/10/15 11:19:55 $
24  * $Revision: 1.1 $
25  * $Name: $
26  */
27 
28 #include <stdio.h>
29 #include <stdlib.h>
30 
31 #include <cpl_init.h>
32 #include <cpl_test.h>
33 #include <casu_fits.h>
34 #include <casu_utils.h>
35 #include <casu_mods.h>
36 #include "../imcore.h"
37 
38 int main(void) {
39  int retval;
40  cpl_image *im;
41  casu_fits *ff,*ffc;
42  cpl_mask *bpm_mask;
43 
44  /* Initialise */
45 
46  cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
47 
48  /* Create an image and a confidence map */
49 
50  im = cpl_image_new(1024,1024,CPL_TYPE_FLOAT);
51  cpl_image_fill_noise_uniform(im,990.0,1010.0);
52  cpl_image_fill_window(im,500,500,505,505,5000);
53  ff = casu_fits_wrap(im,NULL,NULL,NULL);
54  im = cpl_image_new(1024,1024,CPL_TYPE_INT);
55  cpl_image_fill_noise_uniform(im,95.0,105.0);
56  ffc = casu_fits_wrap(im,NULL,NULL,NULL);
57 
58  /* Do an analysis now */
59 
60  retval = imcore_opm(ff,ffc,5,10.0,64,1.0,1);
61  cpl_test_eq(retval,CASU_OK);
62  bpm_mask = cpl_image_get_bpm(casu_fits_get_image(ff));
63  cpl_test_eq(60,(int)cpl_mask_count(bpm_mask));
64 
65  /* Tidy and exit */
66 
67  casu_fits_delete(ff);
68  casu_fits_delete(ffc);
69  return(cpl_test_end(0));
70 }
71 
72 /*
73 
74 $Log: imcore_opm-test.c,v $
75 Revision 1.1 2015/10/15 11:19:55 jim
76 new
77 
78 
79 */
cpl_image * casu_fits_get_image(casu_fits *p)
Definition: casu_fits.c:436
void casu_fits_delete(casu_fits *p)
Definition: casu_fits.c:364
casu_fits * casu_fits_wrap(cpl_image *im, casu_fits *model, cpl_propertylist *phu, cpl_propertylist *ehu)
Definition: casu_fits.c:883
int imcore_opm(casu_fits *infile, casu_fits *conf, int ipix, float threshold, int nbsize, float filtfwhm, int niter)
Create an object mask.
Definition: imcore_opm.c:111