Welcome to iraf.net Thursday, May 02 2024 @ 12:23 PM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Problem with wregister
   
pweilbacher
 07/14/2006 03:27PM (Read 6728 times)  
++---
Junior

Status: offline


Registered: 03/07/2006
Posts: 19
I have a set of images all of which are dithered and come from a 2-CCD instrument (FORS2), so each exposure has two FITS images. To align and combine all of them I tuned the WCS in all these images to be correct, to good accuracy which I checked visually using USNO stars in skycat/gaia. Now I want to use that WCS to align them correctly.First I tried the MSCRED way, put the two images into FITS extensions and then ran mscimage. That worked and aligned the 2 images of each exposure correctly but destroyed the WCS again, so I cannot use them any more to align the different dithered exposures.Then I thought wregister could be the task to do it but it fails, too. The only image that seems to be correctly aligned afterwards is the 2nd image of the same exposure that I used as reference image, and even in that one the WCS is completely messed up afterwards. All other images got shifted, rotated and stretched (I also tried a subset of these operations with fitgeom=general, rotate, or rscale) but _not_ by the correct amount, so combination gives rubbish.Perhaps I should say that to make wregister work at all and not move the data out of the frame I copied all images into large enough frames and adapted the CRPIX1/CRPIX2 headers so that the WCS remained correct (which I checked again for some). The command I used (I actually did all the work in a Python script but the same command fails from plain IRAF, too) iswregister('@wreg.in', refout, '@wreg.out', fitgeometry="rscale", boundary='constant', constant=0, fluxconserve=False, interactive=True, nxblock=sizelx, nyblock=sizely)where sizelx/ly are just the size of the frames, and the same command also gives the same result with fluxcon+ and interact-, all this with IRAF 2.12.2a-EXPORT on Linux.Any ideas?

 
Profile Email
 Quote
valdes
 07/14/2006 03:27PM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
Hi Peter,I think we should address your problem with mscimage since you said it worked, I think it is an easier task to use, and I understand that task better. You say it destroyed the WCS and you can't use it anymore. This definitely should not be the case. Could you send me header listings for the two original extensions and the header listings for the result of mscimage. Also send me the parameters you use with mscimage.Yours,
Frank Valdes

 
Profile Email
 Quote
pweilbacher
 07/14/2006 03:27PM  
++---
Junior

Status: offline


