bad pixel mask - ascii
Frank Valdes wrote on Nov 15, 2001
Q: I need to convert a bad pixel mask (.pl format) into an ASCII file. I only need the coordinates of the flagged pixels but any ASCII output would help as I could easily format it then. I tried with the 'imtab' but got a memory error (the chip size is 2kx4k). A: Being able to extract only the coordinates of flagged pixels seems like a useful thing for a general mask manipulation package. We are investigating improved support for mask manipulation but currently there is nothing that does what you ask for in a single command. It sounds like you are investigating using the TABLES package. This certainly has potential but there is another way. LISTPIXELS is a basic task for converting an image into ascii (and a pl file can be treated like an image). So we start with that. This will dump coordinates and values for every pixel in the image. It has a possibly useful feature for you that the coordinates can be in user coordinates (wcs=world) as well as pixel coordinates (wcs=logical). So the next step is how to get only the non-zero elements. Because masks are integer and the way LISTPIX formats the values the zero values will always be " 0." at the end of each line. So I suggest using MATCH to match this pattern and then use the "stop" option to pass only those lines that don't match. So the following will do what you want: cl> listpix mask.pl wcs=logical verbose- | match " 0.$" stop+ 1. 2. 1. 3. 2. 1. 5. 2. 1. etc Note that if you want just the coordinates the FIELDS task could be added: cl> listpix mask.pl wcs=logical verbose- | match " 0.$" stop+ | fields STDIN 1,2 1. 2. 3. 2. 5. 2. etc One thing to realize is that the IRAF command language currently implements pipes so that each command completes and stores its output before the next step. So the listpix command will create a full ascii version of the mask temporarily.
Last post on Nov 15, 2001