diff options
Diffstat (limited to 'noao/digiphot/apphot/fitsky/aphgmsub.x')
-rw-r--r-- | noao/digiphot/apphot/fitsky/aphgmsub.x | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/noao/digiphot/apphot/fitsky/aphgmsub.x b/noao/digiphot/apphot/fitsky/aphgmsub.x new file mode 100644 index 00000000..ae969bba --- /dev/null +++ b/noao/digiphot/apphot/fitsky/aphgmsub.x @@ -0,0 +1,51 @@ +# AP_HGMSUB -- Procedure to subtract a point from an existing histogram. + +procedure ap_hgmsub (hgm, nbins, z1, z2, skypix) + +real hgm[ARB] # histogram +int nbins # number of bins +real z1, z2 # range of histogram +real skypix # sky value + +int bin +real dh + +begin + if (skypix < z1 || skypix > z2) + return + dh = real (nbins - 1) / (z2 - z1) + bin = int ((skypix - z1) * dh) + 1 + hgm[bin] = hgm[bin] - 1.0 +end + + +# AP_HGMSUB2 -- Procedure to subract points from the accumulated sums +# and the existing histogram. + +procedure ap_hgmsub2 (hgm, nbins, z1, z2, skypix, sky_zero, sumpx, sumsqpx, + sumcbpx) + +real hgm[ARB] # histogram +int nbins # number of bins +real z1, z2 # range of histogram +real skypix # sky value +real sky_zero # sky zero point for moment analysis +double sumpx # sum of the sky pixel values +double sumsqpx # sum of the squares of the sky pixel values +double sumcbpx # sum of the cubes of the sky pixel values + +double dsky +int bin +real dh + +begin + if (skypix < z1 || skypix > z2) + return + dsky = skypix - sky_zero + sumpx = sumpx - dsky + sumsqpx = sumsqpx - dsky ** 2 + sumcbpx = sumcbpx - dsky ** 3 + dh = real (nbins - 1) / (z2 - z1) + bin = int ((skypix - z1) * dh) + 1 + hgm[bin] = hgm[bin] - 1.0 +end |