View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Problem with IMCOADD (Gemini package)

Pierre_K wrote on Sep 30, 2007

Hi,

I have a problem with the execution of the IMCOADD function of the GEMINI package (GEMTOOLS to be more precise).

My goal is to align an co-add a series of a few tens of frames that are plain FITS images, without any fancy binary extensions or whatever. They have xy offsets as well as small rotational offsets, hence the choice of IMCOADD instead of the more classical IMALIGN (that works fine with the same images). Here is the header of the first image for instance:

SIMPLE  =                    T / true FITS file created by Yorick               
BITPIX  =                   32 / 32-bit twos complement binary integer          
NAXIS   =                    2 / number of dimensions                           
NAXIS1  =                 2048 / length of 1st dimension                        
NAXIS2  =                 2048 / length of 2nd dimension                        
BSCALE  =   1.000000000000E+00 / data_value = BZERO + BSCALE*file_value         
BZERO   =   0.000000000000E+00 / data_value = BZERO + BSCALE*file_value         
MJD-OBS =   5.403634383801E+04 /                                                
OBJECT  = 'HD70555 '           /                                                
EXPTIME =   2.500080000000E+01 /                                                
FILTER2 = 'Bb#605  '           /                                                
IMAGETYP= 'OBJECT  '           /                                                
AIRMASS =   1.163000000000E+00 /                                                
END                                                                             


I then tried to run the following command:
imcoadd @listfiles alignmethod=twodx rotate=yes scale=yes

where the ASCII file "listfiles" contains the names of all the files to co-add (six images as a first test, all of the same field).

Then I get the following result:

-----------------------------------------------------------------------------
IMCOADD -- Sun Sep 30 14:44:39 CEST 2007

Images (and masks) in list
EMMI.2006-10-28T08:09:36.931FP
EMMI.2006-10-28T08:10:43.248FP
EMMI.2006-10-28T08:11:49.764FP
EMMI.2006-10-28T08:12:55.810FP
EMMI.2006-10-28T08:14:01.798FP
EMMI.2006-10-28T08:15:07.604FP
Alignment method: twodx
WARNING - IMCOADD: Adopting default read noise of 1. e-
WARNING - IMCOADD: Adopting default gain of 1. e-/ADU
WARNING - IMCOADD: Adopting default read noise of 1. e-
WARNING - IMCOADD: Adopting default gain of 1. e-/ADU
WARNING - IMCOADD: Adopting default read noise of 1. e-
WARNING - IMCOADD: Adopting default gain of 1. e-/ADU
WARNING - IMCOADD: Adopting default read noise of 1. e-
WARNING - IMCOADD: Adopting default gain of 1. e-/ADU
WARNING - IMCOADD: Adopting default read noise of 1. e-
WARNING - IMCOADD: Adopting default gain of 1. e-/ADU
WARNING - IMCOADD: Adopting default read noise of 1. e-
WARNING - IMCOADD: Adopting default gain of 1. e-/ADU
WARNING - IMCOADD: No instrument definition in header
Instrument + camera      :   
Telescope ISS port number: 0
Bad pixel file gemtools$badpix.none
Read noise:   1.00 e-   Gain:   1.00 e-/ADU
Co-added cleaned output image: EMMI.2006-10-28T08:09:36.931FP_add
Statistics section: [100:1948,100:1948]
Finding objects in EMMI.2006-10-28T08:09:36.931FP
Sampling for geotran  : 20  20
Block size for geotran: 2048  2048
Centering objects in EMMI.2006-10-28T08:09:36.931FP
Number of objects successfully centered in reference image 516
Alignment method: twodx
xregister on the sections [513:768,513:768] [1281:1536,1281:1536]
Window size for search 181 pixels
Average shift from EMMI.2006-10-28T08:10:43.248FP to 36.931FP is -0.1534767 0.3943024 pixels
Overlap region: [1:2047,2:2048]

Coordinate list: tmpin327bh  Transform: EMMI.2006-10-28T08:10:43.248FP_trn
    Results file: 
Coordinate mapping status
    X fit ok.  Y fit ok.
    Xin and Yin fit rms: 6.103516E-5  1.364788E-4
Coordinate mapping parameters
    Mean Xref and Yref: 1024.347  1024.894
    Mean Xin and Yin: 1024.5  1024.5
    X and Y shift: 0.3560109  -0.5076932  (xin  yin)
    X and Y scale: 0.9999565  0.9999565  (xin / xref  yin / yref)
    X and Y axis rotation: 359.991  359.991  (degrees  degrees)
Centering objects in EMMI.2006-10-28T08:10:43.248FP

