;+ ; NAME: os_fan ; ; 'Fan' a 2d array out into a 3d one. ; ; INPUTS: ; ptrstruct a struct of pointers to OSIRIS data ; nA,nB dimensions to fan it out in. ; for 2D -> 3D, just set nA = desired nZ ; for 1D -> 3D, set nA=nX, nB = nY ; OUTPUTS: ; returns a pointer struct to the fanned out data. ; EXAMPLES: ; ; im = findgen(10,20) ; result = os_fan(im,411) ; ; spect = findgen(411) ; result2 = os_fan(spect,10,20) ; ; Then result and result2 will both be 411,10,20 arrays. ; ; HISTORY: ; Began 2006-03-09 20:31:51 by Marshall Perrin ;- function os_fan, ptrstruct,nA,nB sz = size(*ptrstruct.image) if sz[0] eq 2 then begin ; Fan a 2D array out in the Z direction image = rebin(reform(*ptrstruct.image,1,sz[1],sz[2]), nA, sz[1], sz[2]) noise = rebin(reform(*ptrstruct.noise,1,sz[1],sz[2]), nA, sz[1], sz[2]) flags = rebin(reform(*ptrstruct.flags,1,sz[1],sz[2]), nA, sz[1], sz[2]) endif else if sz[0] eq 1 then begin ; Fan a 1D array out in the X and Y directions image = rebin(*ptrstruct.image, sz[1], nA,nB) noise = rebin(*ptrstruct.noise, sz[1], nA,nB) flags = rebin(*ptrstruct.flags, sz[1], nA,nB) endif else message,"I'm not sure what to do with that input!" return, {image:ptr_new(image,/no), noise:ptr_new(noise,/no), flags:ptr_new(flags,/no)} end