GSAOI (Bad pixel mask)

Home Forums Gemini Data Reduction GSAOI (Bad pixel mask)

Tagged: , ,

This topic contains 5 replies, has 2 voices, and was last updated by  Daniela Opitz 4 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #579

    Daniela Opitz
    Participant

    Hi

    Does Gemini have any useful task to derive a bad pixel mask? I read that a procedure will be posted later so I wonder if there is some preliminary documentation which we can use.

    Thanks in advance

    Daniela

    #583

    Mark
    Participant

    Hi Daniela,

    A general description of how the GSAOI static BPM within the gsaoi package in the Gemini IRAF package was created is below. The description was supplied to me by one of the instrument team (I’ve added a few comments about the Gemini IRAF tasks that can be used to accomplish the steps – for more information on the task calls look at the help files for those tasks).

    The procedure is fairly standard for IR detectors. In addition, suitable data sets can be found in the Gemini archive (GSA).

    —-

    The BPM was created from a set of flats with the same filter (the filter does not matter, as long as the flats well exposed), and a set of 150s darks (the exposure time is between the shortest and longest exposure times available). 5-10 files in each set is enough.

    [@<name> are lists containing the names of the FITS files. Use the ‘rawpath’ parameters to point the specific task to raw files.

    Task calls are assumed to be using the default parameters except for those given.

    Also, it is assumed that you are using version 1.12 of the Gemini IRAF package]

    The procedure is:

    – combine dome flats, using median and avsigclip rejection
    — The gaflat task in the gsaoi Gemini IRAF package can be used
    ecl> gaflat @flats fl_mask- fl_vardq- fl_trim- \
    fl_nlc- combine=”median” masktype=”none” nhigh=0 nlow=0

    – combine darks, using median and avsigclip rejection
    — The gadark task in the gsaoi Gemini IRAF package can be used
    ecl> gadark @darks fl_mask- fl_vardq- fl_trim- \
    fl_nlc- combine=”median” masktype=”none” nhigh=0 nlow=0

    – flag everything below 50% of median value of combined flat (“cold” pixels)
    — The task gastat can be used to determine the median in one call
    (look at the help for the format of the output).
    ecl> gastat <combine_flat> stattype=”midpt” statextn=”array” \
    fl_mask-

    – flag everything above 75% of the median + 3sigma value of the combined dark (“hot” pixels). This gets the core of the hot pixel, but not the wings (which subtract quite well with the sky), thus reducing the number of masked pixels (it’s 3% already…)
    — The task gastat can be used to determine the median and
    associated error in one call (look at the help for the format of the
    output).
    ecl> gastat <combine_flat> stattype=”midpt” statextn=”array” \
    fl_mask- calc_stddev+

    The trick is more on the level of the cut for identifying the hot pixels, than in the exposure time of the darks themselves – in the end using a cosmic ray cleaning routine works better to get rid of the not-so-hot pixels, and allow better control given the small size of the PSF.

    — To create the output BPM, i.e., the flagging steps above, the task gemexpr in the gemtools package in the Gemini IRAF package can be used, after the values determined above for each array (extension) are written to the header of that extension.

    E.g., median value for SCI, 1 extension of combined_flat = val1
    ecl> gemhedit <combined_flat>[SCI,1] “MEDIAN” val1 “Median value” delete-
    upfile=””

    Repeat for the other combined flat extensions.

    Then do the same for the combined dark..

    E.g., median and sigma value for SCI, 1 extension of combined_flat = val1, err1, respectively:
    ecl> gemhedit <combined_dark>[SCI,1] “MEDIAN” val1 “Median value” delete-
    upfile=””
    ecl> gemhedit <combined_dark>[SCI,1] “MEDSIGMA” err1 “Sigma value” delete-
    upfile=””

    Repeat for the other combined dark extensions.

    Then use gemexpr:

    ecl> gemexpr sci_expr=”a < (a.MEDIAN / 2) || b > ((0.75 * b.MEDIAN) + 3*b.MEDSIGMA) ? 1 : 0″
    output=”gsaoi_stat_bpm.fits” a=<combined_flat> b=<combined_dark>

    Finally, for use in the Gemini IRAF package:

    update the “EXTNAME” keyword value in all of the gsaoi_stat_bpm.fits extensions to “DQ”.

    Remove the following keywords from the phu: “METACONF,OBJECT,OBSTYPE”

    gemhedit “gsaoi_stat_bpm.fits[0]” “METACONF,OBJECT,OBSTYPE” “” “” \
    delete+ upfile=””

    Then where appropriate reset the ‘badpix’ parameter to a task in the gsaoi package to point to “gsaoi_stat_bpm.fits”

    Let me know if you have any trouble with any of the commands…

    Thanks,

    Mark

    #590

    Daniela Opitz
    Participant

    Thanks a lot!

    #674

    Daniela Opitz
    Participant

    Hi Mark

    Do you know why after writing

    gadark @darks fl_vardq- fl_trim- \
    fl_nlc- combine=”median” masktype=”none” nhigh=0 nlow=0

    I am having :

    GADARK: Returned from GAPREPARE

    GADARK: Accessing METACONF keyword values
    GADARK: Determining unique METACONFIG values
    GADARK: Creating METACONFIG lists and processing images…

    —-
    GADARK: Processing configuration 120.0_8_3+FF

    GADARK: Creating output dark – gS20131220S0180_dark.fits

    GADARK: Median combining dark frames…
    Rejection type is avsigclip

    GADARK: Input files are…

    gS20131220S0180
    gS20131220S0181
    gS20131220S0182
    gS20131220S0183
    gS20131220S0184
    gS20131220S0185
    gS20131220S0186
    gS20131220S0187
    gS20131220S0188
    gS20131220S0189

    ERROR: Attempt to access undefined local variable `bpmgemcomb’.

    “grow=l_grow, bpmfile=bpmgemcomb, nrejfile=””, \”
    line 775: gsaoi$gadark.cl
    called as: `gadark (inimages=@dark.lis, fl_vardq=no, fl_trim=no, fl_nlc=no, fl_sat=no, combine=median, masktype=none, nlow=0, nhigh=0)’

    P.S: I removed fl_mask because it doesn’t exist in gadark.

    #689

    Mark
    Participant

    Hi Daniela,

    Apologies for the long response time, I’ve been out of the office for the past few weeks.

    The fl_mask- parameter for gadark was a typo on my part, sorry; I was working from memory at the time.

    The error message you are seeing is because there is a bug in the code. The local variable (internal to the code) `bpmgemcomb’ was not being set when using the options supplied.

    I’ve fixed it (see attached file). Could you let me know if it works for you, please?

    Thanks,

    Mark

    INSTRUCTIONS:

    Download the file

    Unpack it:

    gunzip gadark.cl.gz

    Then in your IRAF / PyRAF session, after loading gemini and then gsaoi, do:

    task gadark=/path/to/unpacked/file/gadark.cl

    Attachments:
    1. gadark.cl.gz
    #691

    Daniela Opitz
    Participant

    Thank you for your answer. I wrote “gadark @dark.lis fl_vardq- fl_trim- fl_nlc- combine=”median” masktype=”none” nhigh=0 nlow=0” after having downloaded the new version of gadark.cl and it is working now.

    Cheers

    • This reply was modified 4 years, 11 months ago by  Daniela Opitz.
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.