36 #include "vircam_mods.h"
37 #include "vircam_utils.h"
38 #include "vircam_wcsutils.h"
39 #include "vircam_fits.h"
40 #include "catalogue/imcore.h"
41 #include "vircam_pfits.h"
43 #define NOMPIXSIZE 0.34
45 static double pixsize (cpl_propertylist *plist);
151 float threshold,
int icrowd,
float rcore,
int nbsize,
152 int cattyp,
float filtfwhm, vir_tfits **outtab,
155 const char *fctid =
"vircam_imcore";
156 cpl_propertylist *plist,*elist;
158 double pixarcsec,*cd,theta_east,theta_north,theta_north_2;
165 if (*status != VIR_OK)
176 retval =
imcore_conf(in,c,ipix,threshold,icrowd,rcore,nbsize,cattype,
180 if (retval != VIR_OK)
183 cpl_msg_warning(fctid,
"No objects found in %s",
193 cpl_msg_error(fctid,
"Unable to open propertylist %s",
201 retval =
classify(*outtab,plist,16.0,cattype);
202 if (retval != VIR_OK)
208 pixarcsec = pixsize(elist);
210 "ESO QC IMAGE_SIZE");
213 "ESO QC IMAGE_SIZE",fwhm);
216 "[arcsec] Average FWHM of stellar objects");
224 wcs = cpl_wcs_new_from_propertylist(elist);
225 cd = cpl_matrix_get_data((cpl_matrix *)cpl_wcs_get_cd(wcs));
226 theta_east = DEGRAD*atan2(cd[1],cd[0]);
227 theta_north = DEGRAD*atan2(cd[3],cd[2]);
228 theta_north_2 = (theta_north < 0.0 ? theta_north + 360.0 : theta_north);
229 if (abs(theta_north-theta_east-90.0) < 5.0 ||
230 abs(theta_north-theta_east+270.0) < 5.0) {
231 fitpa = theta_north_2 - fitpa;
233 fitpa = 360.0 - theta_north_2 + fitpa;
239 cpl_wcs_delete((cpl_wcs *)wcs);
241 "ESO QC POSANG",fitpa);
244 "[degrees] Median position angle (from North)");
269 static double pixsize (cpl_propertylist *plist) {
270 double cd1_1,cd1_2,pix;
276 pix = 3600.0*sqrt(cd1_1*cd1_1 + cd1_2*cd1_2);