36 #include "casu_mods.h"
37 #include "catalogue/casu_utils.h"
38 #include "catalogue/casu_wcsutils.h"
39 #include "catalogue/casu_fits.h"
40 #include "catalogue/imcore.h"
149 extern int casu_imcore(casu_fits *infile, casu_fits *conf,
int ipix,
150 float threshold,
int icrowd,
float rcore,
int nbsize,
151 int cattype,
float filtfwhm, casu_tfits **outtab,
152 float gainloc,
int *status) {
154 const char *fctid =
"casu_imcore";
155 cpl_propertylist *plist,*elist;
157 double theta_east,*cd,theta_north,theta_north_2,pixarcsec;
158 float fwhm,fitpa,ell;
164 if (*status != CASU_OK)
175 retval =
imcore_conf(in,c,ipix,threshold,icrowd,rcore,nbsize,cattype,
176 filtfwhm,gainloc,outtab);
179 if (retval != CASU_OK)
182 cpl_msg_warning(fctid,
"No objects found in %s",
192 cpl_msg_error(fctid,
"Unable to open propertylist %s",
201 if (retval != CASU_OK)
207 wcs = cpl_wcs_new_from_propertylist(elist);
208 cd = cpl_matrix_get_data((cpl_matrix *)cpl_wcs_get_cd(wcs));
209 pixarcsec = 3600.0*sqrt(fabs(cd[0]*cd[3] - cd[1]*cd[2]));
210 cpl_wcs_delete((cpl_wcs *)wcs);
212 "ESO QC IMAGE_SIZE");
216 "ESO QC IMAGE_SIZE",fwhm);
219 "[arcsec] Average FWHM of stellar objects");
221 cpl_propertylist_set_comment(elist,
"ESO DRS IMAGE_SIZE",
222 "[arcsec] Average FWHM of stellar objects");
230 wcs = cpl_wcs_new_from_propertylist(elist);
231 cd = cpl_matrix_get_data((cpl_matrix *)cpl_wcs_get_cd(wcs));
232 theta_east = DEGRAD*atan2(cd[1],cd[0]);
233 theta_north = DEGRAD*atan2(cd[3],cd[2]);
234 theta_north_2 = (theta_north < 0.0 ? theta_north + 360.0 : theta_north);
235 if (fabs(theta_north-theta_east-90.0) < 5.0 ||
236 fabs(theta_north-theta_east+270.0) < 5.0) {
237 fitpa = theta_north_2 - fitpa;
239 fitpa = 360.0 - theta_north_2 + fitpa;
245 cpl_wcs_delete((cpl_wcs *)wcs);
247 "ESO QC POSANG",fitpa);
250 "[degrees] Median position angle (from North)");
258 "[arcsec] spatial resolution");
262 "[arcsec] spatial resolution");
264 "ESO QC ELLIPTICITY");
268 "average ellipticity of point sources");
272 "average ellipticity of point sources");
char * casu_fits_get_filename(casu_fits *p)
char * casu_fits_get_fullname(casu_fits *p)
void casu_fits_delete(casu_fits *p)
casu_fits * casu_fits_duplicate(casu_fits *in)
cpl_propertylist * casu_fits_get_phu(casu_fits *p)
cpl_propertylist * casu_fits_get_ehu(casu_fits *p)
int casu_imcore(casu_fits *infile, casu_fits *conf, int ipix, float threshold, int icrowd, float rcore, int nbsize, int cattype, float filtfwhm, casu_tfits **outtab, float gainloc, int *status)
Generate object catalogues from input images.
cpl_table * casu_tfits_get_table(casu_tfits *p)
cpl_propertylist * casu_tfits_get_ehu(casu_tfits *p)
void casu_propertylist_update_float(cpl_propertylist *plist, const char *name, float val)
int imcore_conf(casu_fits *infile, casu_fits *conf, int ipix, float threshold, int icrowd, float rcore, int nbsize, int cattype, float filtfwhm, float gain, casu_tfits **outcat)
Do source extraction.
int imcore_classify(casu_tfits *catalogue, float minsize, int cattype)
Do star/galaxy classification.