;+ ; NAME: os_divide ; ; Divide a datacube by a spectrum. ; ; INPUTS: ; cube ptrstruct to OSIRIS cube ; spectrum prtstruct to 1D spectrum ; KEYWORDS: ; OUTPUTS: ; ; returns a new ptr structure to a new cube. ; ; HISTORY: ; Began 2006-05-08 14:28:06 by Marshall Perrin ;- function os_divide,cube,spectrum szc = size(*cube.image) szs = size(*spectrum.image) if szc[1] ne szs[1] then message,"Cube and spectrum don't appear to be the same size!" nz = szc[1] newim = fltarr(szc[1],szc[2],szc[3]) newnoise = fltarr(szc[1],szc[2],szc[3]) spectcube= os_fan(spectrum,szc[2],szc[3]) newimage = *cube.image / *spectcube.image newnoise = newimage * sqrt( (*cube.noise/*cube.image)^2 + $ (*spectcube.noise/*spectcube.image)^2 ) ; For now just copy the flags along since I don't really understand them. newflags = *cube.flags os_free,spectcube return, {image:ptr_new(newimage,/no_copy), noise:ptr_new(newnoise,/no_copy), flags:ptr_new(newflags,/no_copy)} end