;------------------------------------------------------------------ ;+ ; NAME: ; LCQXSETUP2 ; PURPOSE: ; This procedure accepts two BBSO VMG FITS files, one V ; image (magnetogram) and one J or I image (direct image). ; A 50 x 50 boxcar smoothed image is generated and subtracted ; from the magnetogram to remove large-scale non-uniformities ; in the magnetogram (often due to KDP fringes). 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 written back to the disk as FITS ; images. The letters "ss" are put in the file name before ; the extension (before the first "." in the file name or ; at the end of the name). ; ; Note that the old IRAF version deleted the original FITS ; files. This version does not. ; ; Modified version for old QX images. Assumes 12-bit images. ; This version uses my old VMG unwrap procedure, instead of the ; one from the NOAO "HSC" IDL library. It doesn't unwrap ; everything, but it shouldn't add as many bogus horizontal lines ; to the image. ; CATEGORY: ; POLAR ; CALLING SEQUENCE: ; LCQXSETUP2,vfile,jfile,zpoff ; INPUTS: ; vfile = file name for input magnetogram (FITS format). ; jfile = file name for input direct image (FITS format). ; zpoff = zero-point offset for Quantex I image. ; KEYWORD PARAMETERS: ; OUTPUTS: ; vfiless = FITS file of rebinned and "flattened" magnetogram ; This image is also divided by intensity. ; jfiless = FITS file of rebinned direct image ; COMMON BLOCKS: ; NOTES: ; MODIFICATION HISTORY: ; J. Varsik, 18 Dec. 1995 --- Modified from LCSETUP ; for old QX images. ;- ;------------------------------------------------------------------- pro lcqxsetup2,vfinam,jfinam,zpoff ; Display IDL header if help is required. if (keyword_set(help)) then begin get_idlhdr,'lcqxsetup.pro' goto,finishup endif ; Make output file names. dotpos = STRPOS(vfinam,".") vflen = dotpos vfin1 = STRMID(vfinam,0,vflen) exlen = STRLEN(vfinam) - vflen ext = STRMID(vfinam,dotpos,exlen) vfonam = vfin1 + 'ss' + ext dotpos = STRPOS(jfinam,".") jflen = dotpos jfin1 = STRMID(jfinam,0,jflen) exlen = STRLEN(jfinam) - jflen ext = STRMID(jfinam,dotpos,exlen) jfonam = jfin1 + 'ss' + ext ; Read V file vi = READFITS(vfinam,vih,/NOSCALE) ; Unwrap, subtract 128, rescale ; Note that my unwrap also subtracts 128. viuw = unwvmg(vi) vix = 16 * viuw ; Generate boxcar smoothed file and subtract. vixa = make_array(640,640,/int,value=0) vixa(64,64) = vix s = SMOOTH(vixa,50) vo = vixa - s vos = vo(64:575,64:544) ; Read J file ji = READFITS(jfinam,jih,/NOSCALE) ; Rebin images vs = fix(CONGRID(vos,512,384)) js = byte( CONGRID(ji,512,384)) ; Divide by intensity vsd = fix((256.0 * vs)/(fix(js) + zpoff)) ; Write files CHECK_FITS,vsd,vih,/UPDATE,/FITS CHECK_FITS,js,jih,/UPDATE,/FITS WRITEFITS,vfonam,vsd,vih WRITEFITS,jfonam,js,jih finishup: return end