Xmax =  2048   Ymax = 2048
Entering geomap
Fitting geometry rscale
Iterating a maximum of 5 times

Coordinate list: EMMI.2006-10-28T08:10:43.248FP_trn  Transform: EMMI.2006-10-28T08:10:43.248FP_trn
    Results file: tmpres327ah
Coordinate mapping status
    X fit ok.  Y fit ok.
    Xin and Yin fit rms: 3.616828  4.33522
Coordinate mapping parameters
    Mean Xref and Yref: 1031.503  1017.997
    Mean Xin and Yin: 1031.827  1017.56
    X and Y shift: 0.280017  0.08239746  (xin  yin)
    X and Y scale: 0.9997339  0.9997339  (xin / xref  yin / yref)
    X and Y axis rotation: 0.004  0.004  (degrees  degrees)
ERROR on line 2588: Attempt to access undefined local variable `n_sigx'.

    imcoadd (images=@listfiles, alignmethod=twodx, rotate=yes, scale=yes)

or, in short, the error message:

ERROR on line 2588: Attempt to access undefined local variable `n_sigx'.

I am just simple user of iraf, and I don't know how to dig in the code to search for the reason of this error... Could someone help me ?

Thank you very much in advance.

Mike Fitzpatrick wrote on Sep 30, 2007

IMCOADD is a scary-long script I'm afraid none of us has had the nerve to master, but some of the GEMINI folks visit here and might comment. The specific message probably means the variable wasn't set for some reason, in looking at the script quickly my guess is the GEOMAP task failed (n_sigx is scanned from the output of that).

Since the shifts are so small you might try running something like XREGISTER directly to register by cross-correlation and remove any rotation terms. The results may be good enough to try stacking directly with something like IMCOMBINE. Hope this helps.

Cheers,
-Mike

Pierre_K wrote on Sep 30, 2007

Thank you for your prompt reply.

Unfortunately, the offsets between my images, including rotational offsets, are not all as small as the ones of the example I attached, that correspond to two images taken just one after the other (I have to co-add several nights together).

I already used IMALIGN on this data set, and the results are not very satisfactory from night to night due to rotational offsets of typically a few degrees.

I know a "massive" way to go around this problem: I could certainly create manually a WCS for each frame of the data set, and then use IMCOMBINE (that will take care of the rotations), but this is not very elegant and it will take me quite a long time for 70 images...

Mike Fitzpatrick wrote on Sep 30, 2007

Pierre,

There is a way to script relatively easily assuming the rotations really are only on order of a few degrees (not arbitrary) and the images have well-defined features: The STARFIND/DAOFIND task can be used to create object catalogs for each image, XYXYMATCH will match the catalogs to solve for the scale/rotation/translations, and CCMAP can be used to apply a transformation to register the images. Something like this is essentially what tasks like SREGISTER/WREGISTER do.

As for creating a WCS, there are a number of ways to do that as well. For single images see http://iraf-nvo.noao.edu/wcsfixer to try doing an automatic solution. This also does something similar to the above and is a series of IRAF scripts, but isn't (yet) packaged to be run as a standalone application and scripting the web form can be tricky. You might also see http://iraf.net/irafdocs/astrom.php for info on creating a WCS, it's specifically for mosaics but the same principles apply.

Cheers,
-Mike

holt wrote on Sep 30, 2007

Hi Pierre,

Mike is correct, the error message points to a failure in GEOMAP. The variable n_sigx is created with a scan of the output of GEOMAP. My concern however, is the first iteration of GEOMAP looks successful. This could be a bug in our script. I am interested in finding a solution.

What version of Gemini IRAF are you using? There were additions to the GEOMAP calls in IMCOADD in the latest release (1.9).

Cheers,
Jen

Eugene Romas wrote on Sep 30, 2007

I have problem with imcoadd too...
The problem in the next: i tried to centering 30 images... first 25 images have a few offsets by X and Y axis. But last 5 images have a huge(~ 250 by X and 90 by Y) offsets! And imcoadd reporting, what these last 5 images centered with xrms and yrms with values more that 5 pixels! Of course, on the summ if all these images i see the chaos: looks like 2 summs are not centered - 25 images + 5(last) are uncentered... :( I have tried to make manual summs of 25 and 5 images - while centering of these i get critical error...Not remember so sharp for describe now about that was error...
Here is a command line that i use for centering my images after calibration(darks, flat, bias):

cl> imcoadd @m74_list asection="[770:1400,1000:1700] [1700:2100,1000:1500]" alignmethod=twodx rotate- scale-

What i must to do for imcoadd make centering with much more careful? Wich parameters and their values can me help?
Thanks and sorry for my terrible english...

Last post on Sep 30, 2007