Re: Would you help me out? data converting problem. [message #12332] |
Tue, 21 July 1998 00:00 |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <35B3EA5B.AEF03773@maxwell.ph.kcl.ac.uk>, Jouhahn Lee <jl@maxwell.ph.kcl.ac.uk> writes:
> This is a multi-part message in MIME format.
> --------------007CC9E8235FA634588EBB27
> Content-Type: text/plain; charset=x-user-defined
> Content-Transfer-Encoding: 8bit
>
> Hello friends,
>
> a string form of integer data. The data set was consist of 2048 integer
> ascii numbers.
> What I am trying to do is to make 64 x 32 image from that data file.�
> However, I could
> not convert this file to 64x32 image file.
You say the data are ASCII. If so the following IDL code should work:
data = lonarr(62, 32)
openr, lun, /get, 'aug14.dat'
readf, lun, data ; Formatted read
If the data are actually binary then do the following:
data = lonarr(62, 32)
openr, lun, /get, 'aug14.dat'
readu, lun, data ; Unformatted read
You can also read into a linear 2048 array and then convert to 2-D:
data = lonarr(2048)
openr, lun, /get, 'aug14.dat'
readf, lun, data ; Formatted read
data = reform(data, 64, 32)
____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)
or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
|
|
|
Re: Would you help me out? data converting problem. [message #12333 is a reply to message #12332] |
Tue, 21 July 1998 00:00  |
Kevin Ivory
Messages: 71 Registered: January 1997
|
Member |
|
|
Jouhahn Lee wrote:
> I have got unformatted raw experiment data obtained from the
The data is not unformatted = binary, it's what IDL calls 'free format'.
> microscope. This is just
> a string form of integer data. The data set was consist of 2048 integer
> ascii numbers.
> What I am trying to do is to make 64 x 32 image from that data file.
> However, I could
> not convert this file to 64x32 image file. I guess there might be quite
> easy solution but
Here is a quick and dirty way of reading the file (no checks for complete
file, data consistency, free logical units, etc.):
image = intarr(64, 32)
openr, 1, /get_lun, 'Aug104.dat'
readf, 1, image
close, 1
Now you have your data in a 64 x 32 integer array and you can do all
the image processing you like. Look into the IDL book 'Building IDL
applications', chapter 'Files and Input/Output' and the book
'Using IDL', chapter 'Image Display Routines'. (The books are
available as PDF files on your installation CD and on RSI's ftp
server.)
Best regards
Kevin
--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
|
|
|