- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
extsrc/gpcsw/gpcsrc/fits/burntool/burntool.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/extsrc/gpcsw/gpcsrc/fits/burntool/burntool.c
r24391 r27840 50 50 fprintf(stderr, "\rerror: burntool could not open file `%s'\n", 51 51 ifilename); 52 exit( EXIT_FAILURE);52 exit(-314); 53 53 } 54 54 nextend = fh_extensions(ihu); … … 57 57 ifilename); 58 58 #ifndef JT2DHACK 59 exit( EXIT_FAILURE);59 exit(-315); 60 60 #endif 61 61 } … … 99 99 NEGLIGIBLE_TRAIL = 0.5; /* Don't sweat less than this * sigma */ 100 100 EXPIRE_TRAIL_TIME = 2000; /* Expire a persist after this [sec] */ 101 102 PERSIST_RETAIN = 0; /* Retain persists with bad slopes? */ 101 103 102 104 /* Parse the args */ … … 175 177 persistfitsfile = argv[i] + 7; 176 178 179 /* Keep persistence streaks which had a bad slope? */ 180 } else if(strncmp(argv[i], "persist=", 8) == 0) {/* persist={t|f} */ 181 PERSIST_RETAIN = argv[i][8] == 'y' || argv[i][8] == '1' || argv[i][8] == 't'; 182 177 183 /* Output file for PSF gallery */ 178 184 } else if(strncmp(argv[i], "psf=", 4) == 0) { /* psf=fname */ … … 286 292 CONCAT_FITS = argv[i][10] == 'n' || argv[i][10] == '0' || 287 293 argv[i][10] == 'f'; 294 295 /* Set the e/ADU for the noise gate that cells must pass */ 296 } else if(strncmp(argv[i], "EADU=", 5) == 0) { /* EADU=e */ 297 if(sscanf(argv[i]+5, "%lf", &MIN_EADU) != 1) { 298 fprintf(stderr, "\rerror: cannot get e/ADU size from `%s'\n", argv[i]); 299 exit(EXIT_FAILURE); 300 } 301 302 /* Set the read noise for the noise gate that cells must pass */ 303 } else if(strncmp(argv[i], "RN=", 3) == 0) { /* EADU=e */ 304 if(sscanf(argv[i]+3, "%d", &MAX_READ_NOISE) != 1) { 305 fprintf(stderr, "\rerror: cannot get read noise size from `%s'\n", argv[i]); 306 exit(EXIT_FAILURE); 307 } 288 308 289 309 /* Quiet? */ … … 323 343 ifilename); 324 344 if(persist_fits_remove_tables(ihu, deltablefitsfile) != FH_SUCCESS) { 325 exit(EXIT_FAILURE); 326 } 327 else { 345 exit(-316); 346 } else { 328 347 exit(EXIT_SUCCESS); 329 348 } … … 345 364 /* Read the persistence data for this OTA */ 346 365 if(persistfile != NULL) { /* Text data file */ 347 if(persist_read(OTA, persistfile )) exit(EXIT_FAILURE);366 if(persist_read(OTA, persistfile, apply)) exit(-317); 348 367 } else if(persistfitsfile != NULL) { /* FITS table */ 349 if(persist_fits_read(OTA, persistfitsfile ) != FH_SUCCESS)350 exit( EXIT_FAILURE);368 if(persist_fits_read(OTA, persistfitsfile, apply) != FH_SUCCESS) 369 exit(-318); 351 370 } 352 371 … … 407 426 "\rerror: Cannot read EXTNAME from `%s' for extension #%d\n", 408 427 ifilename, ext); 409 exit( EXIT_FAILURE);428 exit(-319); 410 429 } 411 430 if(fh_get_str(ehu, "XTENSION", xtension, sizeof(xtension)) != FH_SUCCESS) { … … 413 432 "\rerror: Cannot read XTENSION from `%s' for extension #%d\n", 414 433 ifilename, ext); 415 exit( EXIT_FAILURE);434 exit(-320); 416 435 } 417 436 if(!strcmp("TABLE", xtension)) { … … 441 460 fprintf(stderr, 442 461 "\rerror: Illegal cell number %d from '%s'\n", cell, extname); 443 exit( EXIT_FAILURE);462 exit(-321); 444 463 } 445 464 … … 467 486 (naxis >= 3 && fh_get_NAXIS3(ehu, &naxis3) != FH_SUCCESS)) { 468 487 fprintf(stderr, "\rerror: Cannot get NAXIS*'\n"); 469 exit( EXIT_FAILURE);488 exit(-322); 470 489 } 471 490 if (naxis != 2) { … … 483 502 } 484 503 fprintf(stderr, "\rerror: 32bpp support not yet implemented in burntool.\n"); 485 exit( EXIT_FAILURE);504 exit(-324); 486 505 } 487 506 /* Check BSCALE and warn if it is anything other than 1.0. … … 505 524 } 506 525 507 buf = (IMTYPE*)malloc(naxis1*naxis2*naxis3*sizeof(short)); 526 if( (buf = (IMTYPE*)malloc(naxis1*naxis2*naxis3*sizeof(short))) == NULL) { 527 fprintf(stderr, "\rerror: failed to alloc FITS buffer\n"); 528 exit(-325); 529 } 508 530 if (fh_read_padded_image(ehu, fh_file_desc(ehu), buf, 509 531 naxis1*naxis2*naxis3*sizeof(short), … … 511 533 fprintf(stderr, "\rerror: failed to read image data for extension `%s'.\n", 512 534 extname); 513 free(buf);514 exit( EXIT_FAILURE);535 // free(buf); 536 exit(-326); 515 537 } 516 538 … … 580 602 581 603 /* Fix up the streaks (don't bother if table only) */ 582 if(!tableonly) { 604 // Why the heck do I get to skip this if table only? Makes no sense! 605 // if(!tableonly) { 583 606 persist_fix(naxis1-ovrscan1, naxis2-ovrscan2, naxis1, buf, 584 607 OTA+cell); 585 608 /* Tell us about it? */ 586 609 if(VERBOSE & VERB_NORM) persist_blab(OTA+cell); 587 }610 // } 588 611 } 589 612 … … 596 619 fprintf(stderr, "\rerror: failed to re-write image data for extension `%s'.\n", 597 620 extname); 598 free(buf);599 exit( EXIT_FAILURE);621 // free(buf); 622 exit(-327); 600 623 } 601 624 } … … 646 669 if(2*SKY_MARG*ny > nmedian_buf) { 647 670 if(median_buf != NULL) free(median_buf); 648 median_buf = (int *)calloc(2*SKY_MARG*ny, sizeof(int)); 671 if( (median_buf = (int *)calloc(2*SKY_MARG*ny, sizeof(int))) == NULL) { 672 fprintf(stderr, "\rerror: failed to alloc median buffer\n"); 673 exit(-667); 674 } 675 649 676 nmedian_buf = 2*SKY_MARG*ny; 650 677 } … … 653 680 if(NX*NY > nimbuf) { 654 681 if(imbuf != NULL) free(imbuf); 655 imbuf = (int *)calloc(NX*NY, sizeof(DTYPE)); 682 if( (imbuf = (int *)calloc(NX*NY, sizeof(DTYPE))) == NULL) { 683 fprintf(stderr, "\rerror: failed to alloc cell copy\n"); 684 exit(-668); 685 } 656 686 nimbuf = NX*NY; 657 687 } … … 660 690 if(NX*NY > nmbuf) { 661 691 if(mbuf != NULL) free(mbuf); 662 mbuf = (int *)calloc(NX*NY, sizeof(MTYPE)); 692 if( (mbuf = (int *)calloc(NX*NY, sizeof(MTYPE))) == NULL) { 693 fprintf(stderr, "\rerror: failed to alloc mask buffer\n"); 694 exit(-669); 695 } 663 696 nmbuf = NX*NY; 664 697 } … … 667 700 if(NX*NY > nmsbuf) { 668 701 if(msbuf != NULL) free(msbuf); 669 msbuf = (int *)calloc(NX*NY, sizeof(MTYPE)); 702 if( (msbuf = (int *)calloc(NX*NY, sizeof(MTYPE))) == NULL) { 703 fprintf(stderr, "\rerror: failed to alloc veto buffer\n"); 704 exit(-670); 705 } 670 706 nmsbuf = NX*NY; 671 707 } … … 734 770 printf(" restore={t|f} Restore the input MEF by adding input fits?\n"); 735 771 printf(" apply={t|f} Modify the input MEF by subtracting previously calculated fits?\n"); 736 printf(" tableonly={t|f} Calculate fits but do *not* modify the input MEF images, only write tables\n");772 printf(" tableonly={t|f} Calculate fits but do *not* modify the input MEF pixels, only write tables\n"); 737 773 printf(" in=fname Input file for previous burn persistence streaks\n"); 738 774 printf(" infits=fname Input FITS file for previous burn persistence streaks (stored\n");
Note:
See TracChangeset
for help on using the changeset viewer.
