pro triColor, pathB, pathV, pathR, reference=reference, magnitude=magnitude, flux=flux, align=align ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden ;--I.1-- Set IDL to Local Working Environment ----------------------------------------- ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Image Alignment & Flux Calibration -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Read BVR Images -------------------------------------------------------------- ;--II.1.1-- Read Files imB = readfits( pathB, headB, /silent ) imV = readfits( pathV, headV, /silent ) imR = readfits( pathR, headR, /silent ) ;--II.1.2-- Check Image Sizes dimB = size( imB ) dimV = size( imV ) dimR = size( imR ) ; if dimB ne dimV ;--II.1.3-- Check Image Sizes iCube = [ [[imB]], [[imV]], [[imR]] ] ;--II.2-- Image Alignment -------------------------------------------------------------- if keyword_set(align) then begin ;--II.2.1-- Pop-Up Image for Reference Selection xyB = grabXY( imB, /peak2D, title='B channel', subFrame=32, flux=fluxB ) xyR = grabXY( imR, /peak2D, title='V channel', subFrame=32, flux=fluxV ) xyV = grabXY( imV, /peak2D, title='R channel', subFrame=32, flux=fluxR ) xyBVR = [ [xyB], [xyV], [xyR] ] fluxBVR=[ fluxB, fluxV, fluxR ] ;--II.2.2-- Choose Reference Filter print, '--------------------------------------' print, ' B: '+string(xyB(0),format='(F6.1)')+' , '+string(xyB(1),format='(F6.1)') print, ' V: '+string(xyV(0),format='(F6.1)')+' , '+string(xyV(1),format='(F6.1)') print, ' R: '+string(xyR(0),format='(F6.1)')+' , '+string(xyR(1),format='(F6.1)') choice='' read, prompt='Align frames on B, V, or R references? ', choice, format='(A)' ;--II.2.3-- Choose Reference Filter j2Filter: case strtrim(choice,2) of 'B': refId = [1,0,0] 'V': refId = [0,1,0] 'R': refId = [0,0,1] else: begin read, prompt='Invalid choice ('+strtrim(choice,2)+'), please repeat (B,V,R): ', choice, format='(A)' goto, j2Filter end endcase index=where( refId eq 1, comp=toAlign ) ;--II.2.4-- Image Alignment refXY = xyBVR(*,index) aCube = iCube for k=0,1 do begin im = iCube(*,*,toAlign(k)) shifted = shift( im, xyBVR(0,toAlign(k))-refXY(0), xyBVR(1,toAlign(k))-refXY(1) ) aCube(*,*,toAlign(k)) = shifted endfor ;--II.3-- Flux Calibration ------------------------------------------------------------- if keyword_set(reference) then begin ;--II.3.1-- Convert Magnitude to Reference if Needed if keyword_set(magnitude) then reference=10^(-0.4*reference) ;--II.3.2-- Adjust Fluxes from Reference for k=0,2 do aCube(*,*,k) *= reference(k)/bluxBVR(k) endif endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- RGB Generation -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Output Frame Resolution ------------------------------------------------------ dim = size(imB) end