Welcome to iraf.net Friday, April 19 2024 @ 08:56 AM GMT


 Forum Index > Help Desk > Applications New Topic Post Reply
 geotran/gregister issues
   
pyrafuser
 01/31/2006 04:02AM (Read 5461 times)  
+----
Newbie

Status: offline


Registered: 01/30/2006
Posts: 4
Hi! I'm trying to automate LRIS multislit spectra reduction, and I'm currently working on line rectification/wavelength calibration. The AUTOID task has not been successful in any of the attempts I tried, so I wrote a python task that identifies lines and assigns them wavelengths. I then use this coordinate transformation with geomap/geotran to straighten the sky lines and apply the wavelength calibration. The line straightening works. However, when I do this (with nomwcs=no), the updated "WCS" information is way off.I start with a pixel-based WCS (ie CRVAL1=CRVAL2=CRPIX1=CRPIX2=CD1_1=CD2_2=1) and specify (in both geomap and geotrans) a wavelength range that will accomodate all slits on the slit mask (I've also run geomap/geotran without specifying any inputs; see below). Finally, I select a "scale" that is equal to the scale of the grating used.The output scale differs from the expected scale, and CRPIX1 is set to a very large negative number that does not correspond to 1 minus the expected starting wavelength. Additionally, the wavelength solution simply does not match the data from which it was derived (ie features are assigned wavelengths in the output image that do not correspond to the "correct" wavelength of the feature). (Note that the geomap database seems fine; if I use geoxytran either forward or backward, I get the values that I expect). If I do not choose a wavelength range or scale, the geotran output image is truncated to the first and last feature (ie the first and last identified arcline, which of course does not correspond to the whole spectral trace). Furthermore, this image has an incorrect wavelength calibration as well.Here's some of the data I'm working with; any hints would be greatly appreciated!first input coords:
6929.46679688 13.0 191.265441895 13.0
6965.43017578 13.0 230.917709351 13.0
7032.41308594 13.0 304.99041748 13.0
7067.21679688 13.0 343.371795654 13.0
7147.04101562 13.0 431.398529053 13.0
7245.16601562 13.0 539.265991211 13.0
7272.93505859 13.0 569.635437012 13.0
7383.97900391 13.0 691.38671875 13.0
7503.86816406 13.0 822.721496582 13.0
7514.65087891 13.0 834.30090332 13.0
7635.10595703 13.0 964.809509277 13.0
7723.75976562 13.0 1062.87438965 13.0
7948.17480469 13.0 1307.09228516 13.0
8006.15576172 13.0 1370.25866699 13.0
8014.78515625 13.0 1379.77758789 13.0
8103.69189453 13.0 1476.66027832 13.0
8115.31103516 13.0 1488.74938965 13.0
8408.20898438 13.0 1809.75866699 13.0
8424.64746094 13.0 1827.87072754 13.0
8521.44335938 13.0 1934.23339844 13.0output from geoxytran run forward using the first two columns of input:
191.242843628 13. 191.265441895 13.0
230.990966797 13. 230.917709351 13.0
304.95501709 13. 304.99041748 13.0
343.348907471 13. 343.371795654 13.0
431.30557251 13. 431.398529053 13.0
539.226196289 13. 539.265991211 13.0
569.726623535 13. 569.635437012 13.0
691.515563965 13. 691.38671875 13.0
822.705383301 13. 822.721496582 13.0
834.49041748 13. 834.30090332 13.0
966.005554199 13. 964.809509277 13.0
1062.66540527 13. 1062.87438965 13.0
1307.08642578 13. 1307.09228516 13.0
1370.23510742 13. 1370.25866699 13.0
1379.63549805 13. 1379.77758789 13.0
1476.52856445 13. 1476.66027832 13.0
1489.19885254 13. 1488.74938965 13.0
1809.63879395 13. 1809.75866699 13.0
1827.70593262 13. 1827.87072754 13.0
1934.33898926 13. 1934.23339844 13.0output from geoxytran run backwards using the last two columns input:
6929.46679688 13.0 6929.48762808 13.
6965.43017578 13.0 6965.36425844 13.
7032.41308594 13.0 7032.4455525 13.
7067.21679688 13.0 7067.23797806 13.
7147.04101562 13.0 7147.12586114 13.
7245.16601562 13.0 7245.20263382 13.
7272.93505859 13.0 7272.85247725 13.
7383.97900391 13.0 7383.8618052 13.
7503.86816406 13.0 7503.88337554 13.
7514.65087891 13.0 7514.4779349 13.
7635.10595703 13.0 7634.01003411 13.
7723.75976562 13.0 7723.95206818 13.
7948.17480469 13.0 7948.18080814 13.
8006.15576172 13.0 8006.17794133 13.
8014.78515625 13.0 8014.91619571 13.
8103.69189453 13.0 8103.81332244 13.
8115.31103516 13.0 8114.89949441 13.
8408.20898438 13.0 8408.31878766 13.
8424.64746094 13.0 8424.79798631 13.
8521.44335938 13.0 8521.34834449 13.New fits header info created by geotran when I request a wavelength range (ie xmin and xmax) between ~5840 and 9460 angstroms and a scale of xscale=0.93:
CRVAL1 = 1
CRVAL2 = 1
CRPIX2 = -11.5
CRPIX1 = -7239.11404626634
CD1_1 = 1.01697353906765
CD2_2 = 1
CTYPE1 = 'LINEAR '
CTYPE2 = 'LINEAR '
DC-FLAG = 0
CD1_2 = -0.0406438745558262
CD2_1 = 2.9555549046169E-17
LTM2_1 = 0.0399655182701096 Finally, here is my geomap database:
xrefmean 7648.172558594498
yrefmean 12.5
xmean 979.086815770507
ymean 12.5
geometry general
function chebyshev
xshift -7383.807010489952
yshift -2.353967715196248E-13
xmag 1.093519717654552
ymag 1.00082562153382
xrotation 360.
yrotation 357.6725583931224
xrms 0.1682533263130634
yrms 8.434876077578000E-16
surface1 11
1. 1.
2. 2.
2. 2.
0. 0.
5836.544433589999 5836.544433589999
9463.544433589998 9463.544433589998
1. 1.
24. 24.
981.1593701145858 12.5
1983.09800796653 5.763331435357232E-14
-0.467404582807535 11.49999999999999
surface2 29
1. 1.
6. 6.
6. 6.
2. 2.
5836.544433589999 5836.544433589999
9463.544433589998 9463.544433589998
1. 1.
24. 24.
5.195765776704424 4.805157366940583E-15
20.6205458920779 -9.433903832196211E-14
8.998922900215164 7.097120047111710E-15
7.483915560335896 -1.954936355525627E-14
4.946834968784898 2.495889045755223E-15
-0.6588775671683718 -4.243029028645900E-15
2.99084045885732 4.428700694219856E-15
-1.004276826399743 1.407462370557765E-15
4.292627569421082 -4.120408370002834E-15
-0.230024539545745 3.510512278569258E-16
1.323732243373403 -1.355277320456679E-15
0.1982748582335911 -1.478425285214591E-16
-0.6488923187867854 1.291819038551331E-15
0.2069876456906714 -1.299255914209847E-16
-0.2203100697429938 4.810119460548861E-16
0.1498905775370817 -3.700186080911870E-16
-0.07881301630584955 -6.493907931174889E-17
0.1660669358595263 -2.727900146654207E-16
0.006307883449278955 6.518204519906633E-19
-0.03359248602459459 1.029991853030340E-16
-0.005674359030824838 -5.901367221123035E-17One known "solution" is to use geoxytran to find the wavelengths that the first/last pixels of the input image correspond to and use these to set xmin/xmax in the geotran step. This image would (presumably) be correctly wavelength calibrated, although with an "unknown" calibration. The WCS keywords could then be added by hand. However, I'm not sure if I trust the output of geotran at this point. (In all of my trials, whether I specify scale and xmin/xmax or not, the line ratios of the output image do not appear to be correct. While each of the rows of the image seems to be resampled correctly--since the arclines are straightened--the dispersion solution does not seem to have been applied correctly. Of course, I could be wrong--it is tedious to check this, though, and would be much easier if the WCS was updating "correctly".)So there we have it!!! After all of this, I now appreciate the "simplicity" of fitcoords/transform. However, not having an IDENTIFY database apparently precludes me from using those tools (unless of course there is a way to "fake it" with the data I have). Thanks again for any help/advice you can provide!Matt

 
Profile Email
 Quote
valdes
 01/31/2006 04:02AM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
Hi Matt,I'm sorry I have not commented earlier. My first comment is that geomap/geotran are pixel oriented. This has the effects such as you found with the values of CRVAL vs CRPIX. You could do some calculations to convert from CRVAL1=1, CRPIX1=-7239... to a more reasonable CRPIX1=1, CRVAL1="some wavelength".I could try and work through some of the things you include. But you ask about getting your pixel and wavelength values into the more spectral oriented tasks. I suggest that you fake an IDENTIFY database. The format of the database is given under the help for IDENTIFY. You could simply run IDENTIFY on the original data mark a line or two with some arbitrary wavelengths and then write the result. This would give you the dummy database. If you look at the file you see that it is essentially a list of pixel position and wavelength with some other fields you can just leave alone. Since you already have pixel/wavelength pairs from your program it would be a simple matter to insert this information. Then you would go back to IDENTIFY and do the fitting (the 'f' key). Whether or not you do the fit, you would use REIDENTIFY to populate points for a 2D dispersion to be computed by FITCOORDS and then applied by TRANSFORM. The reason a fit in IDENTIFY is not needed is FITCOORDS only cares about the pixel (2D) and wavelength table and doesn't care about any 1D dispersion fits.You indicated that the only problem was getting the initial identification of lines. So I'm assuming once lines are identified at one row then the reidentification, involving recentroiding on nearby lines, works fine for your LRIS data. Note that if you are doing your own identifications at various points across the dispersion then you could similarly substitute your values into the format produced by REIDENTIFY.Respond to this post with futher questions or if there is some more important reason for using GEOMAP than just because it seemed easier to generate the list of points to fit.Yours,
Frank

 
Profile Email
 Quote
pyrafuser
 01/31/2006 04:02AM  
+----
Newbie

Status: offline


Registered: 01/30/2006
Posts: 4
Thanks for the reply Frank! A primary purpose of my project is to remove the need to interactively ID lines on any level. If fitcoords only looks at the pixel/wavelength pairs, I could "fake" an ID file using old ID files as templates, but these would contain all of the data in my geomap coordinate database and more (for example the coefficients). This doesn't seem efficient, although it would work. The geomap/geotran method also works, although I have to hedit the FITS keywords by hand; but as long as I've specified a scale and a starting wavelength (ie xmin) in geotran, it works fine. Nevertheless, I'm still confused about the behavior of geotran. The fact that my output units are "wavelength" seems arbitrary. If I wanted to create a 10000 pixel array and I reassociated the 24.38 pixel from my data with the 6932.7 pixel of the output array (note that we are only in "pixel" space), and then asked geotran to perform the transformation, it would default to only giving me the part of the output array that contained data from my input. In other words, it--of course--wouldn't give me a 10000 pixel output array (geotran doesn't even know that I had this grand 10000 pixel array in mind in the first place). However, it seems that geotran should be smart enough to know that whatever output array was created, the pixel that formerly corresponded to 24.38 now corresponds to 6932.7 (since, after all, that was the whole point of this transformation from one pixel frame to another pixel frame). However, when I run geotran with nomwcs=no, the updated "wcs" values are not indicative of the transformation that was made (ie no matter how I look at it, the CRVAL/CRPIX/CDi_i values don't seem to make sense for my data).Since my hediting of files seems to work, it's not a problem for me anymore. But it does seem like geotran is not behaving properly....Regards,
Matt

 
Profile Email
 Quote
valdes
 01/31/2006 04:02AM  
+++++
Active Member

Status: offline


Registered: 11/11/2005
Posts: 728
I always find GEOMAP/GEOTRAN confusing ! Confused I've helped users in the past and they and I always have a conceptual problem. I guess the author of these tasks has a particular mental picture which is hard for us to grasp. So I think it is behaving properly according to how the author intended but it is hard to figure out the set of parameters that would do what you want. I won't explore this unless you are stuck, which I gather you are not.Cheers,
Frank

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