33 #include <casu_utils.h>
34 #include <casu_mods.h>
35 #include "../imcore.h"
39 float skymed,skysig,sat;
44 cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
51 ap.inframe = cpl_image_new(2048,2048,CPL_TYPE_FLOAT);
52 ap.conframe = cpl_image_new(2048,2048,CPL_TYPE_INT);
54 ap.indata = cpl_image_get_data_float(ap.inframe);
55 ap.confdata = cpl_image_get_data_int(ap.conframe);
56 ap.mflag = cpl_calloc(2048*2048,
sizeof(
unsigned char));
60 cpl_image_fill_noise_uniform(ap.inframe,-10.0,10.0);
61 cpl_image_add_scalar(ap.inframe,5000.0);
62 cpl_image_fill_noise_uniform(ap.conframe,99,101);
67 cpl_test_eq(retval,CASU_OK);
68 cpl_test_rel(skymed,5000.0,0.01);
69 cpl_test_rel(sat,20000.0,0.001);
70 cpl_test_rel(skysig,7.4,0.1);
75 cpl_test_eq(retval,CASU_OK);
76 for (j = 0; j < ap.backmap.nby; j++)
77 for (i = 0; i < ap.backmap.nbx; i++)
78 cpl_test_rel((ap.backmap.bvals)[i][j],5000.0,0.01);
79 cpl_test_rel(cpl_image_get_median(ap.inframe),5000.0,0.1);
81 cpl_test_rel(skymed,5000.0,0.01);
82 cpl_test_abs(skysig,0.013,0.01);
88 cpl_image_delete(ap.inframe);
89 cpl_image_delete(ap.conframe);
90 return(cpl_test_end(0));
int imcore_background(ap_t *ap, int nbsize, float nullval)
Model and create background map.
int imcore_backstats(ap_t *ap, float nullval, int satonly, float *skymed, float *skysig, float *sat)
Work out robust background estimate over a whole input image.
void imcore_apclose(ap_t *ap)
Close ap structure.
void imcore_backest(ap_t *ap, float x, float y, float *skylev, float *skyrms)
Work out estimated sky for a pixel position.
void imcore_apinit(ap_t *ap)
Initialise the ap structure.