Welcome to iraf.net Friday, May 03 2024 @ 08:46 PM GMT
smp |
03/01/2010 01:18PM (Read 1654 times)
|
|
|
Status: offline
Registered: 07/27/2008
Posts: 70
|
Hi,[b:fa11229b39]What my script does?[/b:fa11229b39]
Follwoing procedure script finds std. deviation of each image.
Then square it to calculate variance of that image.
Then pass this variance to a text file.
This is done for all the images in the image-list.[b:fa11229b39]What is my problem?[/b:fa11229b39]
I get the text file containing variances (variance_of_all_images.txt),
but the I get all variance numbers in a line with some strange characters in between numbers.The other file "stddev_of_all_images.txt" is okay.[code:1:fa11229b39]procedure stddev_and_variance(input)string input
struct *imglistbegin string input_file, imgfile, imname
real sigma, var input_file = input imgfile = mktemp("tmp$t_input_")
sections(input_file, option = "fullname", > imgfile)
imglist = imgfile
if(access(" stddev_of_all_images.txt"))
{ delete("stddev_of_all_images.txt ") }
else{ print("\nfile not found: 1\n") } if(access(" variance_of_all_images.txt"))
{ delete("variance_of_all_images.txt") }
else{ print("\nfile not found: 2\n") } while(fscan(imglist,imname) != EOF)
{
sigma = 0.0
var = 0.0 imstat(images=imname,fields="stddev",format=no) | scan(sigma)
var = sigma*sigma printf(sigma//"\n", >> "stddev_of_all_images.txt") printf(var//"\n", >> "variance_of_all_images.txt") }end[/code:1:fa11229b39]
Regards,
smp
|
|
|
|
fitz |
03/01/2010 01:18PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
I think the problem is that you're using printf() which is expecting a format string, you should be using print() instead. For example[code:1:1838bb2949]printf ("%g\n", sigma, >> "foo.txt")orprint (sigma, >> "foo.txt")
[/code:1:1838bb2949]-Mike
|
|
|
|
smp |
03/01/2010 01:18PM
|
|
|
Status: offline
Registered: 07/27/2008
Posts: 70
|
Thanks.
It worked.Regards,
smp
|
|
|
|
| |
|
Content generated in: 0.10 seconds |
|