; XBASL ;--------------------------------------------------------------- ;! Fits and subtracts nth-order baselines from cube (x axis) ;# TASK SPECTRAL ANALYSIS PLOT TV-APPL ;----------------------------------------------------------------------- ;; Copyright (C) 1995-1996, 1999, 2005, 2009, 2014 ;; Associated Universities, Inc. Washington DC, USA. ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2 of ;; the License, or (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public ;; License along with this program; if not, write to the Free ;; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, ;; MA 02139, USA. ;; ;; Correspondence concerning AIPS should be addressed as follows: ;; Internet email: aipsmail@nrao.edu. ;; Postal address: AIPS Project Office ;; National Radio Astronomy Observatory ;; 520 Edgemont Road ;; Charlottesville, VA 22903-2475 USA ;----------------------------------------------------------------------- XBASL LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC XBASL Fits n'th order polynomials to rows of images INNAME Input image name (name) INCLASS Input image name (class) INSEQ 0.0 9999.0 Input image name (seq. #) INDISK 0.0 9.0 Input image disk unit # OUTNAME Output image name (name) OUTCLASS Output image name (class) OUTSEQ -1.0 9999.0 Output image name (seq. #) OUTDISK 0.0 9.0 Output image disk unit #. BLC Bottom left corner of input TRC Top right corner of input YINC 0.0 128.0 Do every YINCth row ZINC 0.0 128.0 Do every ZINCth plane FLUX 0.0 Flux cutoff (see HELP) DOOUTPUT -1.0 1.0 Write images of parms DOCONT -1.0 1.0 > => retain continuum DOSLICE -1.0 2.0 Plot data on TEK/TV DOMODEL -1.0 1.0 Plot model on TEK/TV DORESID -1.0 1.0 Plot residuals on TEK/TV PIXRANGE Min,Max of image intensity Max <= Min => entire range LTYPE -410.0 410.0 Type of labeling: 1 border, 2 no ticks, 3 standard, 4 rel to center, 5 rel to subim cen 6 map pixels PIXVAL 0.0 Display if peak < PIXVAL ORDER 0.0 4.0 Max order of polynomial NBOXES 1.0 40.0 Max number of baseline windows BOX 0.0 4096.0 Begin/end channel numbers for windows 1 - NBOXES DOTV -1.0 1.0 > 0 use TV instead of TEK GRCHAN 0.0 7.0 TV graphics channel to use BADDISK Disk(s) to avoid for scratch ---------------------------------------------------------------- XBASL Task: Fits n'th order polynomials to each row of an image. (Normally XBASL will be used on images with frequency or velocity as the first axis, but it will procede with others as well.) The task fits up to 4'th order plus a constant baseline to each row and, optionally, writes up to 4 + 2*ORDER n-1 dimensional images containing the fit parameters and their uncertainties. It will always write the image corrected for the baseline (i.e. with the baseline function, optionally minus its average, subtracted). With a careful choice of input parameters, the task is capable of running in a batch-like mode. However, an interactive mode (using the TEK or TV graphics terminal) is recommended. Note that, since the TEK and TV are not allowed in AIPS batch jobs, XBASL turns off all interactive options and TV/TEK displays when it is run in batch. Adverbs: INNAME.....Input image name (name). Standard defaults. INCLASS....Input image name (class). Standard defaults. INSEQ......Input image name (seq. #). 0 => highest. INDISK.....Disk drive # of input image. 0 => any. OUTNAME....Output image name (name). Standard defaults. OUTCLASS...Output image name (class). Standard defaults. Used only for the corrected image. The OUTCLASSes for the fit parameters are CONST and DERIVn and for the uncertainties are DCONST and DDERVn. The "flux" (average) of the baseline function is written with OUTCLASSes of FLUX and DFLUX. OUTSEQ.....Output image name (seq. #). 0 => highest unique. OUTDISK....Disk drive # of output image. 0 => highest number with sufficient space. BLC........Bottom right corner in input image of desired subimage. Default is entire image. TRC........Top right corner in input image of desired subimage. Default is entire image. YINC.......Do only every YINC'th row (beginning at BLC(2)). ZINC.......Do only every ZINC'th plane (beginning at BLC(3)). FLUX.......A flux cutoff in the same units as the input image (i.e. Jy/beam). If a row does not have three consecutive points above this level - or below minus this level, no baseline is fit to the row. Note that the row values are tested after subtracting a linear baseline for this test. 0 => 0.00005. DOOUTPUT...True (> 0) requests that the parameter and uncertainty images be catalogued (see OUTCLASS). DOCONT.....True (> 0) implies subtract the baseline and add the average of the baseline from the output. This attempts to retain the continuum (if any). False (<= 0) is used when the continuum is zero, or already removed. DOSLICE....True (> 0) implies plot the data on the TEK or TV. > 1 also requests a TEK/TV plot of the initial guess. It must be set > 1. if you wish the option to correct initial guesses with the TEK cross hairs or TV cursor. If DOSLICE > 1 and NGAUSS > 1, the program pauses after plotting its initial guess and requests user input from the terminal. Hit RETURN to procede with the program's initial guess. Enter BAD to have the solution for the row blanked and E to have the program request your guidance as to an altered set of baseline windows. DOMODEL....True (> 0) requests a plot of the final model for each row on the TEK or TV. DORESID....True (> 0) requests a plot of the final residual values in each row. If any one or more of DOSLICE, DOMODEL, or DORESID is true, then the program will pause after each row and request input from the terminal. At that point, you may enter BAD to have the solution blanked or simply a RETURN to keep the answer. One may also enter RETR to loop back and try again with a new set of baseline windows. PIXRANGE...Min,Max of Image intensity. 0,0 => min,max of EACH row (separately). Note that this will mean some plots are at too fine a scale and that the residuals will appear only if the slice contains a sufficient range about 0.0. LTYPE.......Labelling type, see HELP LTYPE for details: 1 = border, 2 = no ticks, 3 or 7 = standard, 4 or 8 = relative to ref. pixel, 5 or 9 = relative to subimage (BLC, TRC) center, 6 or 10 = pixels. 7-10 all labels other than tick numbers and axis type are omitted. Less than 0 is the same except that the plot file version number and create time are omitted. Add n * 100 to alter the metric scaling. PIXVAL.....Plot row only if the peak value < PIXVAL. Limits the plots to those of uncertain intensities. ORDER......The maximum allowed order for the polynomial. 0 is a constant, 1 is linear, 4 is a bit much and is the maximum allowed. NBOXES.....The number of windows in each row (maximum) to be used in fitting the baseline up to 20. This may be changed interactively, reducing it or raising it. The adverb value is really used only to select how much of BOX is used initially and what is done in non-interactive modes. If NBOXES=0, the outer 1/10th's of BLC to TRC are set as the initial pixels to examine for valid data. BOX........NBOXES pairs of channel numbers specifying the beginning and end channel numbers of each of the baseline windows. These numbers may be entered with the TEK/TV cursor in interactive modes. If NBOXES>0 and BOX=0, the initial boxes are all pixels from BLC(1) to TRC(1). DOTV.......> 0 => use TV, otherwise the TEK emulator is used. This emulator sometimes does not work well on Linux systems. GRCHAN.....TV graphics channel to use. 0 -> use more than one to allow color to contain extra meaning. BADDISK....Disk drives to avoid for scratch files. ---------------------------------------------------------------- In interactive modes, the task selects a row to be fit and plots it on the display (REK or TV) screen. The windows are plotted as boxes with the left and right sides as vertical lines centered on the flux value at the end pixels and the top and bottom lines connect these lines together. The slope of the plotted boxes is not related to the order of the fit. 1. It then asks you what order of fit to use, any order up to and including the value of ORDER is allowed. The answer is in a fixed format: the first character must be c or C and the second character must be a number. 2. It then asks you what to do with this row. Answer: B or b to skip this fit and copy the row to the output Q or q to abort the task now E or e to enter new fitting windows interactively else to continue with current windows 3. If entering new fitting windows, it asks you to position the cursor at the start of window 1 and the the stop of window 1, then the start of window 2, the stop of window 2, etc. The loop exits when you select an X value outside the plot. Note that you do not have to set the points working from left to right - if the point marked as the start of window n is at a higher X pixel then the point marked as the stop of window N, they will be reversed by the code. The windows can also occur in any order. If you are using the TV, the task will also leave the loop if you hit button D. Note, that the window is not entered in the list until the stop point is set. 4. After doing a fit and plotting the requested parameters, it then asks you if you want R or r to retry this row (you should enter a new set of windows) Q or q to abort the task now B or b to mark this solution as bad else to subtract the solution, write the output and go on