;+ ;NAME: ; EXAMINE_RESIDUALS ;PURPOSE: ; Visually inspect and compare two 'aligned' datacubes such as those ; provided by MOSES_ALIGN_ORDERS. Steps through the images in the ; two cubes, doing a tvscl of the difference (cube1 - cube2) for ; each exposure. The image medians are used for normalization. It is ; assumed that pixel value 0.0 corresponds to missing data. The ; residuals are set to zero wherever data is missing in either image. ;CALLING SEQUENCE: ; examine_residuals, cube1, cube2 ;HISTORY: ; 2006-May-30 C. Kankelborg ;- pro examine_residuals, cube1, cube2 size1 = size(cube1) NX1 = size1[1] NY1 = size1[2] NZ1 = size1[3] size2 = size(cube2) NX2 = size2[1] NY2 = size2[2] NZ2 = size2[3] if (NX1 ne NX2) or (NY1 ne NY2) or (NZ1 ne NZ2) then $ message,'Cubes are not the same size. Exiting.' for z = 0, NZ1-1 do begin ;Find good pixels. Assumes missing data is marked 0.0. ss = where( (cube1[*,*,z] ne 0.0) and (cube2[*,*,z] ne 0.0) ) ;Calculate normalization for this exposure, using only good pixels. norm = total( (cube1[*,*,z])[ss] )/total( (cube2[*,*,z])[ss] ) ;Calculate residuals array residuals = fltarr(NX1,NY1) ;reinitialize to 0.0 residuals[ss] = (cube1[*,*,z])[ss] - norm*(cube2[*,*,z])[ss] print,'Displaying residuals for exposure ',z xtv, residuals, screenwidth=1024, screenheight=512 endfor end