;+ ; lasco_cv.pro IDL procedure ; ; PURPOSE ; Read a list of LASCO c2 or c3 FITS images, ; calibrate, apply vignetting, ; and write a FITS file with a new name. ; ; SYNTAX ; lasco_cv, 'fits_list' ; ; PROCEDURES USED ; rdfits ; c2_calibrate ; c3_calibrate ; writefits ; fxaddpar ; ; HISTORY ; Author: Andrew L. Stanger 5 October 1998 ;- pro lasco_cv, fits_list fits_name = '' ; Define FITS file name variable. new_name = '' CLOSE, 1 ;PRINT, 'fits_list: ', fits_list OPENR, 1, fits_list ; Open list file. ;--- File Loop : WHILE (NOT EOF (1)) DO $ ; File processing loop. BEGIN ;{ READF, 1, fits_name ; Read FITS file name from list file. PRINT, 'fits_name: ', fits_name dn_img = rdfits (fits_name, header=dn_hdu) ; Read FITS image & header. cal_hdu = dn_hdu imin = MIN (dn_img, max=imax) ; Find min/max pixel intensity range. print, 'imin/imax: ', imin, imax ;--- Get keyword parameters from FITS header. xdim = fxpar (dn_hdu, "NAXIS1") ydim = fxpar (dn_hdu, "NAXIS2") bitpix = fxpar (dn_hdu, "BITPIX") observat = fxpar (dn_hdu, "OBSERVAT") date = fxpar (dn_hdu, "DATE-OBS") time = fxpar (dn_hdu, "TIME-OBS") detector = fxpar (dn_hdu, "DETECTOR") exptime = fxpar (dn_hdu, "EXPTIME") xsize = strtrim (string (xdim), 2) ; Convert to string w/o blanks. nbypx = bitpix / 8 IF (nbypx EQ 1) THEN pixtyp = "c" IF (nbypx EQ 2) THEN pixtyp = "s" IF (nbypx EQ 4) THEN pixtyp = "i" IF (nbypx EQ -4) THEN pixtyp = "f" IF (nbypx EQ -8) THEN pixtyp = "d" year = STRMID (date, 0, 4) month = STRMID (date, 5, 2) day = STRMID (date, 8, 2) date_dn_img = year + month + day date_obs = day + '/' + month + '/' + year ; fxaddpar, cal_hdu, 'DATE-OBS', date_obs, " DAY/MONTH/YEAR (UT)" hour = STRMID (time, 0, 2) minute = STRMID (time, 3, 2) second = STRMID (time, 6, 2) time_dn_img = hour + minute + second inst = STRLOWCASE (STRMID (detector, 0, 2)) ;--- Calibrate C2 image. IF (STRPOS (detector, "C2") NE -1) THEN $ ; C2 BEGIN ;{ cal_img = float (c2_cal (dn_img, cal_hdu)) sd = getenv ('NRL_LIB') + '/lasco/data/calib/' IF (DATATYPE (cal_hdu) NE 'STC') THEN $ hdr = LASCO_FITSHDR2STRUCT (cal_hdu) dte = STR2UTC (hdr.date_obs) yymmdd = UTC2YYMMDD (dte) vig_fn = get_cal_name (sd + 'C2_cl*vig*.dat', yymmdd) IF (vig_fn NE '') THEN $ BEGIN ;{ vig = READFITS (vig_fn, hvig) vhdr = LASCO_FITSHDR2STRUCT (hvig) mask = vig ;--- Centers for that vignetting file. ;--- Here, I put the centers into the vig file header ;--- for use in center_img. xvigcen = 512. yvigcen = 506. FXADDPAR, hvig, 'CRPIX1', xvigcen FXADDPAR, hvig, 'CRPIX2', yvigcen lhvig = LASCO_FITSHDR2STRUCT (hvig) ;--- Center the vignetting function vig = center_img (vig, lhvig) print, 'Used ' + vig_fn ENDIF $ ;} ELSE BEGIN ;{ print, 'ERROR: c2_cal - No ' + sd + 'C2_cl*vig*.dat file' cal_img = 0.0 * dn_img ENDELSE ;} cal_img = cal_img / vig ; Re-apply vignetting. END $ ;} ELSE $ IF (STRPOS (detector, "C3") NE -1) THEN $ ; C3 BEGIN ;{ cal_img = float (c3_cal (dn_img, cal_hdu)) END $ ;} ELSE $ cal_img = 0 * dn_img print, 'size (cal_img): ', size (cal_img) ; Convert DN to Bsun units. fmin = MIN (cal_img, max=fmax) ; Find min/max pixel intensity range. print, 'fmin/fmax: ', fmin, fmax fxaddpar, cal_hdu, 'DATAMIN', fmin, ' BSUN UNITS fxaddpar, cal_hdu, 'DATAMAX', fmax, ' BSUN UNITS fxaddpar, cal_hdu, 'DISPMIN', fmin, ' BSUN UNITS fxaddpar, cal_hdu, 'DISPMAX', fmax, ' BSUN UNITS fxaddpar, cal_hdu, 'HISTORY', 'VIGNETTING RE-APPLIED TO IMAGE.' fxaddpar, cal_hdu, 'BUNIT', 'BSUN', ' BSUN=AVERAGE SOLAR DISK BRIGHTNESS' ; new_name = inst + '.' + year + month + day + '.' $ ; + hour + minute + second + '.' + pixtyp + xsize + '.fts' new_name = inst + '.' + year + month + day + '.' $ + hour + minute + second + '.cv.fts' new_name = STRTRIM (new_name, 2) ; Eliminate any blanks. fxaddpar, cal_hdu, 'FILENAME', new_name PRINT, 'new_name: ', new_name ; -- Write FITS image to disk. writefits, new_name, cal_img, cal_hdu END ;} CLOSE, 1 END