Registered: 03/07/2006
Posts: 19
Hi Frank,OK, finally here they come (note that I removed the HIERARCH ESO, COMMENT, and HISTORY headers which were many):extension 1 before:XTENSION= 'IMAGE ' / Image extension
BITPIX = -32 / Bits per pixel
NAXIS = 2 / Number of axes
NAXIS1 = 2048 / Axis length
NAXIS2 = 1034 / Axis length
PCOUNT = 0 / No 'random' parameters
GCOUNT = 1 / Only one group
EXTNAME = 'im1 ' / Extension name
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator
IRAF-TLM= '17:44:28 (19/07/2006)'
INHERIT = T / Inherits global header
DATE = '2004-06-18T15:37:25'
CRVAL1 = 41.55971 / Value at ref. pixel on axis 1
CRPIX1 = 1024.77497988041 / Reference pixel on axis 1
CDELT1 = -7.0176350350190E-5 / Pixel scale on axis 1
CTYPE1 = 'RA---TAN' / Quantity represented by axis 1
CRVAL2 = 13.08693 / Value at ref. pixel on axis 2
CRPIX2 = 1159.40708385749 / Reference pixel on axis 2
CDELT2 = 7.05405955455401E-5 / Pixel scale on axis 2
CTYPE2 = 'DEC--TAN' / Quantity represented by axis 2
RA = ' 02:46:14.330' / 02:46:14.3 RA (J2000) pointing (deg)
DEC = ' 13:05:12.948' / 13:05:12.9 DEC (J2000) pointing (deg)
TELRADEC= 'FK5 ' / Reference frame for RA/DEC values
PC001001= 0.572390052550023 / Translation matrix element
PC001002= -0.819981480121217 / Translation matrix element
PC002001= 0.816505750469451 / Translation matrix element
PC002002= 0.577337301280906 / Translation matrix element
DATASEC = '[187:1862,321:1027]'
WCSDIM = 2
LTV1 = 186.
LTV2 = 320.
LTM1_1 = 1.
LTM2_2 = 1.
WAT0_001= 'system=image'
WAT1_001= 'wtype=tan axtype=ra'
WAT2_001= 'wtype=tan axtype=dec'
ZEROCOR = 'Jun 18 16:21 Zero is ../calib/Bias_all[im1]'
CCDPROC = 'Jun 18 16:37 CCD processing done'
DETSEC = '[187:1863,321:1028]'
FLATCOR = 'Jun 18 16:37 Flat is ../calib/Flat_Oct30_B_BESS.fits[im1], scale 222'
FIXPIX = 'Jun 18 16:39 Bad pixel file is ../fixpix.lowerCCD'
FIXPIX02= 'Jun 18 16:39 Bad pixel file is ../fixpix.lowerCCD.extra'
ENDextension 2 before:XTENSION= 'IMAGE ' / Image extension
BITPIX = -32 / Bits per pixel
NAXIS = 2 / Number of axes
NAXIS1 = 2048 / Axis length
NAXIS2 = 1034 / Axis length
PCOUNT = 0 / No 'random' parameters
GCOUNT = 1 / Only one group
EXTNAME = 'im2 ' / Extension name
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator
IRAF-TLM= '17:44:28 (19/07/2006)'
INHERIT = T / Inherits global header
DATE = '2004-06-18T15:37:26'
CRVAL1 = 41.55971 / Value at ref. pixel on axis 1
CRPIX1 = 1024.59668347586 / Reference pixel on axis 1
CDELT1 = -7.0136384035051E-5 / Pixel scale on axis 1
CTYPE1 = 'RA---TAN' / Quantity represented by axis 1
CRVAL2 = 13.08693 / Value at ref. pixel on axis 2
CRPIX2 = 121.999720903152 / Reference pixel on axis 2
CDELT2 = 7.01229895042666E-5 / Pixel scale on axis 2
CTYPE2 = 'DEC--TAN' / Quantity represented by axis 2
RA = ' 02:46:14.330' / 02:46:14.3 RA (J2000) pointing (deg)
DEC = ' 13:05:12.948' / 13:05:12.9 DEC (J2000) pointing (deg)
TELRADEC= 'FK5 ' / Reference frame for RA/DEC values
PC001001= 0.575355505414339 / Translation matrix element
PC001002= -0.817903443194495 / Translation matrix element
PC002001= 0.817943320276531 / Translation matrix element
PC002002= 0.575298813500431 / Translation matrix element
RDNOISE = 2.70 / Readout noise per output (e-)
CHECKSUM= 'LUALOU8JLUAJLU7J' / ASCII 1's complement checksum
DATASEC = '[187:1862,8:967]'
WCSDIM = 2
LTV1 = 186.
LTV2 = 7.
LTM1_1 = 1.
LTM2_2 = 1.
WAT0_001= 'system=image'
WAT1_001= 'wtype=tan axtype=ra'
WAT2_001= 'wtype=tan axtype=dec'
ZEROCOR = 'Jun 18 16:21 Zero is ../calib/Bias_all[im2]'
CCDPROC = 'Jun 18 16:37 CCD processing done'
DETSEC = '[188:1864,1063:2023]'
FLATCOR = 'Jun 18 16:37 Flat is ../calib/Flat_Oct30_B_BESS.fits[im2], scale 222'
FIXPIX = 'Jun 18 16:39 Bad pixel file is ../fixpix.upperCCD'
END
mscimage output:SIMPLE = T / Fits standard
BITPIX = -32 / Bits per pixel
NAXIS = 2 / Number of axes
NAXIS1 = 2035 / Axis length
NAXIS2 = 2068 / Axis length
EXTEND = F / File may contain extensions
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator
DATE = '2006-07-19T15:46:01' / Date FITS file was generated
IRAF-TLM= '17:46:21 (19/07/2006)' / Time of last modification
MJD-OBS = 52577.21832664 / Modified Julian Date of observation
DATE-OBS= '2002-10-30T05:14:23.422Z'/ Date of observation
EXPTIME = 484.97 / Total integration time
TELESCOP= 'ESO-VLT-U4' / ESO Telescope Name
ST = ' 03:06:10.779' / 03:06:10.779 LST at start (sec)
UT = ' 05:14:23.000' / 05:14:23.000 UTC at start (sec)
INSTRUME= 'FORS2 ' / Instrument used
IMAGETYP= 'object ' / Observation type
AIRMASS1= 1.269 / Airmass at start
SEEING1 = 0.58 / Observatory Seeing queried from AS
AIRMASS2= 1.274 / Airmass at end
SEEING2 = 0.71 / Observatory Seeing queried from AS
FILTER = 'B_BESS ' / Filter i name
GAIN = 1.25 / Conversion from ADUs to electrons
RDNOISE = 3.15 / Readout noise per output (e-)
CHECKSUM= 'QDTdR9QdQAQdQ9Qd' / ASCII 1's complement checksum
OBSTYPE = 'object '
CCDMEAN = 3288.583 /88.5825
CRVAL1 = 41.56285 / Value at ref. pixel on axis 1
CRPIX1 = 974.59233491819 / Reference pixel on axis 1
CTYPE1 = 'RA---TAN' / Quantity represented by axis 1
CRVAL2 = 13.08304 / Value at ref. pixel on axis 2
CRPIX2 = 1105.9987989595 / Reference pixel on axis 2
CTYPE2 = 'DEC--TAN' / Quantity represented by axis 2
RA = ' 02:46:14.330' / 02:46:14.3 RA (J2000) pointing (deg)
DEC = ' 13:05:12.948' / 13:05:12.9 DEC (J2000) pointing (deg)
TELRADEC= 'FK5 ' / Reference frame for RA/DEC values
PC001001= 0.572390052550023 / Translation matrix element
PC001002= -0.819981480121217 / Translation matrix element
PC002001= 0.816505750469451 / Translation matrix element
PC002002= 0.577337301280906 / Translation matrix element
WCSDIM = 2
LTM1_1 = 1.
LTM2_2 = 1.
WAT0_001= 'system=image'
WAT1_001= 'wtype=tan axtype=ra'
WAT2_001= 'wtype=tan axtype=dec'
ZEROCOR = 'Jun 18 16:21 Zero is ../calib/Bias_all[im1]'
CCDPROC = 'Jun 18 16:37 CCD processing done'
FLATCOR = 'Jun 18 16:37 Flat is ../calib/Flat_Oct30_B_BESS.fits[im1], scale 222'
FIXPIX = 'Jun 18 16:39 Bad pixel file is ../fixpix.lowerCCD'
FIXPIX02= 'Jun 18 16:39 Bad pixel file is ../fixpix.lowerCCD.extra'
CD1_1 = -7.0188112021935E-5
CD2_2 = 7.00218800514801E-5
CDELT1 = -7.0188112021935E-5
CDELT2 = 7.00218800514801E-5
NCOMBINE= 2
BPM = 'FORS2.2002-10-30T05:14:23p_bpm'
ENDThe command I used wasmscimage @OBJs_ @OBJs_p interpolant=sinc17 nxblock=8000 nyblock=8000 fluxcon- verbose+where the file I quote the headers of is of course contained in the list OBJs.

 
Profile Email
 Quote
