;------------------------------------------------------------------ ;+ ; NAME: ; DMGSETUP ; PURPOSE: ; This procedure accepts a BBSO DMG FITS file. ; A flat-field magnetogram generated from Jongchul Chae's ; vmg_flat procedure is subtracted from the magnetogram ; to remove large-scale non-uniformities in the magnetogram. ; A V (really scaled V/I) and total I image are generated. ; This version does not rebin the pixels since the DMG ; pixels are already square. The images are returned as viss ; and jiss (for compatibility). ; ; Note that the old IRAF version deleted the original FITS ; files. This version does not. ; ; Note that the old version (using the boxcar smoothing) ; did not scale the VMG image when it was loaded. This ; version does. ; CATEGORY: ; POLAR ; CALLING SEQUENCE: ; DMGSETUP,vfile,vih,viss,jiss,flatfile,jflat,jdark ; INPUTS: ; vfile = file name for input magnetogram (FITS format). ; flatfile = IDL variable containing VMG flatfield image. ; jflat = IDL variable containing J flatfield image. ; jdark = IDL variable containing a dark frame with same number ; of frames as vfile ; KEYWORD PARAMETERS: ; OUTPUTS: ; vo = IDL variable containing "flattened" magnetogram ; jo = IDL variable containing flattened direct image ; COMMON BLOCKS: ; NOTES: ; MODIFICATION HISTORY: ; J. Varsik, 09 Nov. 1999 --- Port from lcsetup.pro. ;- ;------------------------------------------------------------------- pro dmgsetup,vfinam,vih,vo,jo,ffimg,jfimg ; Display IDL header if help is required. if (keyword_set(help)) then begin get_idlhdr,'dmgsetup.pro' goto,finishup endif k1 = 14500.0 ; Read V file vi = READFITS(vfinam,vih) vx = (FLOAT(vi(*,*,0)) - FLOAT(vi(*,*,1)))/ $ (FLOAT(vi(*,*,0))+FLOAT(vi(*,*,1)) - jdark) vx = k1 * vx vo = vx - ffimg ; Normalize J flat jmean = mean(jfimg) jn = jfimg / jmean ; Read J file jx = FLOAT(vi(*,*,0)) + FLOAT(vi(*,*,1)) jx = jx - jdark nz = where(jx ne 0.) z = where(jx eq 0., numzeros) if (numzeros gt 0) then begin jo(nz) = jx(nz) / jn(nz) jo(z) = 0. endif else begin jo = jx / jn endelse finishup: return end