;------------------------------------------------------------------ ;+ ; NAME: ; LCQXSETUP3 ; PURPOSE: ; This procedure accepts a BBSO VMG FITS file; a V ; image (magnetogram). ; The image is first unwrapped using my unwvmg procedure. ; A 12-bit Quantex image is assumed. ; ; 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 image is written back to the disk as a FITS ; image. 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). ; ; 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. ; ; A procedure like "centere" is run to estimate the center Sun ; position. A "fake" i image is constructed and the V image is ; divided by this fake i image. ; ; CATEGORY: ; POLAR ; CALLING SEQUENCE: ; LCQXSETUP3,vfile,imgscl ; INPUTS: ; vfile = file name for input magnetogram (FITS format). ; KEYWORD PARAMETERS: ; OUTPUTS: ; vfiless = FITS file of rebinned and "flattened" magnetogram ; This image is also divided by intensity. ; COMMON BLOCKS: ; NOTES: ; MODIFICATION HISTORY: ; J. Varsik, 18 Dec. 1995 --- Modified from LCSETUP ; for old QX images. ;- ;------------------------------------------------------------------- pro lcqxsetup3,vfinam,imgscl gcorr = 0.0 ; 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 ; 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) ; Rebin image vs = fix(CONGRID(vos,512,384)) ; Now estimate center Sun position in rebinned image. ; Obtain FITS parameters from V image ew = FXPAR(vih,'CRVAL1') ns = FXPAR(vih,'CRVAL2') datec = FXPAR(vih,'DATE-OBS') timec = FXPAR(vih,'TIME-OBS') READS,datec,day,mon,yrs,FORMAT='(i2,1x,i2,1x,i2)' READS,timec,hour,min,sec,FORMAT='(i2,1x,i2,1x,i2)' hr = hour + ((min + (sec / 60.0)) / 60.0) pandb,mon,day,yrs,hr,p,b,rsun,mjd sprad = rsun * imgscl sdrad = 0.0 if (gcorr EQ 0.0) then begin h = imgscl * ew + 256 k = (-1.0 * imgscl * ns) + 192 endif else begin h = imgscl * (ew / gcorr) + 256 k = (-1.0 * imgscl * (ns / gcorr)) + 192 endelse commx = 'center of sun, x-coordinate' commy = 'center of sun, y-coordinate' commr = 'radius of sun, pixels' commr2 = 'standard deviation in radius' fxaddpar,vih,'CENTERX',h,commx fxaddpar,vih,'CENTERY',k,commy fxaddpar,vih,'RADIUS',sprad,commr fxaddpar,vih,'SDRAD',sdrad,commr2 ; make fake I image rad2 = sprad * sprad imout = MAKE_ARRAY(512,384,/byte,value=0) FOR i = 0, 511 DO BEGIN FOR j = 0, 383 DO BEGIN r1 = (i+1-h)^2 + (j+1-k)^2 IF (r1 LE rad2) THEN BEGIN cost2 = 1.0 - (r1 / rad2) cost = SQRT(cost2) ldfunc = 1.00 - 0.88 + 0.23 + (0.88 * cost) - (0.23 * cost2) imout(i,j) = byte(255.0 * ldfunc) ENDIF ENDFOR ENDFOR ; Divide by intensity vsd = fix((256.0 * vs)/float(imout)) ; Write files CHECK_FITS,vsd,vih,/UPDATE,/FITS WRITEFITS,vfonam,vsd,vih finishup: return end