valdes
 07/14/2006 03:27PM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
I created an MEF with the two headers your show. I put in some artificial stars and used the WCS to assign them coordinates. When I use MSCDISPLAY and MSCTVMARK (or you can use MSCZERO and the 'm' key) the stars are circled at the right coordinates. I then ran MSCIMAGE and thn used MSCDISPLAY and MSCTVMARK again (these work on single images as well as MEFs) and the stars are again circled. So you will have to explain why you think the WCS is no longer valid.For your info the script I used to test this is:[code:1:096ecda699]
# Create two images with different WCS as given in the hdr1 and
# hdr2 files. Note I had to edit the hdr files to put the equal
# sign at column 9 to be seen as valid FITS keywords.
# The stars.dat file contains:
#
# 1024 512 -2

mkobjects ("test1", output="", title="", ncols=2048, nlines=1034,
header="hdr1", background=100., objects="stars.dat", xoffset=0.,
yoffset=0., star="moffat", radius=1., beta=2.5, ar=1., pa=0.,
distance=1., exptime=1., magzero=7., gain=1., rdnoise=1., poisson=no,
seed=1, comments=yes)
mkobjects ("test2", output="", title="", ncols=2048, nlines=1034,
header="hdr2", background=100., objects="stars.dat", xoffset=0.,
yoffset=0., star="moffat", radius=1., beta=2.5, ar=1., pa=0.,
distance=1., exptime=1., magzero=7., gain=1., rdnoise=1., poisson=no,
seed=2, comments=yes)
imcopy test1 test[im1]
imcopy test2 test[im2,append]

