Text File: If the input file is in ASCII (i.e. text), all coordinates listed in the file are ignored during the fit. The format is simply a list of ``x y'' coordinates (with no comma separator).
FITS Image: If the bad pixel input file is a FITS image, all non-zero valued pixels would be ignored during the fit. Note that one can also use the SExtractor segmentation map in GALFIT. Except, be sure to ``zero-out'', from that map, pixel values of the object that one is trying to fit to allow GALFIT to ``see'' it.
The easiest way to mask out a large region interactively is to use SAOimage DS9 in conjunction of two algorithms ``ds9poly.c'' and ``fillpoly.f'' that I provide, with instructions below. The steps look long, but once everything is set up, the only steps to remember are: draw polygon, run ``ds9poly'', and run``fillpoly''.Above: an example of an image mask. The green outline is the polygon drawn into SAOimage DS9, and the filling is done by the ``fillpoly'' program.
cc -o ds9poly ds9poly.c
f77 -o fillpoly fillpoly.f
Take a look at the ``vertices'' file. You'll notice that ``ds9poly'' only parses the output ``ds9out'' into 2 columns. You can now use ``vertices'' directly in ``fillpoly'' above.ds9poly ds9out > vertices
If your polygon is superposed on a GALFIT image block (such as the residual image), make sure to add back the appropriate pixel offsets if you're only working on a subregion. A simple way is to type on the Linux/Unix command line (where xmin and ymin are from Parameter H in the GALFIT input file):
* If ds9poly ``hangs'', there's a problem with the DS9 file. Take a look at it to make sure there's not more than one polygon listed in the file. If this is not a problem then....awk '{print $1 + (xmin-1), $2 + (ymin-1)}' vertices > new_vertices
* Note that some versions of DS9 do not have the same output format, which may give ``ds9poly'' some trouble. If so, feel free to email me (and attach the DS9 file), or fix ds9poly.c if you know how.
Then give the polygon input file and the name of the output file. Or, you can do it all on the command line:fillpoly
You can now use the output file directly in Option F in GALFIT.fillpoly vertices.txt mask.txt
Oh, one more thing: ``fillpoly'' appends to an output file rather than overwrites it. This saves an extra step of having to concatenate multiple masks if you want to do so. So please keep this in mind in case something funny happens. Always examine what you created (using the following step) if you're not sure.
where, data_image.fits is the image that you're asking GALFIT to fit, *not* the output image block (there may be an offset due to the fitting region used -- see two bullet points above). You can now display newmask.fits to see if the masking has been done correctly. Incidentally, you can also feed this image into GALFIT (in Option F) instead of the ASCII file. If ``fillpoly'' did not work correctly, send me an email, providing me the DS9 polygon file, and I'll check to see what the problem may be.badpiximage polygon.txt data_image.fits newmask.fits goodval=0 badval=1