define SZ_FITTYPE 8 # SUBSKY -- Subtract background from HSP observations # # Description: # ------------ # Subtract background (i.e. sky) observations from object-plus-sky # observations. The background data may have been taken simultaneously # with the object+sky data; or the two sets may be interleaved; or # there may be two files of background data, one taken before and # one taken after the object+sky data. # Background subtraction may be done in one of the following ways: # (1) Point-by-point # (2) A linear fit to pairs of adjacent background observations # (3) A low-order curve fit to a user-specified number of background # data values near the time of each object+sky observation # (e.g. a quadratic fit to four background points) # (4) A low-order curve fit to all of the background data # The last option is the only one that may be used if there are two # (or more) files of background data. # # Input files must be count rate or count rate per unit area. They can # not be counts because this task does compensate for possible different # integration times between object and background files. # # Date Author Description # ---- ------ ----------- # 05-Dec-1985 C. D. Biemesderfer Original module # 23-Mar-1990 J.-C. Hsu rewrite in SPP #------------------------------------------------------------------------------ procedure subsky () pointer fin, fsky, finmask, fskymask, fout, foutmask # file template pointers int nfin # number of files in input template char fittype[SZ_FITTYPE] # method of fitting int order # order of the fitting polynomial int nptsfit # number of sky points used to fit int nskyfiles # number of sky files per data file bool maskflag # is input mask file specified? bool bmaskflag # is background mask file specified? #============================================================================== begin # announce start of the task call printf ("*** SUBSKY - Version 1.0 ***\n") # get input parameters call subsky_get (fin, fsky, fout, finmask, fskymask, foutmask, nfin, fittype, order, nptsfit, nskyfiles, maskflag, bmaskflag) # do the background subtraction call subsky_do (fin, fsky, fout, finmask, fskymask, foutmask, nfin, fittype, order, nptsfit, nskyfiles, maskflag, bmaskflag) # close file templates call imtclose (fin) call imtclose (fout) call imtclose (fsky) call imtclose (fskymask) call imtclose (finmask) call imtclose (foutmask) # announce completion of task call printf ("background subtraction task completed with no error\n") end