#include #include #include #include int main(int argc, char *argv[]) { int N,err,j,ni,n,i,k; double x[10000],y[10000],flux[10000]; double back,flxmax; FILE *fp; char path[1035],buffer[150]; char buf1[150],*temp; char fitsfile[80]; temp = (char*)calloc(100,sizeof(char)); if(argc != 2) { printf("Usage: findbright fitsfile\n"); exit(1); } strcpy(fitsfile,argv[1]); strcpy(buf1,fitsfile); sprintf(buffer,"image2xy -O -H -o temp.xy.fits %s > junk.txt",fitsfile); err = system(buffer); sprintf(buffer,"tablist temp.xy.fits"); fp = popen(buffer,"r"); j = 0; n = 0; while(fgets(path,sizeof(path),fp) != NULL) { if(j > 1) { ni = sscanf(path,"%d %lf %lf %lf %lf",&N,&x[n],&y[n],&flux[n],&back); n++; } j++; } pclose(fp); flxmax = 0.0; for(i=0;i