# Convert the input pixel coordinates for the stars to RA and Dec based
# on the WCS in each extension.
# The result is:
#
# 2:46:14.34 13:02:28.5 -2
# 2:46:14.34 13:06:51.4 -2

wcsctran ("stars.dat", "STDOUT", "test[1]", "logical", "world",
columns="1 2 3 4 5 6 7", units="", formats="%.2H %.1h", min_sigdigit=9,
verbose=no, > "stars.coord")
wcsctran ("stars.dat", "STDOUT", "test[2]", "logical", "world",
columns="1 2 3 4 5 6 7", units="", formats="%.2H %.1h", min_sigdigit=9,
verbose=no, >> "stars.coord")

# Now display and mark the stars.

mscdisp test 1
msctvmark ("stars.coord", 1, output="", fields="1,2,3", wcs="world",
mark="circle", radii="10", lengths="0", font="raster", color=204,
label=no, nxoffset=0, nyoffset=0, pointsize=3, txsize=1)

# Now resample.

mscimage test resampled

# Now display and mark the stars again.

mscdisp resampled 2
msctvmark ("stars.coord", 2, output="", fields="1,2,3", wcs="world",
mark="circle", radii="10", lengths="0", font="raster", color=204,
label=no, nxoffset=0, nyoffset=0, pointsize=3, txsize=1)
[/code:1:096ecda699]

 
Profile Email
 Quote
pweilbacher
 07/14/2006 03:27PM  
++---
Junior

Status: offline


Registered: 03/07/2006
Posts: 19
I could actually never get msctvmark to do something on the machine I work. But I used GAIA and DS9 to set and verify that the WCS is correct in the images before resampling and there I also see that it is broken afterwards.Hmm, I now tried msctvmark on another machine and there it does display something (but only if the image is loaded into frame 1 in DS9) and there I see the circles appearing somewhere else than they should. There is a large offset and a nearly 180 degree mismatch in angle. So even the input images are broken which probably also explains the failure of wregister.Do you see any WCS header keywords IRAF/mscred/wregister does not understand? Is there anything I can do to the headers to change that or do I have to start tuning the WCS from scratch?[b:0e0be0c6fe]Update[/b:0e0be0c6fe]: In the meantime I also tried to change the keywords PC00i00j to PCi_j which I understand are now the official way to write the transformation matrix. I also tried the WCSFixer webapp at http://nvo.noao.edu/wcsfixer/ but that dies saying
[quote:0e0be0c6fe]
Transferring image... done.
Validating image ...Previewing...done.
Getting usno-b1 stars for field ....
50 stars found (75 max, 62 clipped)
Making image object catalog....
Warning: No data to interpolate ERROR: Cannot open file
(catalog.image14_2)°
Error while reading login.cl file - may need to
rebuild with mkiraf Fatal startup error. CL dies.
[/quote:0e0be0c6fe][b:0e0be0c6fe]Update 2[/b:0e0be0c6fe]: I was now successful to get a proper WCS that all of IRAF, DS9, and GAIA can understand by using imwcs from the wcstools package. Not all images fit right on the first try but for those that do, wregister appears to be working fine now, too. Thanks for the hints.

 
Profile Email
 Quote
   
Content generated in: 0.13 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