Welcome to iraf.net Friday, March 29 2024 @ 09:47 AM GMT


 Forum Index > Help Desk > Applications New Topic Post Reply
 rtextimage
   
knine
 06/06/2007 04:37PM (Read 3735 times)  
+----
Newbie

Status: offline


Registered: 11/29/2005
Posts: 14
Hello,I am currently trying to rewrite some fortran code into python. Both versions output a text file that then can be converted to an image using rtextimage.The fortran code makes this (formats to 6 decimal places): 0.352423E-06
0.146457E-05
0.516922E-06
0.204259E-05
... etcAnd the python code currently makes this (no formating, yet):3.524225997e-07
1.464569754e-06
5.1692166077e-07
2.042587134e-06
... etcIRAF liked both versions and made fits files just fine. Statistically, they appear to be the same:ecl> imstat prim.f00.fits
# IMAGE NPIX MEAN STDDEV MIN MAX
prim.f00.fits 4489 2.228E-4 0.002584 5.686E-8 0.08118
ecl> imstat prim.py00.fits
# IMAGE NPIX MEAN STDDEV MIN MAX
prim.py00.fits 4489 2.228E-4 0.002584 5.686E-8 0.08118Although if I subtract the two images, they are over so slightly different:ecl> imstat sum.fits
# IMAGE NPIX MEAN STDDEV MIN MAX
sum.fits 4489-1.185E-11 1.448E-9 -4.563E-8 4.657E-8So the question is... when rtextimage reads these numbers, is there a limit on how many places after the decimal it uses, and if so does it truncate the number or round the number up or down as needed?Thanks,- Jake

 
Profile Email
 Quote
fitz
 06/06/2007 04:37PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Hi Jake,What does IMHEAD say is the data-type of each image? My guess is that in one case it is 'real' and in the other it's 'double'. You can force these to be the same using the 'otype' parameter for RTEXTIMAGE, if left unset it lexically tries to determine the data type and given the higher precision of the python-generated pixels ......
Cheers,
-Mike

 
Profile Email
 Quote
knine
 06/06/2007 04:37PM  
+----
Newbie

Status: offline


Registered: 11/29/2005
Posts: 14
They are both real. I specified it specifically in the rtextimage parameters when I made both of them.ecl> imhead prim.f00.fits
prim.f00.fits[67,67][real]:
No bad pixels, min=0., max=0. (old)
Line storage mode, physdim [67,67], length of user area 1215 s.u.
Created Wed 09:59:43 06-Jun-2007, Last modified Wed 09:54:48 06-Jun-2007
Pixel file "prim.f00.fits" [ok]
EXTEND = F / File may contain extensions
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator
DATE = '2007-06-06T15:54:48' / Date FITS file was generated
IRAF-TLM= '09:54:48 (06/06/2007)' / Time of last modificationecl> imhead prim.py00.fits
prim.py00.fits[67,67][real]:
No bad pixels, min=0., max=0. (old)
Line storage mode, physdim [67,67], length of user area 1215 s.u.
Created Wed 09:58:56 06-Jun-2007, Last modified Wed 09:53:53 06-Jun-2007
Pixel file "prim.py00.fits" [ok]
EXTEND = F / File may contain extensions
ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator
DATE = '2007-06-06T15:53:53' / Date FITS file was generated
IRAF-TLM= '09:53:53 (06/06/2007)' / Time of last modificationOne guess I have is if rtextimage truncates say (for example) at 6 decimal places, the number used in the file created by Fortran would be 0.352423E-06 and the number used in the file created by Python would be 3.52422e-07 and not round the 2 up to 3 (see my first post). The other guess, I would presume if rtextimage uses all the numbers of the decimals to produce the image, that would explain the slight difference too, since there are more decimal places in the python produced file.If the first case is true and rtextimage truncates at some point, I would be a little worried and probably change the python code round to the number of decimals needed before writing the file. If the later is true, I'm not too worried about it.Thanks Mike,- Jake

 
Profile Email
 Quote
fitz
 06/06/2007 04:37PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Jake,There is no explicit truncation going on, all the characters are converted (to double actually) and so the difference must just be in the number of chars produced by the python code.-Mike

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