Welcome to iraf.net Friday, April 26 2024 @ 01:27 PM GMT


 Forum Index > Help Desk > Applications New Topic Post Reply
 How to divide a WFPC3 bad pixel mask in 2 files?
   
Santiago
 03/20/2014 01:16PM (Read 1317 times)  
++---
Junior
confused

Status: offline


Registered: 08/16/2008
Posts: 34
I have this problem, i'm processing some WFPC3 with xzap extern package but i'm doing it such a way the task is applied in layer [1] which contains 1 half of the detector and then another run with the [4] extension which contains the other half of the detector. The thing is that i have only one bad_pixel_mask.fit file with an extra column that indicated in which detector the bad pixel is.

Is it possible to separate the bad pixel mask into 2 files for processing with each layer? the xzap input image is an image which is originated by taking the [1] layer of the WFPC3, so it's a simple image, then i do the same and take the [4] layer but i bet xzap does not know that one of them is the CCD 1 or 2 of the WFPC3.

This is an output of the bpx file. I tried to edit it in a text editor but it complains to be a binary format with no ascii text.

PHP Formatted Code
ecl> tlcol u5d2012li_bpx.fit
# u5d2012li_bpx.fit[1]
CCDCHIP          S             %1d ""              
PIX1             S             %4d pixel          
PIX2             S             %4d pixel          
LENGTH           S             %4d pixel          
VALUE            S             %5d ""              
AXIS             S             %1d ""              
ecl> tprint u5d2012li_bpx.fit
#  Table u5d2012li_bpx.fit[1]  Fri 19:20:13 14-Mar-2014

# row CCDCHIP  PIX1  PIX2 LENGTH VALUE  AXIS
#             pixel pixel  pixel            

    1       1  1104     1   1340     4     2
    2       1  2512     1     71     4     2
    3       1  2542     1    102     4     2
    4       1  2543     1    102     4     2
    5       1  2869     1   1107     4     2
    6       1  3646     1   1932     4     2
    7       1  3667     1    595     4     2
    8       1  3668     1    595     4     2
    9       2   223   530   2051     4     2
   10       2   242     1   2051     4     2
   11       2   243     1   2051     4     2
   12       2   751  1045   2051     4     2
   13       2  1417    45   2051     4     2
   14       2  1469   952   2051     4     2
   15       2  2655  1135   2051     4     2
   16       2  2696     1   2051     4     2
   17       2  2707     1   2051     4     2
   18       2  3915  1197   2051     4     2
   19       1     1     1   2048   512     1
   20       1  2049     1   2048   512     1
   21       1     1     2   2048   512     1
   22       1  2049     2   2048   512     1
   23       1     1     3   2048   512     1
   24       1  2049     3   2048   512     1
   25       2     1  2049   2048   512     1
   26       2  2049  2049   2048   512     1
   27       2     1  2050   2048   512     1
   28       2  2049  2050   2048   512     1
   29       2     1  2051   2048   512     1
   30       2  2049  2051   2048   512     1
ecl>



Thanks in advance

Lic. Santiago Roland - Los Molinos Observatory - IAU Code 844 - Licensed Radio Amateur CX1DR - Montevideo, Uruguay
 
Profile Email
 Quote
Santiago
 03/24/2014 04:47PM  
++---
Junior

Status: offline


Registered: 08/16/2008
Posts: 34
Please help me... Frown

Lic. Santiago Roland - Los Molinos Observatory - IAU Code 844 - Licensed Radio Amateur CX1DR - Montevideo, Uruguay
 
Profile Email
 Quote
fitz
 03/24/2014 05:58PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
I'm not sure I understand what you're doing, and I'm not at all familiar with XZAP, but ....

You can use a task like TSELECT to create separate mask tables based on e.g. 'ccdchip' column value, you then use the separate masks when processing the [1] and [4] extensions. To edit the table manually use the TEDIT task rather than vi/emacs.

You might also have a look at the CRUTIL package in NOAO.IMRED as an alternative way to remove cosmic rays.

 
Profile Email
 Quote
Santiago
 03/24/2014 06:37PM  
++---
Junior

Status: offline


Registered: 08/16/2008
Posts: 34
Thanks a lot, is just i could not open the bad pixel mask with an ordinary text editor, so it has to be done by an internal IRAF task that understand the format of the file. I just want to make 2 bad pixel masks, one using the CCD#1 entry and one using the CCD#2 entry so i can apply any task (say, xzap) and there wont be any doubt what pixel mask the task is applying to the raw images.

