;------------------------------------------------------------------ ;+ ; NAME: ; LCSETUPHF ; PURPOSE: ; This procedure accepts two BBSO VMG FITS files, one V ; image (magnetogram) and one J or I image (direct image). ; A flat-field magnetogram generated from Jongchul Chae's ; vmg_flat procedure is subtracted from the magentogram ; to remove large-scale non-uniformities in the magnetogram. ; ; Then, both the V and the J (or I) images are rebinned from ; 512 x 481 to 512 x 384 to make the pixels square. ; The resulting images are returned in the viss and jiss ; variables. ; ; 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. ; ; This version is for use with old Datacube files without ; flatfield frames. A pseudo-flatfield is made using ; boxcar smoothing. ; ; This version is for use with a J flatfield image which ; has been constructed for this data set. ; ; CATEGORY: ; POLAR ; CALLING SEQUENCE: ; LCSETUPHF,vfile,jfile,vih,jih,viss,jiss,jflat ; INPUTS: ; vfile = file name for input magnetogram (FITS format). ; jfile = file name for input direct image (FITS format). ; KEYWORD PARAMETERS: ; OUTPUTS: ; viss = IDL variable containing rebinned and "flattened" magnetogram ; jiss = IDL variable containing rebinned, flattened direct image ; COMMON BLOCKS: ; NOTES: ; MODIFICATION HISTORY: ; J. Varsik, 13 Oct. 1995 --- Port from IRAF task ; J. Varsik, 08 Jan. 1999 --- Change to use flatfield image. ; J. Varsik, 24 Feb. 1999 --- Add J flatfield. ; J. Varsik, 03 May 1999 ; --- Modified from lcsetup, ; remove flats. ; J. Varsik, 05 May 1999 --- Put J flat back in. ; ;- ;------------------------------------------------------------------- pro lcsetuphf,vfinam,jfinam,vih,jih,viss,jiss,jflat ; Display IDL header if help is required. if (keyword_set(help)) then begin get_idlhdr,'lcsetuphf.pro' goto,finishup endif ; Read V file vi = READFITS(vfinam,vih) vixa = make_array(640,640,/float,value=0.0) vixa(64,64) = vi ; Generate boxcar smoothed file and subtract. s = SMOOTH(vixa,50) vo = vixa - s vos = vo(64:575,64:544) so = s(64:575,64:544) ; Use this (vos) as initial guess vbig = where(abs(vos) gt 10.0) vib = vi vib(vbig) = so(vbig) ;clip large magnetic field elements ; Now regenerate boxcar smoothing and subtract vixb = make_array(640,640,/float,value=0.0) vixb(64,64) = vib ; Generate boxcar smoothed file and subtract. s = SMOOTH(vixb,50) vo = vixa - s vos = vo(64:575,64:544) ; Normalize J flat jmean = mean(jflat) jn = jflat / jmean ; Read J file ji = READFITS(jfinam,jih,/NOSCALE) jo = ji nz = where(jn ne 0.) z = where(jn eq 0., numzeros) if (numzeros gt 0) then begin jo(nz) = ji(nz) / jn(nz) jo(z) = 0. endif else begin jo = ji / jn endelse ; Rebin images viss = CONGRID(vos,512,384) jiss = CONGRID(jo,512,384) finishup: return end