- Timestamp:
- Jun 13, 2011, 3:52:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20110406/psLib/src/fits/psFitsImage.c
r31618 r31621 164 164 else if (isfinite(bsoften)) { 165 165 info->is_asinh = true; 166 info->is_logscaled = false; 166 167 } 167 168 else { … … 510 511 } 511 512 else if (info->is_asinh) { 512 double bsoften ;513 double bsoften,boffset; 513 514 int status; 514 515 status = 0; 515 516 fits_read_key_dbl(fits->fd, "BSOFTEN", &bsoften, NULL, &status); 516 psImage *newImage = psFitsScaleFromDisk(outImage,0.0,bsoften); 517 fits_read_key_dbl(fits->fd, "BOFFSET", &boffset, NULL, &status); 518 psImage *newImage = psFitsScaleFromDisk(outImage,boffset,bsoften); 517 519 psFree (outImage); 518 520 outImage = newImage; … … 724 726 if (options&&(!((options->scaling == PS_FITS_SCALE_LOG_RANGE)|| 725 727 (options->scaling == PS_FITS_SCALE_LOG_MANUAL)|| 726 (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)|| 727 (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)|| 728 (options->scaling == PS_FITS_SCALE_LOG_STDEV_BOTH)))) { 728 (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)|| 729 (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)|| 730 (options->scaling == PS_FITS_SCALE_LOG_STDEV_BOTH)|| 731 (options->scaling == PS_FITS_SCALE_ASINH_RANGE)|| 732 (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)|| 733 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)|| 734 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)|| 735 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) { 729 736 if (psMetadataLookup(header,"BOFFSET")) { 730 737 psMetadataRemoveKey(header,"BOFFSET"); 738 } 739 } 740 // Remove any BSOFTENvalues that exist in the header if we are not using that scaling anymore 741 if (options&&(!((options->scaling == PS_FITS_SCALE_ASINH_RANGE)|| 742 (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)|| 743 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)|| 744 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)|| 745 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) { 746 if (psMetadataLookup(header,"BSOFTEN")) { 747 psMetadataRemoveKey(header,"BSOFTEN"); 731 748 } 732 749 } … … 757 774 "Scaling: TRUE = BZERO + BSCALE * 10**(DISK) + BOFFSET)", &status); 758 775 } 776 if (options&&(((options->scaling == PS_FITS_SCALE_ASINH_RANGE)|| 777 (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)|| 778 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)|| 779 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)|| 780 (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) { 781 fits_write_key_dbl(fits->fd, "BOFFSET", boffset, 12, 782 "Scaling: NORM = DISK + BOFFSET", &status); 783 fits_write_key_dbl(fits->fd, "BSOFTEN", bsoften, 12, 784 "Scaling: TRUE = 2 * BSOFTEN * sinh(NORM/a)",&status); 785 786 787 } 788 759 789 if (psFitsError(status, true, "Could not write BSCALE/BZERO headers to file.")) { 760 790 success = false;
Note:
See TracChangeset
for help on using the changeset viewer.
