Re: Help! G4 problem reading ascii data [message #36593] |
Tue, 07 October 2003 10:00 |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
> P.S. Let's just say if I spend half a day tracking
> down memory leaks in objects only to discover that
> I haven't called a superclass CLEANUP method again,
> I'm *definitely* going to retire. :-(
Yeah, we heard that before :-)
Pavel
|
|
|
Re: Help! G4 problem reading ascii data [message #36601 is a reply to message #36593] |
Mon, 06 October 2003 09:26  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David writes:
> Perhaps you got a chuckle out of this as you recalled "I remember when I was
> that inexperienced with IDL"
The mistakes you make from inexperience aren't nearly
as embarrassing as the mistakes you make when you are
suppose to be an "expert". :-(
Cheers,
David
P.S. Let's just say if I spend half a day tracking
down memory leaks in objects only to discover that
I haven't called a superclass CLEANUP method again,
I'm *definitely* going to retire. :-(
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Help! G4 problem reading ascii data [message #36602 is a reply to message #36601] |
Mon, 06 October 2003 08:50  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
This looks like a problem with READ_ASCII (or how it is used). If I
read the file myself (code below), everything looks OK.
This does not appear to be related to the "G4 problem".
Ken
250 -0.996365 0.073411 2.003076 0.073721
251 -0.997232 0.061170 2.002258 0.061477
252 -0.997951 0.048919 2.001589 0.049224
253 -0.998521 0.036661 2.001069 0.036963
254 -0.998941 0.024396 2.000701 0.024697
255 -0.999212 0.012128 2.000482 0.012427
256 -0.999334 -0.000143 2.000414 0.000155
257 -0.999306 -0.012415 2.000496 -0.012116
258 -0.999128 -0.024686 2.000729 -0.024386
259 -0.998800 -0.036953 2.001111 -0.036652
> -0.996365 0.073411 2.003076 0.073721
> -0.997232 0.061170 2.002258 0.061477
> -0.997951 0.048919 2.001589 0.049224
> -0.998521 0.036661 2.001069 0.036963
> -0.998941 0.024396 2.000701 0.024697
> -0.999212 0.012128 2.000482 0.012427
> -0.999334 -0.000143 2.000414 0.000155
> -0.999306 -0.012415 2.000496 -0.012116
> -0.999128 -0.024686 2.000729 -0.024386
> -0.998800 -0.036953 2.001111 -0.036652
PRO TESTDATA
infile = '~/testdata.txt' ;Input file
n = FILE_LINES(infile) ;Number of lines
x = FLTARR(4, n) ;Data array
x0 = FLTARR(4) ;Data buffer
OPENR, iunit, infile, /GET_LUN ;Open file
FOR i = 0, n-1 DO BEGIN
READF, iunit, x0 ;Read one line
x[*,i] = x0 ;Store in x
ENDFOR
FREE_LUN, iunit ;Close file
FOR i = 0, n-1 DO PRINT, i, x[*,i], $ ;Print x
FORMAT = "(I4,4F12.6)"
END
|
|
|
Re: Help! G4 problem reading ascii data [message #36603 is a reply to message #36602] |
Mon, 06 October 2003 08:28  |
David
Messages: 24 Registered: April 1997
|
Junior Member |
|
|
Hi all,
It appears as though I'm an idiot. Looking at the data below, I saw that
the integer data in column 3 was not quite random, but was related to the
inconsistencies in the data in column 2. I tried the same routine, but did
not use the "fixed width" option and everything worked fine. I don't know
why I didn't try this earlier. I guess I was lulled into believing the
fixed width option was what I wanted because it says in parentheses (data is
in columns) next to it. Well, my data is in columns and this seemed like
the appropriate option. Anyway, it works fine with the "delimited" option.
Sorry to have wasted your time.
Perhaps you got a chuckle out of this as you recalled "I remember when I was
that inexperienced with IDL"
David
"David" <dpjackson@yahoo.com> wrote in message
news:A4fgb.214$Yj.177490@monger.newsread.com...
> Hi all,
>
> I am quite new to IDL and I am having what appears to be a serious
> problem with IDL on a G4 Mac. I could really use some help. I read
> the thread about the known G4 problem and it is not clear to me whether
> this problem is related or not. I hope I am doing something stupid and
> someone can point this out to me, but the code is very simple and I am
> stumped.
> I am running IDL 6.0 on a Mac G4 running 10.2.6.
>
> The problem is that when I read ascii data from a file that has more
> than 2 columns, the data does not read properly in columns beyond 1 and
> 2. The data is fine up to array item 255, but after that I get random
> integer data. This sounds somewhat similar to the G4 problem discussed
> earlier so I am wondering if it is the same issue and what I can do about
> it.
>
> Here is the code that I am using:
>
> datatemplate=ascii_template( '~jacksond/testdata.txt')
>
data=read_ascii(filepath('testdata.txt',root_dir='~jacksond' ),template=datat
> emplate)
> for i=250,260 do begin
> print, data.field1[i], data.field2[i], data.field3[i], data.field4[i]
> endfor
> END
>
> I have included the data file that I am using. It is simple 4 columns
> of tab delimited floating point data with 512 entries. During the
> ascii_template command, I choose "fixed width" on step one and the
> defaults for everything else. The output of this program looks like
> the following:
>
> -0.996365 0.0734110 2.00308 0.0737210
> -0.997232 0.0611700 2.00226 0.0614770
> -0.997951 0.0489190 2.00159 0.0492240
> -0.998521 0.0366610 2.00107 0.0369630
> -0.998941 0.0243960 2.00070 0.0246970
> -0.999212 0.0121280 2.00048 0.0124270
> -0.999334 -0.000140000 3.00000 4.00000
> -0.999306 -0.0124100 5.00000 6.00000
> -0.999128 -0.0246800 6.00000 9.00000
> -0.998800 -0.0369500 3.00000 1.00000
> -0.998322 -0.0492100 5.00000 4.00000
>
> while the output of the command head -n 260 testdata.txt | tail -n 10
>
> -0.996365 0.073411 2.003076 0.073721
> -0.997232 0.061170 2.002258 0.061477
> -0.997951 0.048919 2.001589 0.049224
> -0.998521 0.036661 2.001069 0.036963
> -0.998941 0.024396 2.000701 0.024697
> -0.999212 0.012128 2.000482 0.012427
> -0.999334 -0.000143 2.000414 0.000155
> -0.999306 -0.012415 2.000496 -0.012116
> -0.999128 -0.024686 2.000729 -0.024386
> -0.998800 -0.036953 2.001111 -0.036652
>
> As you can see, the IDL data in columns 3 and 4 "go bad" at array
> element 256. In fact, I just noticed that in column 2, the data beginning
> ast element 256 is no longer exactly the same as the original. Weird.
>
> I'd appreciate any help/advice I can get on this problem.
>
> David
>
> --
> David P. Jackson
> Associate Professor
> Dept. of Physics & Astronomy
> Dickinson College
> Carlisle, PA 17013
> (717) 245-1073
>
>
|
|
|
Re: Help! G4 problem reading ascii data [message #36604 is a reply to message #36603] |
Mon, 06 October 2003 08:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David writes:
> During the
> ascii_template command, I choose "fixed width" on step one and the
> defaults for everything else.
Does the same thing happen if you choose "white space", rather
than "fixed width" on your template?
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|