Can i do that right? to edit the table and say, eliminate all the CCD#1 lines and keeo the CCD#1, and in another copy of the file, so the opposite so i would end up having 2 masks for separate chips, right?

Will keep looking.

Thanks man

Lic. Santiago Roland - Los Molinos Observatory - IAU Code 844 - Licensed Radio Amateur CX1DR - Montevideo, Uruguay
 
Profile Email
 Quote
fitz
 03/24/2014 07:05PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040

Part of my confusion about your question is that you have a bad pixel mask in the form of a table, this is normally a pixel mask image (i.e. a file with a ".pl" extension). Additionally, I don't see where XZAP uses this mask directly, so I assume you're doing some other steps first.

Anyway, you can split the table based on the chip number using something like

PHP Formatted Code

   ecl> tselect u5d2012li_bpx.fit chip_1.fits "ccdchip == 1"
   ecl> tselect u5d2012li_bpx.fit chip_2.fits "ccdchip == 2"
 


When using the .pl form of a mask, you could do something like use the PROTO.MSKREGIONS task to create a mask from the table data (not directly mind you, I mean you could use the information to generate the regions descriptor expected by the task). In CRUTIL you could then use CRFIX to interpolate across the mask regions and the process the output image. This way, you could explicitly create the mask for each chip and process the [1] and [4] extensions separately.

Hope this helps.

 
Profile Email
 Quote
Santiago
 03/24/2014 08:06PM  
++---
Junior

Status: offline


Registered: 08/16/2008
Posts: 34
Inside xzap.cl script there is this line at the beginning

PHP Formatted Code
string  omasks      {"", prompt="The input object mask keyword or list"}
 


What does it mean? in my script i call the xzap this way

PHP Formatted Code
xzap( inlist = "@pdarks", omasks = "u5d2012li_bpx.fit", outlist = "@cdarks", crmasks= ".crm" )
 


@pdarks are single extension images of one half of the detector [1], the other half is in the extension [4] but i have this only badpixel mask that contains both detectors bad pixels.

I run this for [1] extension images (that are saved in other filenames as single extension pixel images) and then run for the [4] extension but xzap cannot know which detector is to apply the correct bad pixel values.

xzap run fine like this (i.e. no output errors) but this have to be wrong in some point, this way separating bad pixel masks is the only way i'm sure the correct mask is applied.

Anyway, i could not find much info on xzap task, except some papers that make comparisons of cosmic rays removal tools and algorithms, but i think omasks parameter is the masking file, otherwise i got it all wrong and i need to re-run everything, which in any case is not that bad.

btw, i'm trying to keep cosmic rays because we are trying to make some CR statistics along some years, so i'm removing CR in images and then removing the cosmic-ray-removed image from the original one so i end up with zero background images and cosmic rays that are above the background level, kind odd, but makes sense for processing with sextractor or matlab later.

Lic. Santiago Roland - Los Molinos Observatory - IAU Code 844 - Licensed Radio Amateur CX1DR - Montevideo, Uruguay
 
Profile Email
 Quote
fitz
 03/25/2014 03:47AM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
The help page description of the parameter is:

PHP Formatted Code

    omasks
        The  list  of  input  inverse  object  core  masks used to unzap
        cosmic rays detected  in  object  regions  or  the  input  image
        keyword  containing the name of the inverse object mask normally
        CROBJMAS. Inverse  object  core  masks  contain  0's  in  object
        regions  and 1'
s elsewhere. Note that this is the inverse of the
        usual definition of an object mask.
 


It later goes on to say:

PHP Formatted Code

    XZAP detects detects and removes cosmics rays from the input  images
    inlist  and writes the corrected images to outlist. The output image
    list may be the same as the input image list. If input object  masks
    omasks  is defined then only cosmic rays in sky regions are detected
    and removed. These object mask consist  of  0's  and  1's  with  0's
    defining  the  object  regions  in  contrast  to  the  usual XDIMSUM
    convention.  The output cosmic ray  mask  are  written  to  crmasks.
    Cosmic  ray  masks  consist  of  1'
s  and  0's with 1's defining the
    detected cosmic rays.
 


So in your mask file I think you will want the bad pixel regions to be marked as 0, then the CRs will be detected everywhere else (assuming the rest of the mask is all 1). But again the XZAP task isn't expecting a FITS table as a bad pixel mask, it's expecting an image (either regular FITS or a .pl file). You will still need to split the table/mask as I suggested before, and then call XZAP twice with different input lists for each chip and its corresponding mask.

 
Profile Email
 Quote
   
Content generated in: 0.46 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login