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

Home » Public Forums » archive » a behemoth bubble sort
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
a behemoth bubble sort [message #81881] Mon, 29 October 2012 14:24
fischertc13 is currently offline  fischertc13
Messages: 4
Registered: October 2012
Junior Member
Hi all,

I am currently frustrated trying to convert information from one data cube into another and could use some direction.

I have a 3-d modeling program which creates a spatial geometry datacube where each voxel in the geometry contains a velocity. Voxels outside the geometry are assigned an artificially high velocity that is set to be transparent in the modeling program. What I would like to do is to create a datacube with dimensions of x, y, and velocity from the spatial data cube of x,y, and z.

Unfortunately, the bubble sort I've employed in this code needs to run
through 20 billion+ data points for the program to complete, which is of
course impossible. Is there some way to simplify this? Also, is
there some way to select out the 'good' portion of the initial data cube
to apply the conversion to instead of the entire thing? You have posted on
array-juggling similar to this, though after reading the article I was not
able to apply the technique to my own problem. Any help would be much
appreciated!

Cheers,
Travis


My current codes is as follows:

----------

pro slice_run

restore,'nifscube.dat' ; restores spatial datacube 'nifs'

size = size(nifs,/dimensions)

nifs = long(nifs) ; turns velocities to integers

max = max(nifs) ; bad voxels are preset to artificially high maximum velocity

xsize = size[0]
ysize = size[1]
zsize = size[2]

good = where(nifs ne max, complement = bad)
; find where all true velocity data points exist,
; this is not employed elsewhere yet

nifs(bad) = 0 ; set bad pixels to zero velocity

min = min(nifs,max=max) ; find max/min true velocities

nifs(bad) = max+1 ; reset bad pixels out of velocity range

vsize = max-min ; set velocity space range

flux = fltarr(xsize,ysize,vsize) ; create new velocity data cube where z =
velocity

;giant for-loop that looks at each individual voxel at each velocity
;step and places the velocity at that voxel into the new cube's v-dimension.

for v = min,max-1 do begin ; v = velocity step

for x = 0,xsize-1 do begin
for y = 0,ysize-1 do begin
for z =0,zsize-1 do begin
if (nifs(x,y,z) eq v) then begin ;if voxel has vth velocity step
flux(x,y,v-min) = v ;places v at the vth plane of flux cube
endif
endfor
endfor
endfor
endfor

end
-----

Cheers,
Travis
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: FILE_MOVE - FILE_COPY
Next Topic: draw marks/ticks on a plot line

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

Current Time: Wed Oct 08 19:30:37 PDT 2025

Total time taken to generate the page: 0.00480 seconds