comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Coding for speed help needed
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Coding for speed help needed [message #9054] Fri, 30 May 1997 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Patrick V. Ford wrote:
> pop_size = 36; this can vary greatly
> dim = 64
> B = bytarr( dim * dim * 5 * pop_size)
> There are pop_size individuals
> The first 64*64 (dim*dim) bytes code for the activity or intensity in a 64
> by 64 image. The next 4*64*64 bytes code for the attenuation coefficients
> which are
> between 0.0 and 1.0, where 1.0 is no attenuation and 0.0 is 100%.

Patrick,

Are you familiar with structures in IDL? Any time you have to read mixed
datatypes from a datafile, structures are usually the easiest way to do
it. For example, let's say that on disk you have (in one contiguous
file),

- a byte array of size 64x64
- a float array of size 64x64

then to read it, you would do something like this:

openr, lun, 'input.dat', /get_lun
data = { array1 : bytarr( 64, 64 ), array2 : fltarr( 64, 64 ) } ;
structure definition
readu, lun, data ; read the structure from disk
free_lun, lun
print, data.array1( *, 0 ) ; print the first 64 elements of the byte
array
print, data.array2( *, 0 ) ; print the first 64 elements of the float
array

Then if you need to swap byte order, all you have to do is

data = swap_endian( data )

which will take care of all the data types in the structure.

Cheers,
Liam.
[Message index]
 
Read Message
Read Message
Previous Topic: Re: colors in IDL
Next Topic: Phil's Having a Bad Day...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Nov 29 11:58:23 PST 2025

Total time taken to generate the page: 0.32610 seconds